You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Kalnichevski, Oleg" <ol...@bearingpoint.com> on 2003/04/09 16:49:57 UTC

RE: PostMethod response.

François,

There are three possible approaches:

- Update to a recent nightly build

http://jakarta.apache.org/commons/httpclient/downloads.html

- Use HTTP/1.0
  
  post.setHttp11(false);

- Disable 'expect: 100-continue' handshake

  post.setUseExpectHeader(false);

I hope this helps

Oleg


-----Original Message-----
From: francois.geraerts@b-rail.be [mailto:francois.geraerts@b-rail.be]
Sent: Wednesday, April 09, 2003 17:27
To: commons-httpclient-dev@jakarta.apache.org
Subject: PostMethod response.


Hi!

I am sending a File to an https server.
With the version alpha2, and use of the PostMethod, i've got a good response
from the server.
With the version aplha3, i have always a code 100 Continue.

Here is my code:


  HttpClient session  ........

  .......

    PostMethod post = new PostMethod(hpp.getUrl());
    post.addRequestHeader("Content-Type", hpp.getContentType());
    post.setHttp11(true);



     String strReq = new String(request);
     post.setRequestBody(strReq); ///Setting of the byte to send
     post.setRequestContentLength(strReq.length());


      session.executeMethod(post);


    BufferedReader postReader = null;


    try
    {
      postReader = new BufferedReader(new InputStreamReader(post.
getResponseBodyAsStream()));
    }
    catch (IOException ex1)
    {
      throw new HttpsBrokerException(4,"sendFile","Error on the response body:
" + ex1.getMessage());
    }
    catch (NullPointerException ex)
    {
      postReader = null;
    }

    serverResponse = new HttpServerResponse(post.getStatusLine(),postReader);


    Is someone know the change done between the two version and why now it
doesn't work.

    Thanks in advance.

    François


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


Re(2): PostMethod response.

Posted by fr...@b-rail.be.
Thanks Oleg,
It's work fine now. I have downloaded the last nightly build.

Ciao.


François

Kalnichevski, Oleg  (9/04/03  15:49):
>François,
>
>There are three possible approaches:
>
>- Update to a recent nightly build
>
>http://jakarta.apache.org/commons/httpclient/downloads.html
>
>- Use HTTP/1.0
>
>  post.setHttp11(false);
>
>- Disable 'expect: 100-continue' handshake
>
>  post.setUseExpectHeader(false);
>
>I hope this helps
>
>Oleg
>
>
>-----Original Message-----
>From: francois.geraerts@b-rail.be [mailto:francois.geraerts@b-rail.be]
>Sent: Wednesday, April 09, 2003 17:27
>To: commons-httpclient-dev@jakarta.apache.org
>Subject: PostMethod response.
>
>
>Hi!
>
>I am sending a File to an https server.
>With the version alpha2, and use of the PostMethod, i've got a good response
>from the server.
>With the version aplha3, i have always a code 100 Continue.
>
>Here is my code:
>
>
>  HttpClient session  ........
>
>  .......
>
>    PostMethod post = new PostMethod(hpp.getUrl());
>    post.addRequestHeader("Content-Type", hpp.getContentType());
>    post.setHttp11(true);
>
>
>
>     String strReq = new String(request);
>     post.setRequestBody(strReq); ///Setting of the byte to send
>     post.setRequestContentLength(strReq.length());
>
>
>      session.executeMethod(post);
>
>
>    BufferedReader postReader = null;
>
>
>    try
>    {
>      postReader = new BufferedReader(new InputStreamReader(post.
>getResponseBodyAsStream()));
>    }
>    catch (IOException ex1)
>    {
>      throw new HttpsBrokerException(4,"sendFile","Error on the response body:
>" + ex1.getMessage());
>    }
>    catch (NullPointerException ex)
>    {
>      postReader = null;
>    }
>
>    serverResponse = new HttpServerResponse(post.getStatusLine(),postReader);
>
>
>    Is someone know the change done between the two version and why now it
>doesn't work.
>
>    Thanks in advance.
>
>    François
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>