org.archive.httpclient
Class HttpRecorderPostMethod

java.lang.Object
  extended by org.apache.commons.httpclient.HttpMethodBase
      extended by org.apache.commons.httpclient.methods.ExpectContinueMethod
          extended by org.apache.commons.httpclient.methods.EntityEnclosingMethod
              extended by org.apache.commons.httpclient.methods.PostMethod
                  extended by org.archive.httpclient.HttpRecorderPostMethod
All Implemented Interfaces:
org.apache.commons.httpclient.HttpMethod

public class HttpRecorderPostMethod
extends org.apache.commons.httpclient.methods.PostMethod

Override of PostMethod that marks the passed HttpRecorder w/ the transition from HTTP head to body and that forces a close on the responseConnection. This is a copy of HttpRecorderGetMethod. Only difference is the parent subclass.

Version:
$Date: 2005-04-07 21:44:47 +0000 (Thu, 07 Apr 2005) $ $Revision: 3351 $
Author:
stack

Field Summary
protected  HttpRecorderMethod httpRecorderMethod
          Instance of http recorder method.
 
Fields inherited from class org.apache.commons.httpclient.methods.PostMethod
FORM_URL_ENCODED_CONTENT_TYPE
 
Fields inherited from class org.apache.commons.httpclient.methods.EntityEnclosingMethod
CONTENT_LENGTH_AUTO, CONTENT_LENGTH_CHUNKED
 
Constructor Summary
HttpRecorderPostMethod(java.lang.String uri, HttpRecorder recorder)
           
 
Method Summary
protected  void addProxyConnectionHeader(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn)
          Generates Proxy-Connection: Keep-Alive request header when communicating via a proxy server.
 int execute(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn)
          Executes this method using the specified HttpConnection and HttpState.
protected  void readResponseBody(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection connection)
          Read the response body from the given HttpConnection.
protected  boolean shouldCloseConnection(org.apache.commons.httpclient.HttpConnection conn)
          Tests if the connection should be closed after the method has been executed.
 
Methods inherited from class org.apache.commons.httpclient.methods.PostMethod
addParameter, addParameter, addParameters, clearRequestBody, generateRequestEntity, getName, getParameter, getParameters, hasRequestContent, removeParameter, removeParameter, setParameter, setRequestBody
 
Methods inherited from class org.apache.commons.httpclient.methods.EntityEnclosingMethod
addContentLengthRequestHeader, addRequestHeaders, generateRequestBody, getFollowRedirects, getRequestCharSet, getRequestContentLength, getRequestEntity, recycle, setContentChunked, setFollowRedirects, setRequestBody, setRequestBody, setRequestContentLength, setRequestContentLength, setRequestEntity, writeRequestBody
 
Methods inherited from class org.apache.commons.httpclient.methods.ExpectContinueMethod
getUseExpectHeader, setUseExpectHeader
 
Methods inherited from class org.apache.commons.httpclient.HttpMethodBase
abort, addCookieRequestHeader, addHostRequestHeader, addRequestHeader, addRequestHeader, addResponseFooter, addUserAgentRequestHeader, checkNotUsed, checkUsed, generateRequestLine, getAuthenticationRealm, getContentCharSet, getDoAuthentication, getEffectiveVersion, getHostAuthState, getHostConfiguration, getMethodRetryHandler, getParams, getPath, getProxyAuthenticationRealm, getProxyAuthState, getQueryString, getRecoverableExceptionCount, getRequestHeader, getRequestHeaderGroup, getRequestHeaders, getRequestHeaders, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseCharSet, getResponseContentLength, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaderGroup, getResponseHeaders, getResponseHeaders, getResponseStream, getResponseTrailerHeaderGroup, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isAborted, isConnectionCloseForced, isHttp11, isRequestSent, isStrictMode, processResponseBody, processResponseHeaders, processStatusLine, readResponse, readResponseHeaders, readStatusLine, releaseConnection, removeRequestHeader, removeRequestHeader, responseBodyConsumed, setConnectionCloseForced, setDoAuthentication, setHostConfiguration, setHttp11, setMethodRetryHandler, setParams, setPath, setQueryString, setQueryString, setRequestHeader, setRequestHeader, setResponseStream, setStrictMode, setURI, validate, writeRequest, writeRequestHeaders, writeRequestLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

httpRecorderMethod

protected HttpRecorderMethod httpRecorderMethod
Instance of http recorder method.

Constructor Detail

HttpRecorderPostMethod

public HttpRecorderPostMethod(java.lang.String uri,
                              HttpRecorder recorder)
Method Detail

readResponseBody

protected void readResponseBody(org.apache.commons.httpclient.HttpState state,
                                org.apache.commons.httpclient.HttpConnection connection)
                         throws java.io.IOException,
                                org.apache.commons.httpclient.HttpException
Description copied from class: org.apache.commons.httpclient.HttpMethodBase
Read the response body from the given HttpConnection.

The current implementation wraps the socket level stream with an appropriate stream for the type of response (chunked, content-length, or auto-close). If there is no response body, the connection associated with the request will be returned to the connection manager.

Subclasses may want to override this method to to customize the processing.

Overrides:
readResponseBody in class org.apache.commons.httpclient.HttpMethodBase
Parameters:
state - the state information associated with this method
connection - the connection used to execute this HTTP method
Throws:
java.io.IOException - if an I/O (transport) error occurs. Some transport exceptions can be recovered from.
HttpException - if a protocol exception occurs. Usually protocol exceptions cannot be recovered from.
See Also:
HttpMethodBase.readResponse(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection), HttpMethodBase.processResponseBody(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection)

shouldCloseConnection

protected boolean shouldCloseConnection(org.apache.commons.httpclient.HttpConnection conn)
Description copied from class: org.apache.commons.httpclient.HttpMethodBase
Tests if the connection should be closed after the method has been executed. The connection will be left open when using HTTP/1.1 or if Connection: keep-alive header was sent.

Overrides:
shouldCloseConnection in class org.apache.commons.httpclient.HttpMethodBase
Parameters:
conn - the connection in question
Returns:
boolean true if we should close the connection.

execute

public int execute(org.apache.commons.httpclient.HttpState state,
                   org.apache.commons.httpclient.HttpConnection conn)
            throws org.apache.commons.httpclient.HttpException,
                   java.io.IOException
Description copied from class: org.apache.commons.httpclient.HttpMethodBase
Executes this method using the specified HttpConnection and HttpState.

Specified by:
execute in interface org.apache.commons.httpclient.HttpMethod
Overrides:
execute in class org.apache.commons.httpclient.HttpMethodBase
Parameters:
state - state information to associate with this request. Must be non-null.
conn - the connection to used to execute this HTTP method. Must be non-null.
Returns:
the integer status code if one was obtained, or -1
Throws:
HttpException - if a protocol exception occurs.
java.io.IOException - if an I/O (transport) error occurs

addProxyConnectionHeader

protected void addProxyConnectionHeader(org.apache.commons.httpclient.HttpState state,
                                        org.apache.commons.httpclient.HttpConnection conn)
                                 throws java.io.IOException,
                                        org.apache.commons.httpclient.HttpException
Description copied from class: org.apache.commons.httpclient.HttpMethodBase
Generates Proxy-Connection: Keep-Alive request header when communicating via a proxy server.

Overrides:
addProxyConnectionHeader in class org.apache.commons.httpclient.HttpMethodBase
Parameters:
state - the state information associated with this method
conn - the connection used to execute this HTTP method
Throws:
java.io.IOException - if an I/O (transport) error occurs. Some transport exceptions can be recovered from.
HttpException - if a protocol exception occurs. Usually protocol exceptions cannot be recovered from.


Copyright © 2003-2011 Internet Archive. All Rights Reserved.