hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bindul Bhowmik" <bindulbhow...@gmail.com>
Subject Re: new to HttpClient, how to get serialized objected using HttpClient
Date Wed, 26 Apr 2006 04:41:03 GMT
Hello Ashish,

> How do i get this seralized object data using HttpClient, i need to get this
> Object passed from the servlet,
> My Code is as below
> HttpClient client = new HttpClient();
>         PostMethod postMethod = new PostMethod(url);
>
>          NameValuePair[] data = {
>                     new NameValuePair("as400Name", as400Name),
>                     new NameValuePair("envName", envName),
>                     new NameValuePair("fileName", fileName)
>                   };
>
>          postMethod.setRequestBody(data);
>
>          postMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
>
>                 new DefaultHttpMethodRetryHandler(3, false));
> int statusCode = client.executeMethod(postMethod);
>
>               if (statusCode != HttpStatus.SC_OK) {
>                 System.err.println("Method failed: " +
> postMethod.getStatusLine());
>               }
>
>               // Read the response body.
>               byte[] responseBody = postMethod.getResponseBody();
>
>

I presume you are using HttpClient in your applet?

In that case did you try using ObjectInputStream here?

ObjectInputStream ois = new
ObjectInputStream(postMethod.getResponseBodyAsStream());

Regards,
Bindul

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


Mime
View raw message