|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ro.isdc.wro.http.WroFilter
public class WroFilter
Main entry point. Perform the request processing by identifying the type of the requested resource. Depending on the way it is configured.
Constructor Summary | |
---|---|
WroFilter()
|
Method Summary | |
---|---|
protected void |
configureDefaultHeaders(Map<String,String> map)
Deprecated. use WroFilter#newResponseHeaderConfigurer() and
ResponseHeadersConfigurer.configureDefaultHeaders(Map) |
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
|
protected void |
doInit(javax.servlet.FilterConfig config)
Custom filter initialization - can be used for extended classes. |
WroConfiguration |
getConfiguration()
|
protected MBeanServer |
getMBeanServer()
Override this method if you want to provide a different MBeanServer. |
WroManagerFactory |
getWroManagerFactory()
|
void |
init(javax.servlet.FilterConfig config)
|
protected String |
newMBeanName()
|
protected RequestHandlerFactory |
newRequestHandlerFactory()
|
protected ResponseHeadersConfigurer |
newResponseHeadersConfigurer()
|
protected ObjectFactory<WroConfiguration> |
newWroConfigurationFactory(javax.servlet.FilterConfig filterConfig)
|
protected WroManagerFactory |
newWroManagerFactory()
Factory method for WroManagerFactory . |
protected void |
onException(Exception e,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain)
Invoked when a Exception is thrown. |
protected void |
onRequestProcessed()
Useful for unit tests to check the post processing. |
protected void |
onRuntimeException(RuntimeException e,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain)
Deprecated. use onException(Exception, HttpServletResponse, FilterChain) |
void |
setConfiguration(WroConfiguration config)
Once set, this configuration will be used, instead of the one built by the factory. |
void |
setEnable(boolean enable)
Sets the enable flag used to toggle filter. |
void |
setRequestHandlerFactory(RequestHandlerFactory requestHandlerFactory)
Sets the RequestHandlerFactory used to create the collection of requestHandlers |
protected void |
setResponseHeaders(javax.servlet.http.HttpServletResponse response)
Method called for each request and responsible for setting response headers, used mostly for cache control. |
void |
setWroManagerFactory(WroManagerFactory wroManagerFactory)
Allows external configuration of WroManagerFactory (ex: using spring IoC). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WroFilter()
Method Detail |
---|
public final void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
protected String newMBeanName()
protected MBeanServer getMBeanServer()
MBeanServer
to use for JMX.protected ResponseHeadersConfigurer newResponseHeadersConfigurer()
ResponseHeadersConfigurer
.protected RequestHandlerFactory newRequestHandlerFactory()
RequestHandlerFactory
@Deprecated protected void configureDefaultHeaders(Map<String,String> map)
WroFilter#newResponseHeaderConfigurer()
and
ResponseHeadersConfigurer.configureDefaultHeaders(Map)
map
- the Map
where key represents the header name, and value - header value.protected void doInit(javax.servlet.FilterConfig config) throws javax.servlet.ServletException
javax.servlet.ServletException
Filter.init(FilterConfig).
public final void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
protected void onException(Exception e, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
Exception
is thrown. Allows custom exception handling. The default implementation redirects
to 404 WroRuntimeException
is thrown when in DEPLOYMENT mode.
e
- Exception
thrown during request processing.@Deprecated protected void onRuntimeException(RuntimeException e, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
onException(Exception, HttpServletResponse, FilterChain)
RuntimeException
is thrown. Allows custom exception handling. The default implementation
redirects to 404 for a specific WroRuntimeException
exception when in DEPLOYMENT mode.
e
- RuntimeException
thrown during request processing.protected void setResponseHeaders(javax.servlet.http.HttpServletResponse response)
response
- HttpServletResponse
object.public void setWroManagerFactory(WroManagerFactory wroManagerFactory)
WroManagerFactory
(ex: using spring IoC). When this value is set, the
default WroManagerFactory
initialization won't work anymore.
Note: call this method before init(FilterConfig)
is invoked.
wroManagerFactory
- the wroManagerFactory to setpublic final WroManagerFactory getWroManagerFactory()
WroManagerFactory
instance.public void setRequestHandlerFactory(RequestHandlerFactory requestHandlerFactory)
requestHandlerFactory
- to setprotected WroManagerFactory newWroManagerFactory()
WroManagerFactory
.
Creates a WroManagerFactory
configured in WroConfiguration
using reflection. When no configuration
is found a default implementation is used.
Note: this method is not invoked during initialization if a WroManagerFactory
is set using
setWroManagerFactory(WroManagerFactory)
.
WroManagerFactory
instance.protected ObjectFactory<WroConfiguration> newWroConfigurationFactory(javax.servlet.FilterConfig filterConfig)
ObjectFactory
used to create a WroConfiguration
object.public final WroConfiguration getConfiguration()
WroConfiguration
associated with this filter instance.public final void setConfiguration(WroConfiguration config)
config
- a not null WroConfiguration
to set.public void setEnable(boolean enable)
enable
- flag for enabling the WroFilter
.protected void onRequestProcessed()
public void destroy()
destroy
in interface javax.servlet.Filter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |