hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sANTo <santo.pr...@gmail.com>
Subject Re: Invalid stream header
Date Mon, 03 Jul 2006 08:55:52 GMT
Hey Roland,


> > PostMethod and PutMethod are available in v2.0 but I cannot find any
> other
> > way than setRequestBody
> > to post data to the server, meaning I have to use a NameValuePair array,
>
> you can set the request body as an InputStream at least:
>
> http://jakarta.apache.org/commons/httpclient/2.0/apidocs/org/apache/commons/httpclient/methods/EntityEnclosingMethod.html#setRequestBody(java.io.InputStream)



Apparently I already tried that (tried already so much variations that I
can't remember them all ;-)) and it didn't work.
For some reason, the post didn't even seem to reach the server side at all.
Therefore I decided to further investigate this and found out that the
problem was on the server side.
As already mentioned in one of my previous posts, I'm using Jetty on the
server side.
Seems that I was missing the following call in order to make post requests
come through:

    context.setRedirectNullPath(false);

(or adding a trailing slash to the file part of the url should do the trick
as well)
As soon as I added the code above, the post came through and then it was
really simple to get the Hashtable sent to the server
by setting the response body using an inputstream.



> > Probably the best thing I can do is upgrade to 3.0, but before I do that
> I
> > want to know if it's backwards compatible with 2.0
>
> probably best: yes. backwards compatible: not fully.
>
> > or will it be very likely I have to modify large parts of my code ?
>
> It is very likely you'll have to modify minor parts of your code.


I didn't have to modify that much code to get 3.0 working.
However several classes and methods I'm using are deprecated in 3.0.
So a more in depth review of the code will be necessary in the near future.
Nevertheless I got it working for now.

Thanks again for the quick responses.

Santo

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message