Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Servlet Interest »

Re: redirecting from a servlet to an exterior URL using a POST

Paul Copeland

2005-06-22

Replies:

Probably RequestDispacther.forward won't do what you want unless the
external URL is in the same ServletContext or at least on the same server.

If you have control of the other end you might forward with a
java.net.HttpURLConnection and just write into the OutputStream on one
end and read on the other end with ServletRequest.getReader(). Or even
sending a serialized object...

If you really want to do a POST take a look at Jakarta HttpClient for a
start.

http://jakarta.apache.org/commons/httpclient/3.0/index.html

Paul Copeland
JOT Servlets Web Component Framework
http://www.jotobjects.com

>------------------------------
>
>Date:   Wed, 22 Jun 2005 10:19:28 +0800
>From:   Sreenath <sreenathn@(protected)>
>Subject: Re: redirecting from a servlet to an exterior URL using a POST
>
>Hi Gary
>
> As long as u use requestDispacther.forward("")(Instead of redirect) ,
>the URL won't be visible .rather ur servlet URL will be visible in the
>address bar . So as long as URL is not visible GET and POST shouldn $B!G (Bt
>make any difference until unless u r sending some multi-form data
>
>
>
>-----Original Message-----
>From: A mailing list for discussion about Sun Microsystem's Java Servlet
>API Technology. [mailto:SERVLET-INTEREST@(protected)
>Garey Mills
>Sent: 2005 $BG/ (B6 $B7n (B22 $BF| (B 0:21
>To: SERVLET-INTEREST@(protected)
>Subject: redirecting from a servlet to an exterior URL using a POST
>
>Hello -
>
>     Once a servlet I am writing is accessed, I want to set the
>values
>on several parameters and then redirect to an exterior URL, sending
>along
>the parameters. But I do not want the parameters exposed, so putting
>them
>into the URL as a query string won't work, I need a POST.
>
>     Has anybody done this?
>
>Garey Mills
>Library Systems Office
>UC Berkeley
>
>
>
>

___________________________________________________________________________
To unsubscribe, send email to listserv@(protected)
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
©2008 junlu.com - Jax Systems, LLC, U.S.A.