You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nikola Milutinovic <Ni...@ev.co.yu> on 2005/04/30 00:21:55 UTC

(Maybe not so) strange behaviour of request.getRequestURL()

Hi all.

I've been struck all of a sudden with this. 
servletRequest.getRequestURL() returns null.

Now, thinking about it, I can give some facts that might shed some light 
on it and I'm pretty sure I know why it is happening, just want to 
confirm with you guys. And just wandering if anyone can tell *what* is 
happening. I repeat, I think I know the cause.

I'm building a Struts based application and I had a Struts Action that 
was, at one point, extracting the URL and playing with it. "All of a 
sudden" it stopped working, belching with NullPointerException. Same 
method, no change.

One thing that I DID change was Struts chaining. I have created another 
action that is in front of it and chains in on that one, without 
redirects. This effectively means that I have one active component, like 
a Servlet (OK, Struts Action is not *exactly* a Servlet, but it is very 
close), which forwards to another. It would appear, that the second 
component in the chain of request handling is either loosing or is never 
getting some request properties.

So, my questions are:

1. (obviously) Has anyone else seen this in Struts?
2. What would have happened in the case of real Servlets?

Suppose I create 2 Servlets, have one forward to another, will the 
second Servlet be able to get request.getRequestURL()? It could be that 
this is Struts' mucking around, but it could be that it is a feature of 
JSP/Servlet specification.

Nix.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: (Maybe not so) strange behaviour of request.getRequestURL()

Posted by Mark Thomas <ma...@apache.org>.
If you use servlets you should read SRV.8.4 of the spec very carefully. 
You should also be aware that only the most recent TC5.5.x releases 
correctly implement the requirements of this part of the spec.

Mark

Nikola Milutinovic wrote:
> Hi all.
> 
> I've been struck all of a sudden with this. 
> servletRequest.getRequestURL() returns null.
> 
> Now, thinking about it, I can give some facts that might shed some light 
> on it and I'm pretty sure I know why it is happening, just want to 
> confirm with you guys. And just wandering if anyone can tell *what* is 
> happening. I repeat, I think I know the cause.
> 
> I'm building a Struts based application and I had a Struts Action that 
> was, at one point, extracting the URL and playing with it. "All of a 
> sudden" it stopped working, belching with NullPointerException. Same 
> method, no change.
> 
> One thing that I DID change was Struts chaining. I have created another 
> action that is in front of it and chains in on that one, without 
> redirects. This effectively means that I have one active component, like 
> a Servlet (OK, Struts Action is not *exactly* a Servlet, but it is very 
> close), which forwards to another. It would appear, that the second 
> component in the chain of request handling is either loosing or is never 
> getting some request properties.
> 
> So, my questions are:
> 
> 1. (obviously) Has anyone else seen this in Struts?
> 2. What would have happened in the case of real Servlets?
> 
> Suppose I create 2 Servlets, have one forward to another, will the 
> second Servlet be able to get request.getRequestURL()? It could be that 
> this is Struts' mucking around, but it could be that it is a feature of 
> JSP/Servlet specification.
> 
> Nix.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org