Sorry i forget to say that if i change the url to which i redirect requests
into "/servizi/templates/page.jsp" the encodeURL go right but the forward
does not go (i get 404).
Hi all.
I have noticed a strange thing with isEncodeable/toAbsolute
(HttpServletResponseFacade.java) in Tomcat 3.2.1.
I'm using encodeURL into a RequestDispatcher.forward and i'm forwarding a
request from a servlet to a JSP.
The context is "/servizi" and he URL to which i'm forwarding the request is
"/templates/page.jsp", which is a directory inside the context "/servizi"
(so the URL is relative to the context).
The URL i'm forwarding requests is changed by toAbsolute into
"http://server/templates/page.jsp" which does not contain the servlet
context (the right for me it would be
"http://server/servizi/templates/page.jsp").
The method isEncodeable test if the URL start with the context path, so in
my case this does not happens !!
String contextPath = request.getContext().getPath();
if ((contextPath != null) && (contextPath.length() > 0)) {
String file = url.getFile();
if ((file == null) || (!file.startsWith(contextPath))
return( false );
}
contextPath = "/servizi"
url=http://server/templates/page.jsp"
url.getFilte() = "/templates/page.jsp"
The URL is changed by toAbsolute method with:
Request req = response.getRequest();
String requrl = HttpUtils.getRequestURL( request.getFacade() ).toString();
try {
url = new URL( new URL( requrl ), location );
}....
HttpUtils.getRequestURL(..) = http://server/servizi/servlet/myServlet
All this it's to explain that the encodeURL does not work when used inside
RequestDispatcher.forward().
Does anyone can explain me what i'm doing of wrong ?
Thanks in advance. Max