public class SparkFilter extends Object implements javax.servlet.Filter
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_CLASS_PARAM |
Constructor and Description |
---|
SparkFilter() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain) |
protected SparkApplication |
getApplication(javax.servlet.FilterConfig filterConfig)
Deprecated.
Use
getApplications(FilterConfig) instead. |
protected SparkApplication |
getApplication(String applicationClassName)
Returns an instance of
SparkApplication which on which init() will be called. |
protected SparkApplication[] |
getApplications(javax.servlet.FilterConfig filterConfig)
Returns the instances of
SparkApplication which on which init() will be called. |
void |
init(javax.servlet.FilterConfig filterConfig) |
public static final String APPLICATION_CLASS_PARAM
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
@Deprecated protected SparkApplication getApplication(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
getApplications(FilterConfig)
instead.SparkApplication
which on which init()
will be called.
Default implementation looks up the class name in the filterConfig using the key "applicationClass".
Subclasses can override this method to use different techniques to obtain an instance (i.e. dependency injection).filterConfig
- the filter configuration for retrieving parameters passed to this filter.javax.servlet.ServletException
- if anything went wrong.protected SparkApplication getApplication(String applicationClassName) throws javax.servlet.ServletException
SparkApplication
which on which init()
will be called.
Default implementation looks up the class name in the filterConfig using the key "applicationClass".
Subclasses can override this method to use different techniques to obtain an instance (i.e. dependency injection).applicationClassName
- the spark application class name passed to this filter.javax.servlet.ServletException
- if anything went wrong.protected SparkApplication[] getApplications(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
SparkApplication
which on which init()
will be called.
Default implementation looks up the class names in the filterConfig using the key "applicationClass".
Subclasses can override this method to use different techniques to obtain an instance (i.e. dependency injection).filterConfig
- the filter configuration for retrieving parameters passed to this filter.javax.servlet.ServletException
- if anything went wrong.public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
Copyright © 2016. All rights reserved.