RESTEasy is a JBoss / Red Hat project to help us build RESTful Web Services and RESTful Java applications. The below tutorials are built using the RESTEasy framework.
RESTEasy can run in any Servlet container, but tighter integration with WildFly Application Server and Quarkus is also available to make the user experience nicer in those environments.
1. Getting Started
RESTEasy + JBOSS 7 Hello world application
Learn about the most basic configuration needed to build a RESTful web application in JBoss AS7.
RESTEasy + Tomcat Hello world application
Learn about the minimum configuration needed to build a RESTful web application using a Tomcat server.
2. REST Clients
RESTful client using java.net package
Build restful clients for consuming the restful APIs using java.net package
.
RESTEasy client example
Build restful clients for consuming the restful apps using inbuilt JAX-rs capabilities.
Apache HttpClient example
Build restful clients for consuming the restful APIs using the apache HTTP client framework.
Ajax/ JavaScript client Example
Learn to build a resteasy ajax client
JAX-RS 2.0 client API example
JAX-RS 2.0 has brought lots of improvement over the previous version. One of the major improvements is client API which was completely missing in JAX-RS 1.0. Learn to use it in this tutorial.
3. XML/JSON Support
RESTEasy + JAXB xml example
Learn to marshal model objects in XML documents using JAXB and send them to the client as server response
RESTEasy + Jettison JSON example
Learn to marshal model objects in JSON documents using Jettison and send them to the client as server response
RESTEasy + Jackson JSON example
Learn to marshal model objects in JSON documents using Jackson and send them to the client as server response
4. File Download/Upload
RESTEasy + File download example
This example shows the configuration and code needed to download various file formats using RESTful API
RESTEasy + File Upload + HttpClient pure java client example
Upload the file to the server using a pure java client
RESTEasy + File Upload + HTML form example
Upload the file to the server using html form submission
5. Annotations
JAX-RS @Path Regex-based URI matching
Example of API path matching using @Path annotation. Some regular expression examples are also included.
6. Hateoas
RESTful web services HATEOAS example
Learn to make RESTful web services with HATEOAS links enabled
7. Security
Basic authentication and authorization example using PreProcessorInterceptor
Implement security using PreProcessorInterceptor
.
JAX-RS 2.0 RESTEasy 3.0.2.Final security example using ContainerRequestFilter
PreProcessorInterceptor
and PostProcessorInterceptor
are deprecated now. So from now on, use ContainerRequestFilter
and ContainerReponseFilter
. Learn to use them in this tutorial.
REST Security Guide
Knowledge of securing RESTful Web Services is as much important as writing them. It’s very important to write secure APIs to protect the business. But before starting to secure RESTful APIs, let’s understand what our options are as developers. What will be a good fit for our usecase?
8. Validation
Custom html form validation using ajax
Build Ajax powered html form validation functionality for your web page
Hibernate validator provider demo
Integrate hibernate bean validation capability to your RESTEasy APIs
9. Integrations
RESTful web services using Spring 3 MVC
Learn how to write RESTful web services using the Spring 3 framework
10. Best practices
Share context data using ResteasyProviderFactory
ResteasyProviderFacory
can be proved very handy when you want to share some data in various layers of application without passing them as method parameters
Exception handling using a custom exception mapper
Build custom exception mappers to handle application-specific handling of various exceptions
Enable gzip compression content encoding
JAX-RS Resteasy has automatic GZIP decompression support. Learn to use it.
JAX-RS RESTEasy Cache-control with ETag example
ETags or entity tags are useful HTTP headers that can help in building a super-fast application by minimizing the server load on the system. ETag is set to the response to the client so a client can use various control request headers such as If-Match
and If-None-Match
for conditional requests. javax.ws.rs.core.Response.ResponseBuilder#tag(
) and javax.ws.rs.core.EntityTag
are useful classes to work on ETags.
Happy Learning !!
Leave a Reply