Hi Craig,
Yes, I thought as much.
Do you know if it's possible to exactly recreate the binary HTTP body from parsed
parameters, or elsewhere for that matter?
I'm writing a web proxy using HttpClient - currently I've only tested a urlencoded
form, which works fine with the following code. I wonder how it will fair when it
encounters a mutipart form - I haven't tested yet.
HttpClient client = new HttpClient();
...
if (request.getMethod().toLowerCase().equals("post"))
{
HttpMethod method = new PostMethod(url.toString());
PostMethod postMethod = (PostMethod)method;
// populate form parameters
Enumeration paramEnum = request.getParameterNames();
while (paramEnum.hasMoreElements()) {
String key = ((String) paramEnum.nextElement());
String[] values = request.getParameterValues(key);
String value = "";
for(int i=0; i<values.length; i++)
value += values[i] + (i < values.length-1 ? "," : "");
postMethod.addParameter(key, value);
}
}
Sorry for the HTML email - outlook web access :)
Rob
-----Original Message-----
From: Craig McClanahan [mailto:[EMAIL PROTECTED]
Sent: Thu 15/07/2004 17:50
To: Struts Users Mailing List
Cc:
Subject: Re: calling request.getInputStream() within Action
Robert Shields wrote:
>Hi Bill
>
>Thanks for your response.
>I've tried with a servlet too, but even without calling
>request.getParameter the stream is still empty:
>
>
>
One way to paint yourself into this particular corner is if you're
trying this on a POST request. As soon as you call a method like
request.getParameter(), the container has to read the content of the
input stream (since that is where the key/value pairs are), so trying to
read the stream after that is not going to work.
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
_____________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
_____________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]