Class CustomHeaderFilter

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

    public class CustomHeaderFilter
    extends Object
    implements jakarta.ws.rs.container.ContainerRequestFilter, jakarta.ws.rs.client.ClientRequestFilter
    A filter for appending and validating custom headers.

    On the client side, appends a new custom request header with a configured name and value to each outgoing request.

    On the server side, validates that each request has a custom header with a configured name and value. If the validation fails a HTTP 403 response is returned.

    Author:
    Marek Potociar
    • Constructor Detail

      • CustomHeaderFilter

        public CustomHeaderFilter​(String headerName,
                                  String headerValue)
    • Method Detail

      • filter

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

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