You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Otmar Manuela <ot...@caribmedia.com> on 2006/09/19 17:47:13 UTC
problems with request.getRequestURL() after migrating to Tomcat 5.5
Hi,
I know this was asked a while ago in this mailing list, but I couldn't
find the answer. My problem is that I want a generic way to get the
client URL in my action class. In Tomcat 5.0, I was able to do so by
calling request.getRequestURL(), but apparently I was just lucky,
because it wasn't supposed to work this way and now that they have fixed
it in Tomcat 5.5, my application breaks. I see some people solved this
by using mapping.getPath(), but this doesn't work well with tiles,
because it returns the action url of the tile and not the url of the
client request.
So far I know how to get the scheme, host, context path, and query
string, but I'm missing the path, which mapping.getPath() provides if
you're not using tiles.
Anyone knows how to get this to work without having to use
request.getRequestURL()?
Thanks,
--
Otmar Manuela
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: problems with request.getRequestURL() after migrating to Tomcat 5.5
Posted by Chris Pratt <th...@gmail.com>.
In Resin (and I think the spec), request.getRequestURL() should give you
back the URL (minus the query arguments) that was used. You can build the
query String using request.getParameterNames() & getParameterValues() and
rebuild it yourself, but since HttpUtils.getRequestURL has been deprecated,
I think that's the only choice.
(*Chris*)
On 9/19/06, Otmar Manuela <ot...@caribmedia.com> wrote:
>
> Hi,
>
> I know this was asked a while ago in this mailing list, but I couldn't
> find the answer. My problem is that I want a generic way to get the
> client URL in my action class. In Tomcat 5.0, I was able to do so by
> calling request.getRequestURL(), but apparently I was just lucky,
> because it wasn't supposed to work this way and now that they have fixed
> it in Tomcat 5.5, my application breaks. I see some people solved this
> by using mapping.getPath(), but this doesn't work well with tiles,
> because it returns the action url of the tile and not the url of the
> client request.
>
> So far I know how to get the scheme, host, context path, and query
> string, but I'm missing the path, which mapping.getPath() provides if
> you're not using tiles.
>
> Anyone knows how to get this to work without having to use
> request.getRequestURL()?
>
> Thanks,
>
> --
> Otmar Manuela
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>