Class ResultScopeResponseFilter

java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.providers.ResultScopeResponseFilter
All Implemented Interfaces:
jakarta.ws.rs.container.ContainerRequestFilter, jakarta.ws.rs.container.ContainerResponseFilter

@Provider @PreMatching public class ResultScopeResponseFilter extends Object implements jakarta.ws.rs.container.ContainerRequestFilter, jakarta.ws.rs.container.ContainerResponseFilter
Global JAX-RS filter that emits the accumulated ResultScope tokens as a single combined X-Result-Scope response header.

The tokens come from the current JAX-RS ContainerRequestContext properties, where the Policy Enforcement Points accumulate them, plus ResultScope.PREVIOUS_PATH when the caller's token was resolved through a previous path during the request (TokenContextResolution); in that case the X-Resolved-Context-Path header carries the resolved Context's current path. Since every consumer of the token Context goes through TokenContextResolution, the two headers appear on every response whose request derived its Context from a previous-path token, whatever the operation.

The request-side filter forgets any resolution left on the thread before the request is matched, and the response-side filter forgets it once the headers are emitted.

Author:
Luca Frosini (ISTI - CNR)
  • Constructor Details

    • ResultScopeResponseFilter

      public ResultScopeResponseFilter()
  • Method Details

    • filter

      public void filter(jakarta.ws.rs.container.ContainerRequestContext requestContext) throws IOException
      Specified by:
      filter in interface jakarta.ws.rs.container.ContainerRequestFilter
      Throws:
      IOException
    • filter

      public void filter(jakarta.ws.rs.container.ContainerRequestContext requestContext, jakarta.ws.rs.container.ContainerResponseContext responseContext) throws IOException
      Specified by:
      filter in interface jakarta.ws.rs.container.ContainerResponseFilter
      Throws:
      IOException