Package spark.http.matching
Class MatcherFilter
java.lang.Object
spark.http.matching.MatcherFilter
- All Implemented Interfaces:
javax.servlet.Filter
Matches Spark routes and filters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate ExceptionMapperprivate booleanprivate booleanprivate static final Stringprivate static final org.slf4j.Loggerprivate Routesprivate SerializerChainprivate final StaticFilesConfiguration -
Constructor Summary
ConstructorsConstructorDescriptionMatcherFilter(Routes routeMatcher, StaticFilesConfiguration staticFiles, ExceptionMapper exceptionMapper, boolean externalContainer, boolean hasOtherHandlers) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()voiddoFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain chain) private StringgetHttpMethodFrom(javax.servlet.http.HttpServletRequest httpRequest) voidinit(javax.servlet.FilterConfig config)
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
ACCEPT_TYPE_REQUEST_MIME_HEADER
- See Also:
-
HTTP_METHOD_OVERRIDE_HEADER
- See Also:
-
staticFiles
-
routeMatcher
-
serializerChain
-
exceptionMapper
-
externalContainer
private boolean externalContainer -
hasOtherHandlers
private boolean hasOtherHandlers
-
-
Constructor Details
-
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 Details
-
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 IOException, javax.servlet.ServletException - Specified by:
doFilterin interfacejavax.servlet.Filter- Throws:
IOExceptionjavax.servlet.ServletException
-
getHttpMethodFrom
-
destroy
public void destroy()- Specified by:
destroyin interfacejavax.servlet.Filter
-