I am having a filter at a location (/dir/store_image/*).
When I am redirecting to it through a RequestDispatcher its not working.
But its working fine with response.sendRedirect.
With requestDispatcher the output is - the requested resource is not available.
The example code -
String path = req.getRequestURI() ;
path = path.substring(path.lastIndexOf("/")+1, path.length());
path = "../dir/store_image/" + path;
/* Not working
RequestDispatcher request_Dispatcher=request.getRequestDispatcher(path);
request_Dispatcher.forward(request,response);*/
//Working
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.sendRedirect(path);
The filter mapping -
(from StoreImageA i am forwarding to StoreImage)
<filter-mapping>
<filter-name>StoreImage</filter-name>
<url-pattern>/dir/store_image/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>StoreImageA</filter-name>
<url-pattern>/store_image/*</url-pattern>
</filter-mapping>