You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Mast <jh...@gmail.com> on 2008/07/16 18:13:30 UTC
Wholesale HTTP parameter redirection
I have a page which now receives quite a few parameters, eg.
page.jsp?abc=foo&xyz=bar ...
This page redirects via response.sendRedirect(). I want to know how I can
forward every parameter onto the redirect page, without having to extract
each one individually and rebuilding them in the url I place into
sendRedirect().
Thanks
RE: Wholesale HTTP parameter redirection
Posted by Peter Crowther <Pe...@melandra.com>.
> From: Jonathan Mast [mailto:jhmast.developer@gmail.com]
> I have a page which now receives quite a few parameters, eg.
> page.jsp?abc=foo&xyz=bar ...
>
> This page redirects via response.sendRedirect(). I want to
> know how I can
> forward every parameter onto the redirect page, without
> having to extract
> each one individually and rebuilding them in the url I place into
> sendRedirect().
I've tended to use a swift bit of string manipulation - look for the ? in the original URL, and append everything to the right of that. Ugly, but it works.
- Peter
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Wholesale HTTP parameter redirection
Posted by Hassan Schroeder <ha...@gmail.com>.
On Wed, Jul 16, 2008 at 10:55 AM, Jonathan Mast
<jh...@gmail.com> wrote:
> I thought a forward would require the same type of individual parameter
> extraction and rebuilding.
>
> Please let me know how to do this in bulk.
Not sure what you mean by "in bulk"; here's a simple example:
String target = "/someOtherUrl";
RequestDispatcher rd = getServletContext().getRequestDispatcher(target);
rd.forward(request, response);
You'll find that the parameters of the orignal request all show up at
the destination. :-)
If you have lots of mappings, a properties file or DB table would allow
something like
MyTrafficManager.getDestination(target);
HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Wholesale HTTP parameter redirection
Posted by Jonathan Mast <jh...@gmail.com>.
I thought a forward would require the same type of individual parameter
extraction and rebuilding.
Please let me know how to do this in bulk.
Thanks.
On Wed, Jul 16, 2008 at 12:27 PM, Hassan Schroeder <
hassan.schroeder@gmail.com> wrote:
> On Wed, Jul 16, 2008 at 9:13 AM, Jonathan Mast
> <jh...@gmail.com> wrote:
>
> > This page redirects via response.sendRedirect(). I want to know how I
> can
> > forward every parameter onto the redirect page, without having to extract
> > each one individually and rebuilding them in the url I place into
> > sendRedirect().
>
> Is there a reason it /has/ to be a redirect, rather than a forward?
>
> If not, you'd bypass the whole issue...
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Wholesale HTTP parameter redirection
Posted by Hassan Schroeder <ha...@gmail.com>.
On Wed, Jul 16, 2008 at 9:13 AM, Jonathan Mast
<jh...@gmail.com> wrote:
> This page redirects via response.sendRedirect(). I want to know how I can
> forward every parameter onto the redirect page, without having to extract
> each one individually and rebuilding them in the url I place into
> sendRedirect().
Is there a reason it /has/ to be a redirect, rather than a forward?
If not, you'd bypass the whole issue...
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org