commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Christensen <>
Subject http-client does not retrieve final Status Code 200 after ignoring Status 100
Date Fri, 05 Apr 2002 08:34:25 GMT
I have searched the entire net and read all the mail archives I can find 
to understand http servers and their use of Status Code 100. I see how 
the http-server uses it, and how theoretically the client is supposed to 
implement it, however, I cannot get my HttpMethod to retrieve the final 
Status 200.

I found these previous posting which make mention of patches to the 
HttpClient, but I can't tell whether they are directly related to my 
problem or not, or whether they are included in the current version of 
Http-Client Commons.

I figure that I must not understand how to completely close a POST, or 
maybe I need to override the processStatusLine methods, but I have no 
idea what I would be doing in there as I haven't had success in reading 
anything different from them.

I would greatly appreciate some pointers for how to pass through the 
Status 100 code and finish retrieving the response from the POST that 
comes with the Status 200 response body that I'm looking for.

Below is the inner class I'm using for the executeMethod argument. It 
works flawlessly for GET, and even for uploading files via POST, I just 
can't get past the Status 100 code to get the response body properly 
after the file has uploaded correctly.

Thank you for any light you can shed on this.

HttpBaseMethod inner-class
      * This inner-class is used to perform method calls on the 
httpSession that is created
     private class ServerMethod extends HttpMethodBase {
         private String name = "GET"; // default is GET
         private File postFile = null;
         public ServerMethod(String path, String query) throws Exception {
         public ServerMethod(String path) throws Exception {

         public InputStream getBody() throws Exception {
             return getResponseBodyAsStream();

         public String getName() {
             return name;
         public void setName(String name) {
    = name;
         public void postFile(File filename) throws Exception {
             this.postFile = filename;

             // not sure if this header is necessary, but I'll put it in 
for good measure
             // this was part of an endless testing of headers to make it 
work the first time
             DataInputStream in = new DataInputStream(new 
             addRequestHeader(new Header("Content-Length", 


         public boolean writeRequestBody(HttpState state, HttpConnection 
httpConn) {
             try {

                 if(postFile != null && getName().equals("POST")) {
                     if(debug) {System.out.println("Uploading File...");}

                     DataOutputStream outStream = new 

                     DataInputStream in = new DataInputStream(new 

                     if(debug) {System.out.println("Available: " + 

                     while(in.available() > 0) {


                     //  httpConn.writeLine();


                 } else {
                     // by default if we're not uploading anything
                     if(debug) {System.out.println("Writing Normal 
Request Body");}
                     super.writeRequestBody(state, httpConn);

             } catch(IOException e) {
                 return false;
             } catch(HttpException e2) {
                 return false;
             return true;

          * This is used for debugging more than anything
         public void display() throws Exception {

             BufferedReader in = new BufferedReader(new 
             String temp = "";
             while((temp = in.readLine()) != null) {

         public String getDisplayString() throws Exception {
             return getResponseBodyAsString();


Ben Christensen
Novisum Development Inc.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message