문제

I am using UrlRewriteFilter to make my URLs pretty. From within my application I frequently need to access the current URL. I do it like this:

ServletActionContext.getRequest().getRequestURI();

However this gives me the ugly version of the URL. How can I access the pretty URL before it is turned into ugly one by UrlRewriteFilter?

도움이 되었습니까?

해결책 2

I have found this solution here.

This worked for me:

ServletActionContext.getRequest().getAttribute(
            "javax.servlet.forward.request_uri");

다른 팁

You can extend the URLRewriteFilter class and override the doFilter method to store the request path in request attribute (Use this attribute to access the pretty url). Later call the super.doFilter method to let URLRewriteFilter do its job.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top