Package de.hybris.platform.util
Class ProfilingFilter
java.lang.Object
de.hybris.platform.util.ProfilingFilter
- All Implemented Interfaces:
javax.servlet.Filter
Filter that will intercept requests & time how long it takes for them to return. It stores this information in the ProfilingTimerBean.
Install the filter in your web.xml file as follows:
<filter>
<filter-name>profiling</filter-name>
<filter-class>de.hybris.platform.util.ProfilingFilter</filter-class>
<init-param>
<param-name>activate.param</param-name>
<param-value>profilingfilter</param-value>
</init-param>
<init-param>
<param-name>autostart</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>profiling</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
With the above settings you can turn the filter on by accessing any URL with the parameter
profilingfilter=on.eg:
http://mywebsite.com/a.jsp?<b><i>profilingfilter=on</i></b>
The above settings also sets the filter to start automatically upon startup. This may be useful for development, but you will most likely want to set this false in production.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()voiddoFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) Check for parameters to turn the filter on or off.javax.servlet.FilterConfigvoidinit(javax.servlet.FilterConfig filterConfig) voidsetFilterConfig(javax.servlet.FilterConfig filterConfig)
-
Constructor Details
-
ProfilingFilter
public ProfilingFilter()
-
-
Method Details
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException Check for parameters to turn the filter on or off. If parameters are given, change the current state of the filter. If current state is off then pass to filter chain. If current state is on - record start time, pass to filter chain, and then record total time on the return.- Specified by:
doFilterin interfacejavax.servlet.Filter- Throws:
IOExceptionjavax.servlet.ServletException
-
setFilterConfig
public void setFilterConfig(javax.servlet.FilterConfig filterConfig) -
getFilterConfig
public javax.servlet.FilterConfig getFilterConfig() -
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException - Specified by:
initin interfacejavax.servlet.Filter- Throws:
javax.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfacejavax.servlet.Filter
-