Aug 25, 2018

[HDGEM] Server side Request filter

Server side request filters act on incoming HTTP requests from the clients and provide an opportunity to act on/make decisions based on certain characteristics of the HTTP request.

In order to implement a server side request filter, one needs to implement the javax.ws.rs.container.ContainerRequestFilter interface (which is an extension provided by JAX-RS).

An instance of the javax.rs.ws.ContainerRequestContext interface is seamlessly injected by the container into the filter method of ContainerRequestFilter. It is a mutable object (on purpose) and exposes methods to access and modify HTTP request components.

A JAX-RS request processing pipeline involves dispatching a HTTP request to the appropriate Java
method in the resource classes based on matching algorithm implemented by the JAX-RS provider.
Filters take this into account and are divided into pre and post matching filters.

--
Posted By Blogger to HDGEM at 11/24/2016 11:49:00 AM