hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalnichevski, Oleg" <oleg.kalnichev...@bearingpoint.com>
Subject RE: MultipartPostMethod for serialized objects ?
Date Wed, 19 Mar 2003 08:23:34 GMT

I believe there's a solution to your problem. The body of a serialized object can be posted
with PostMethod#setRequestBody(InputStream). Session id and additional bits of information
can be set as query parameters using PostMethod#setQueryString(NameValuePair[]) within the
same request.  

When the servlet receives the request, you can examine query parameters first and then decide
what to do with the request body

I hope this help


-----Original Message-----
From: Sebastien Alonzo [mailto:SALONZO@fr.ibm.com]
Sent: Dienstag, 18. März 2003 19:46
To: Jandalf
Cc: commons-httpclient-dev@jakarta.apache.org
Subject: Re: MultipartPostMethod for serialized objects ?


Thank you for your quick answer.

Actually it does not seem so simple to me since what i really need to send
to my servlet (besides some basic parameters) is a serialized java object.
Your name/value pairs seem to be fit for Strings, what about more complex
objects ?

I know of a solution using java.net.URLConnection but it's not really
compatible with parameters since when you read the parameters from the
HttpServletRequest in the servlet, you cannot open an ObjectInputStream
anymore form the request.

If you have any clue please keep me posted.

Cordialement / Best regards
Sébastien Alonzo
IBM Global Services - BCS Industry - Paris
GSM : 06 82 58 20 75 - Tel : 01 49 05 82 33 (Int. 33 82 33)

                      <jsdever@apache.o        To:       Sebastien Alonzo/France/IBM@IBMFR
                      rg>                      cc:                                    
                                               Subject:  Re: MultipartPostMethod for serialized
objects ?                              
                      03/18/2003 06:55                                                   

Hello Sébastien,

You can simply add a few name value pairs to the request line as the query
string. Then retrieve these in your servlet.

See the API documentation for setQueryString in HttpMethod:

In the future please post questions directly to the HttpClient mailing


Sebastien Alonzo wrote:

>We're trying to evaluate HttpClient to see if can suit our purpose.
>We need to send a serialized java object to an HttpServlet using Http
>We would like to add some parameters and a session-id that the servlet
>could read before deserializing the object.
>Is it possible to do it with HttpClient ? If so, what is the best way to
>it ?
>Any help would be greatly appreciated.
>Cordialement / Best regards
>Sébastien Alonzo
>IBM Global Services - BCS Industry - Paris
>GSM : 06 82 58 20 75 - Tel : 01 49 05 82 33 (Int. 33 82 33)

To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org

View raw message