Due to security reasons, some corporate firewalls (HTTP proxies) support only the POST
and GET
methods. This restriction forces a REST API client to use only those HTTP methods that are allowed through the firewall. RESTful web API implementations can work around this restriction by letting the client override the HTTP method via the custom X-HTTP-Method-Override
HTTP header. The REST API client can specify an X-HTTP-Method-Override
request header with a string value containing either PUT
, PATCH
, or DELETE
. When the server gets the request, the server replaces the POST
method call with the method string value set for X-HTTP-Method-Override
.
JAX-RS allows you to implement this behavior via prematching javax.ws.rs.container.ContainerRequestFilter
. To learn more about ContainerRequestFilter
, refer to the Understanding filters and interceptors in JAX-RS section in Chapter 4, Advanced Features in the JAX-RS API.
//Other imports are omitted for brevity import javax.ws.rs...