Package spark.http.matching
Class MatcherFilter
- java.lang.Object
-
- spark.http.matching.MatcherFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class MatcherFilter extends java.lang.Object implements javax.servlet.FilterMatches Spark routes and filters.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringACCEPT_TYPE_REQUEST_MIME_HEADERprivate ExceptionMapperexceptionMapperprivate booleanexternalContainerprivate booleanhasOtherHandlersprivate static java.lang.StringHTTP_METHOD_OVERRIDE_HEADERprivate static org.slf4j.LoggerLOGprivate RoutesrouteMatcherprivate SerializerChainserializerChainprivate StaticFilesConfigurationstaticFiles
-
Constructor Summary
Constructors Constructor Description MatcherFilter(Routes routeMatcher, StaticFilesConfiguration staticFiles, ExceptionMapper exceptionMapper, boolean externalContainer, boolean hasOtherHandlers)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()voiddoFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain chain)private java.lang.StringgetHttpMethodFrom(javax.servlet.http.HttpServletRequest httpRequest)voidinit(javax.servlet.FilterConfig config)
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
ACCEPT_TYPE_REQUEST_MIME_HEADER
private static final java.lang.String ACCEPT_TYPE_REQUEST_MIME_HEADER
- See Also:
- Constant Field Values
-
HTTP_METHOD_OVERRIDE_HEADER
private static final java.lang.String HTTP_METHOD_OVERRIDE_HEADER
- See Also:
- Constant Field Values
-
staticFiles
private final StaticFilesConfiguration staticFiles
-
routeMatcher
private Routes routeMatcher
-
serializerChain
private SerializerChain serializerChain
-
exceptionMapper
private ExceptionMapper exceptionMapper
-
externalContainer
private boolean externalContainer
-
hasOtherHandlers
private boolean hasOtherHandlers
-
-
Constructor Detail
-
MatcherFilter
public MatcherFilter(Routes routeMatcher, StaticFilesConfiguration staticFiles, ExceptionMapper exceptionMapper, boolean externalContainer, boolean hasOtherHandlers)
Constructor- Parameters:
routeMatcher- The route matcherstaticFiles- The static files configuration objectexternalContainer- Tells the filter that Spark is run in an external web container. If true, chain.doFilter will be invoked if request is not consumed by Spark.hasOtherHandlers- If true, do nothing if request is not consumed by Spark in order to let others handlers process the request.
-
-
Method Detail
-
init
public void init(javax.servlet.FilterConfig config)
- Specified by:
initin interfacejavax.servlet.Filter
-
doFilter
public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException- Specified by:
doFilterin interfacejavax.servlet.Filter- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
getHttpMethodFrom
private java.lang.String getHttpMethodFrom(javax.servlet.http.HttpServletRequest httpRequest)
-
destroy
public void destroy()
- Specified by:
destroyin interfacejavax.servlet.Filter
-
-