W3C home > Mailing lists > Public > www-jigsaw@w3.org > November to December 1999

Client side API Post

From: eboodle <cmouli@eboodle.com>
Date: Fri, 10 Dec 1999 12:24:12 -0800
Message-ID: <009d01bf434c$85c79bd0$1701010a@eboodle.com>
To: <www-jigsaw@w3.org>
I have been trying to use the jigsaw client side API for making a request. Whenever I do a GET it seems
to 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 Friday, 10 December 1999 15:20:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:34 GMT