[opencms-dev] Detecting URL in browser location bar?

Robert Petermeier robert2.0 at gmx.de
Mon Apr 24 10:50:56 CEST 2006


Joe Desbonnet schrieb:
> In a normal servlet environment the getRequestURL() of the HttpRequest
> object gives me this information. However as far as I can tell,
> somewhere between Apache and the OpenCms request object this
> information is lost.

Yes, and what getRequestURL() returned when I tested this is quite 
strange. Not the URL of the request, not even the URL of the template, 
but the URL of one element included by the template (the template 
actually includes more than one element).

> Does anyone know a reliable way of figuring out what URL is in the
> browser location bar for a request?

Server side? No, sorry. On the client-side, you can of course use the 
location object provided by Javascript. I am currently considering to 
use this approach to prepend the protocol and hostname to VFS paths in a 
list of search results.

But this should definitely be possible on the server side, too. If it is 
not possible through the request object then CmsRequestContext IMHO 
would be a good place for such a method.


Regards,
Robert



More information about the opencms-dev mailing list