Class QueryMethodOverrideFilter
java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.providers.QueryMethodOverrideFilter
- All Implemented Interfaces:
jakarta.ws.rs.container.ContainerRequestFilter
@Provider
@PreMatching
public class QueryMethodOverrideFilter
extends Object
implements jakarta.ws.rs.container.ContainerRequestFilter
Global JAX-RS request filter providing the
POST compatibility fallback for the
RFC 10008 QUERY HTTP method: network intermediaries (WAFs, proxies) or client
libraries that block non-standard HTTP methods can send POST {path}/query carrying
the X-HTTP-Method-Override: QUERY header instead of a native QUERY {path}.
Runs PreMatching, i.e. before JAX-RS resource matching: the fallback request is
rewritten to QUERY {path} (the /query suffix is stripped), so it reaches the
exact same QUERY-annotated controller method as a native request. The rewrite is
recorded in the POST_FALLBACK_PROPERTY request property, so that the links emitted
for the response keep the form of the request.
Only the suffixed form is a fallback. A POST carrying the override header without
the /query suffix is rejected with 400 Bad Request, so it can never be
executed as a creation on a path that also accepts POST; a POST {path}/query
without the override header is not a query either and is rejected with
400 Bad Request.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRequest property set toBoolean.TRUEwhen the request arrived through thePOST {path}/queryfallback and was rewritten toQUERY {path}. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfilter(jakarta.ws.rs.container.ContainerRequestContext requestContext)
-
Field Details
-
POST_FALLBACK_PROPERTY
Request property set toBoolean.TRUEwhen the request arrived through thePOST {path}/queryfallback and was rewritten toQUERY {path}.- See Also:
-
-
Constructor Details
-
QueryMethodOverrideFilter
public QueryMethodOverrideFilter()
-
-
Method Details
-
filter
public void filter(jakarta.ws.rs.container.ContainerRequestContext requestContext) throws IOException - Specified by:
filterin interfacejakarta.ws.rs.container.ContainerRequestFilter- Throws:
IOException
-