Learn to build JAX-RS 2.0 HATEOAS links in REST resources using it’s javax.ws.rs.core.Link, javax.ws.rs.core.UriBuilder and javax.ws.rs.core.UriInfo classes.
Learn to REST build APIs using JAX-RS 2.0 and RESTEasy 3.1.2.Final ,Servlet 3.0 container, by configuring resteasy-servlet-initializer and @ApplicationPath.
Although SOAP and RESTful Web Services – both serve the same purpose i.e. building applications based on SOA (Service-Oriented Architecture), yet they are pretty much different in the way how they help in achieving the final output. Let’s note down the most noticeable differences between SOAP and REST based APIs: SOAP REST SOAP is a […]
JAX-RS Resteasy has automatic GZIP decompression support. If the client framework or a JAX-RS service receives a message body with a Content-Encoding of “gzip”, it will automatically decompress it. The client framework automatically sets the Accept-Encoding header to be “gzip, deflate”. So you do not have to set this header yourself. To use gzip compression, […]
JAX-RS 2.0 has brought lots of improvement over previous version. One of major improvement is client API which was completely missing in JAX-RS 1.0. While it was easy to write a portable JAX-RS service, each JAX-RS implementation defined their own proprietary API. JAX-RS 2.0 fills in this gap with a fluent, low-level, request building API. […]
If you are using RESTEasy 3.x.y which has been support for JAX-RS 2.0, and you are trying to write RESTEasy client then you can face this exception. Full stack trace might look like this: Root cause Probably you are following trying to wrire the client code as follows: JAX-RS relies on the Service Provider convention. […]
The new RESTEasy version 3.0.2 final has been recently released and is made compatible with JAX-RS 2.0. If you remember that previous JAX-RS releases had no specification regarding implementing filters and interceptors. That’s why all JAX-RS implementations had their own flavors. e.g. RESTEasy had PreProcessorInterceptor and PostProcessorInterceptor. PreProcessorInterceptor and PostProcessorInterceptor are deprecated now. Now JAX-RS […]
Security is an integral part of any enterprise application. Security involves two phases i.e. authentication and authorization. Authentication verifies who you are. Authorization verifies what you are authorized to do. In this post, we will learn to build role based basic authentication/ authorization security for REST APIs. Sections in this post: Background information Important classes/annotations […]
ETags or entity tags are useful HTTP headers which can help in building a super fast application by minimizing the server load on 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 […]
JAX-RS RESTEasy has very good support for all kind of application activities which can be customized to desired level. One of such capability is Exception handling. To build custom exception handlers, JAX-RS provides ExceptionMapper interface. ExceptionMapper is a contract for a provider that maps Java exceptions to Response object. An implementation of this interface must […]