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 String
private ExceptionMapper
private boolean
private boolean
private static final String
private static final org.slf4j.Logger
private Routes
private SerializerChain
private final StaticFilesConfiguration
-
Constructor Summary
ConstructorsConstructorDescriptionMatcherFilter
(Routes routeMatcher, StaticFilesConfiguration staticFiles, ExceptionMapper exceptionMapper, boolean externalContainer, boolean hasOtherHandlers) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
void
doFilter
(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain chain) private String
getHttpMethodFrom
(javax.servlet.http.HttpServletRequest httpRequest) void
init
(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:
init
in 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:
doFilter
in interfacejavax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
-
getHttpMethodFrom
-
destroy
public void destroy()- Specified by:
destroy
in interfacejavax.servlet.Filter
-