Package org.eclipse.jetty.servlets
Class HeaderFilter
- java.lang.Object
-
- org.eclipse.jetty.servlets.IncludeExcludeBasedFilter
-
- org.eclipse.jetty.servlets.HeaderFilter
-
- All Implemented Interfaces:
Filter
public class HeaderFilter extends IncludeExcludeBasedFilter
Header FilterThis filter sets or adds a header to the response.
The
headerConfiginit param is a CSV of actions to perform on headers, with the following syntax:
[action] [header name]: [header value]
[action] can be one ofset,add,setDate, oraddDate
The date actions will add the header value in milliseconds to the current system time before setting a date header.Below is an example value for
headerConfig:
set X-Frame-Options: DENY, "add Cache-Control: no-cache, no-store, must-revalidate", setDate Expires: 31540000000, addDate Date: 0
- See Also:
IncludeExcludeBasedFilter
-
-
Constructor Summary
Constructors Constructor Description HeaderFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoFilter(ServletRequest request, ServletResponse response, FilterChain chain)voidinit(FilterConfig filterConfig)StringtoString()-
Methods inherited from class org.eclipse.jetty.servlets.IncludeExcludeBasedFilter
destroy, guessMimeType, shouldFilter
-
-
-
-
Method Detail
-
init
public void init(FilterConfig filterConfig) throws ServletException
- Specified by:
initin interfaceFilter- Overrides:
initin classIncludeExcludeBasedFilter- Throws:
ServletException
-
doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
- Throws:
IOExceptionServletException
-
toString
public String toString()
- Overrides:
toStringin classIncludeExcludeBasedFilter
-
-