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

Andras Balogh andras at reea.net
Mon Apr 24 11:00:37 CEST 2006


Joe Desbonnet wrote:

>I'm experimenting incorporating GoogleMaps into an OpenCms project. 
>However GoogleMaps requires you to obtain a key which is tied to a
>particular URL.
>
>When developing an OpenCms project, the URL for a page will be
>different when in the workplace and live site.  If I could detect the
>URL in the browser location bar within OpenCms then I could switch in
>the correct key depending on context.
>
>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.
>  
>
What about request.getPathInfo() ??

http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequest.html#getPathInfo()

You can use the getContextPath()+getServletPath()+getPathInfo()  to 
build up the URI.


>Does anyone know a reliable way of figuring out what URL is in the
>browser location bar for a request?
>
>Joe.
>
>_______________________________________________
>This mail is sent to you from the opencms-dev mailing list
>To change your list options, or to unsubscribe from the list, please visit
>http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>  
>
Best regards,
Andras.



More information about the opencms-dev mailing list