Print the access logs before UrlRewriteFilter
I have an application in which currently I am using two filters.
First one is UrlRewriteFilter which is for re-writing the url.
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
开发者_运维知识库 <param-value>DEBUG</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Second is a filter which is printing the performance of each page, along with the url.
<filter>
<filter-name>PerfLoggingFilter</filter-name>
<filter-class>
com.sia.saa.common.filter.PerfLoggingFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>PerfLoggingFilter</filter-name>
<url-pattern>*.form</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
But in the logs only the re-written URL is being printed and not the original url.
Please suggest a way so that URL re-writing can continue but in the logs only the original url is printed. Note: Post questions in case you need other details.Since UrlRewriteFilter uses RequestDispatcher.forward()
, I guess you can obtain original request URLs in your logging filter as
request.getAttribute("javax.servlet.forward.request_uri")
so that you can log them.
Is it not possible to have the second filter before the first one? If the second filter is executed first, you will have the original url...
精彩评论