hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Status code of 100 on client.executeMethod();
Date Thu, 05 Jun 2003 20:50:32 GMT
100 status code is supposed to be used internally by HTTP agents when
engaging in so-called 'expect: 100-continue' handshake. The target HTTP
server responds with status code 100 to tell the client that it is ok to
send the request body. The purpose of 'expect: 100-continue' handshake
is to avoid sending request body (that can be fairly large) if some of
the headers do not satisfy the target HTTP server, for instance,
authentication credentials are not valid.

The 1xx range of status codes are for internal use only and should never
be returned to the user. This is definitely a bug in earlier versions of
HttpClient. 

There seems to be nothing wrong with your code. Just upgrade to 2.0beta1
Cheers

Oleg

On Thu, 2003-06-05 at 22:12, asharm3@sears.com wrote:
> Can anyone please let me know what does status code of 100 mean as a return
> from client.executeMethod(post).
> The result returns 100 and the subsequent code is not executed. I am not
> able to retrieve the response as Stream.
> 
> Would appreciate if anyone can look at the code below to see if I have
> missed anything that ought to be in the code.
> This code is running under tomcat and is the alpha release before Release 2
> beta 1.
> 
>           StringBuffer responseBody = new StringBuffer("");
> 
>           PostMethod method = null;
>             String translatedString = "";
> 
>                   // Create the new HttpClient object
>                   client = new HttpClient();
> 
>               //establish a connection within x seconds
>               client.setConnectionTimeout(connectionTimeout);
> 
>               // Time it takes to receive the data after the connection is
> established.
>               client.setTimeout(timeout);
> 
>               //create a method object
>               method = new PostMethod(sTheURL);
> 
>                   // Set the request body with the xml request
>                   method.setRequestBody(sXML);
> 
>                   // Set the request headers
>               method.setRequestHeader("Content-Type", " text/xml");
>                   method.setRequestHeader("Content-Length",
> translatedString.length() + "");
> 
>               int result = client.executeMethod(method);
> 
>               InputStream is = method.getResponseBodyAsStream();
> 
>               BufferedReader br = new BufferedReader(new
> InputStreamReader(is));
> 
>               String line = null;
>                 while ((line = br.readLine()) != null)
>                 {
>                    responseBody.append(line);
>                 }
> 
>               br.close();
> 
>               //clean up the connection resources
>               method.releaseConnection();
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
> 


Mime
View raw message