org.apache.commons.httpclient.methods
Class ExpectContinueMethod

java.lang.Object
  extended by org.apache.commons.httpclient.HttpMethodBase
      extended by org.apache.commons.httpclient.methods.ExpectContinueMethod
All Implemented Interfaces:
HttpMethod
Direct Known Subclasses:
EntityEnclosingMethod

public abstract class ExpectContinueMethod
extends HttpMethodBase

This abstract class serves as a foundation for all HTTP methods that support 'Expect: 100-continue' handshake.

The purpose of the 100 (Continue) status (refer to section 10.1.1 of the RFC 2616 for more details) is to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body. In some cases, it might either be inappropriate or highly inefficient for the client to send the body if the server will reject the message without looking at the body.

'Expect: 100-continue' handshake should be used with caution, as it may cause problems with HTTP servers and proxies that do not support HTTP/1.1 protocol.

Since:
2.0beta1
Author:
Oleg Kalnichevski

Constructor Summary
ExpectContinueMethod()
          No-arg constructor.
ExpectContinueMethod(String uri)
          Constructor specifying a URI.
 
Method Summary
protected  void addRequestHeaders(HttpState state, HttpConnection conn)
          Sets the Expect header if it has not already been set, in addition to the "standard" set of headers.
protected abstract  boolean hasRequestContent()
          Returns true if there is a request body to be sent.
 
Methods inherited from class org.apache.commons.httpclient.HttpMethodBase
abort, addCookieRequestHeader, addHostRequestHeader, addProxyConnectionHeader, addRequestHeader, addRequestHeader, addRequestHeader, addResponseFooter, addUserAgentRequestHeader, checkNotUsed, checkUsed, execute, generateRequestLine, getContentCharSet, getDoAuthentication, getEffectiveVersion, getFollowRedirects, getHostAuthState, getName, getParams, getPath, getProxyAuthState, getQueryString, getRequestCharSet, getRequestHeader, getRequestHeaderGroup, getRequestHeaders, getRequestHeaders, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseCharSet, getResponseContentLength, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaderGroup, getResponseHeaders, getResponseHeaders, getResponseStream, getResponseTrailerHeaderGroup, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isAborted, isConnectionCloseForced, isRequestSent, processResponseBody, processResponseHeaders, processStatusLine, readResponse, readResponseBody, readResponseHeaders, readStatusLine, releaseConnection, removeRequestHeader, removeRequestHeader, responseBodyConsumed, setConnectionCloseForced, setDoAuthentication, setFilters, setFollowRedirects, setLogWire, setParams, setPath, setQueryString, setQueryString, setRequestHeader, setRequestHeader, setResponseStream, setURI, shouldCloseConnection, validate, writeRequest, writeRequestBody, writeRequestHeaders, writeRequestLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpectContinueMethod

public ExpectContinueMethod()
No-arg constructor.

Since:
2.0

ExpectContinueMethod

public ExpectContinueMethod(String uri)
Constructor specifying a URI.

Parameters:
uri - either an absolute or relative URI
Since:
2.0
Method Detail

hasRequestContent

protected abstract boolean hasRequestContent()
Returns true if there is a request body to be sent. 'Expect: 100-continue' handshake may not be used if request body is not present

Returns:
boolean
Since:
2.0beta1

addRequestHeaders

protected void addRequestHeaders(HttpState state,
                                 HttpConnection conn)
                          throws HttpException,
                                 IOException
Sets the Expect header if it has not already been set, in addition to the "standard" set of headers.

Overrides:
addRequestHeaders in class HttpMethodBase
Parameters:
state - the state information associated with this method
conn - the connection used to execute this HTTP method
Throws:
IOException
HttpException
See Also:
HttpMethodBase.writeRequestHeaders(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection)


Copyright (c) 1999-2005 - Apache Software Foundation