Class DynamicResponseHeaderFilter

java.lang.Object
net.shibboleth.utilities.java.support.net.DynamicResponseHeaderFilter
All Implemented Interfaces:
javax.servlet.Filter

public class DynamicResponseHeaderFilter
extends Object
implements javax.servlet.Filter
Implementation of an HTTP servlet Filter which supports configurable response header injection, including via injected functions that can conditionally attach headers.
  • Field Details

  • Constructor Details

    • DynamicResponseHeaderFilter

      public DynamicResponseHeaderFilter()
      Constructor.
  • Method Details

    • setHeaders

      public void setHeaders​(@Nullable @NonnullElements Map<String,​String> map)
      Set the headers to statically attach to all responses.
      Parameters:
      map - header map
    • setCallbacks

      public void setCallbacks​(@Nullable @NonnullElements Collection<Function<Pair<javax.servlet.http.HttpServletRequest,​javax.servlet.http.HttpServletResponse>,​Boolean>> theCallbacks)
      Set the callbacks to invoke to dynamically attach headers.
      Parameters:
      theCallbacks - callback collection
    • init

      public void init​(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
      Specified by:
      init in interface javax.servlet.Filter
      Throws:
      javax.servlet.ServletException
    • destroy

      public void destroy()
      Specified by:
      destroy in interface javax.servlet.Filter
    • doFilter

      public void doFilter​(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
      Specified by:
      doFilter in interface javax.servlet.Filter
      Throws:
      IOException
      javax.servlet.ServletException