[opencms-dev] how to access url displayed in browser's address bar

Andras Balogh andras at reea.net
Tue Sep 5 12:23:41 CEST 2006


Hello,

    Come-on,  You can do better than that ! :)
There are lot of methods in HttpServletRequest  and in ServletRequest to 
build the full URL:
http://java.sun.com/products/servlet/2.1/api/javax.servlet.ServletRequest.html
getScheme() ->http
getServerName() ->  mywebsite.org

getPathInfo ()-> /path/to/file.html

Other methods to check:
getQueryString()
getContextPath()
getServletPath()

Best wishes,
Andras


Arian Abrahantes Quintana wrote:
> hi andras,
>  
> sort of that but getPathInfo or other Methods within HttpServletRequest is not returning the full url -seems to be a URI-, instead of:
>  
> http://mywebsite.org/path/to/file.html
>  
> returns,
>  
> /path/to/file.html
>  
> Let me see if I make myself clear.
>  
> I'd like to code in opencms or java something to work like this: http://www.js-examples.com/page/javascripts__example.html?view=495 <http://www.js-examples.com/page/javascripts__example.html?view=495> 
>  
> as you see the javascript goes directly to the bowser address bar.
>  
> thank you for your help I'll keep looking,
>  
> arian
>
>   




More information about the opencms-dev mailing list