I made a filter to capture HttpServletRequest
sevlet path from all requests
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest)req;
HttpServletResponse response = (HttpServletResponse)res;
// debug to see the output
String path = request.getServletPath();
filterChain.doFilter(request, response);
}
There is a URL in jsp that has no controller or view mapped to it
<div>
<spring:url value="/app" var="app_url" htmlEscape="true"/>
<a href="${app_url}"><spring:message code="label_3rd_app" /></a>
</div>
However, when click on the url while debugging on the filter, I see request.getServletPath()
value from two request:
/null
/null/app
My question is why request.getServletPath()
never returns /app
instead?