You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurie Harper <la...@holoweb.net> on 2005/11/02 00:05:03 UTC

Re: How do I get the Base URL from Struts?

Brian Demers wrote:
> Hey everyone,
> 
> This is a common problem with all of the web apps I have been working
> on.  I am looking for a clean way to solve this problem.  I am using
> an API that requires the base URL: "http://something:8080/myApp/"
> 
> The problem is if I go through a proxy this will change where the
> request came from.
> 
> How do I get the base URL from a struts action?
> 
> Thanks,
> -Brian Demers

This was just discussed on this list; check the archives for more 
details. But the simple answer is, use mapping.getPath() to get the URL 
as mapped in struts-config.xml; use request.getRequestURI() or 
request.getRequestURL() to get the actual URI used.

L.


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