HttpServletRequest has several methods to get the original URL the client requested. This includes getRequestURI(), getPathInfo() and getQueryString().
If "sourceURL" means "the URL which was used to make this request", then the request object has methods to get that. I don't think there's a method which gets you the whole thing all at once, but (I'm not looking at the documentation right now) I recall there is getHost() and getPort(), and there are others to get the other parts of the URL.
So, no luck with any of that , but I took a peak at request object at debugger and it contains array naned specialAttributes with 9 elements , of which 5 and 7 contains inf on 'sourceURL' thing.
How to get that out, there is no request,getSpecialAttribute or something like that ?
Rob Spoor wrote:HttpServletRequest has several methods to get the original URL the client requested. This includes getRequestURI(), getPathInfo() and getQueryString().
The first reply gave you your answer. Why dig through attribute values, when you can simply call request.getRequestURI() ?
OCPJP
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
Miran Cvenkel wrote:Figured it out, thanks for help.
This is interesting, but wouldn't this discovery mean that it only applies to your developing server implementation of HttpServletRequest?
My work around would be sending a cookie that has the last sourceURL. A Filter could do this; however, if he disabled cookies I would be in a big problem.
regards,
Victor M. Pereira
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop