client side post

The solution is :

      request.setMethod("POST");
      request.setContentType(new
MimeType("application/"+"x-www-form-urlencoded"));
      request.setOutputStream(new StringBufferInputStream(param));
      request.setContentLength(param.length());

     reply   = manager.runRequest(request);

don't use

String body = java.net.URLEncoder.encode(data.getArgString());


no need to urlencode.

This code work fine for me.

ciao

eboodle a écrit :

> I have been trying to use the jigsaw client side API for making a
> request. Whenever I do a GET it seemsto work fine but does not work
> for POST. Any suggestions would be helpful. Thanks, M
> Chandramouli Here is the code I used.  request =
> manager.createRequest();
>  request.setMethod(data.getMethod());
>  request.setURL(u);
>  request.setUserAgent("Mozilla/4.0 (compatible; MSIE 4.01; Windows
> 95)");
>  if(data.getMethod().equals("POST")){
>     System.out.println("Setting method to post");
>     try {
>
> request.setContentType(MimeType.APPLICATION_X_WWW_FORM_URLENCODED);
>     }
>     catch(Exception e)
>     {
>         System.out.println("Error in setting content type");
>         e.printStackTrace();
>     };
>
>     String body = java.net.URLEncoder.encode(data.getArgString());
>     request.setOutputStream(new StringBufferInputStream(body));
>
>  }
>
>
>   Reply reply = null;
>   try {
>       reply = manager.runRequest(request);
>   } catch (Exception e)
>   {
>        e.printStackTrace();
>   };

Received on Monday, 13 December 1999 11:47:15 UTC