Class HttpAuthorizationFilter

  • All Implemented Interfaces:
    jakarta.ws.rs.client.ClientRequestFilter, jakarta.ws.rs.client.ClientResponseFilter

    @ConstrainedTo(CLIENT)
    public class HttpAuthorizationFilter
    extends Object
    implements jakarta.ws.rs.client.ClientRequestFilter, jakarta.ws.rs.client.ClientResponseFilter
    A ClientResponseFilter which repeats the request if the response from the original request has a status of Response.Status.UNAUTHORIZED. It uses the AuthorizationProcessor's provided to add a HttpHeaders.AUTHORIZATION header created from the processor.
    Author:
    James R. Perkins
    • Constructor Detail

      • HttpAuthorizationFilter

        public HttpAuthorizationFilter​(AuthorizationProcessor... processors)
        Creates a new filter with a default limit for the cached size.
        Parameters:
        processors - the processors used to create the authorization header
      • HttpAuthorizationFilter

        public HttpAuthorizationFilter​(int limit,
                                       AuthorizationProcessor... processors)
        Creates a new filter with a default limit for the cached size.
        Parameters:
        limit - the maximum number of entries to cache for repeat requests
        processors - the processors used to create the authorization header
      • HttpAuthorizationFilter

        public HttpAuthorizationFilter​(int limit,
                                       Collection<AuthorizationProcessor> processors)
        Creates a new filter.
        Parameters:
        limit - the maximum number of entries to cache for repeat requests
        processors - the processors used to create the authorization header
    • Method Detail

      • filter

        public void filter​(jakarta.ws.rs.client.ClientRequestContext requestContext)
                    throws IOException
        Specified by:
        filter in interface jakarta.ws.rs.client.ClientRequestFilter
        Throws:
        IOException
      • filter

        public void filter​(jakarta.ws.rs.client.ClientRequestContext requestContext,
                           jakarta.ws.rs.client.ClientResponseContext responseContext)
                    throws IOException
        Specified by:
        filter in interface jakarta.ws.rs.client.ClientResponseFilter
        Throws:
        IOException