org.apache.commons.httpclient
Class ConnectMethod

java.lang.Object
  |
  +--org.apache.commons.httpclient.HttpMethodBase
        |
        +--org.apache.commons.httpclient.ConnectMethod
All Implemented Interfaces:
HttpMethod

public class ConnectMethod
extends HttpMethodBase

Wraps another method to tunnel through a proxy.

Since:
2.0
Version:
$Revision: 1.7 $ $Date: 2003/01/28 04:40:20 $
Author:
Ortwin Gl?ck, dIon Gillard, Mike Bowler

Field Summary
static String NAME
          the name of this method
 
Fields inherited from class org.apache.commons.httpclient.HttpMethodBase
USER_AGENT
 
Constructor Summary
ConnectMethod(HttpMethod method)
          Create a connect method wrapping the existing method
 
Method Summary
 int execute(HttpState state, HttpConnection conn)
          Execute this method by tunnelling and then executing the wrapped method.
 String getName()
          Provide the name of this method.
protected  void writeRequestHeaders(HttpState state, HttpConnection conn)
          Writes a minimal set of headers to the proxy.
protected  void writeRequestLine(HttpState state, HttpConnection conn)
          Special Connect request.
 
Methods inherited from class org.apache.commons.httpclient.HttpMethodBase
addAuthorizationRequestHeader, addContentLengthRequestHeader, addCookieRequestHeader, addHostRequestHeader, addProxyAuthorizationRequestHeader, addRequestHeader, addRequestHeader, addRequestHeaders, addResponseFooter, addUserAgentRequestHeader, checkNotUsed, checkUsed, generateRequestLine, getContentCharSet, getDoAuthentication, getFollowRedirects, getHostConfiguration, getPath, getQueryString, getRecoverableExceptionCount, getRequestCharSet, getRequestContentLength, getRequestHeader, getRequestHeaderGroup, getRequestHeaders, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseCharSet, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaderGroup, getResponseHeaders, getResponseTrailerHeaderGroup, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isHttp11, isStrictMode, processResponseBody, processResponseHeaders, processStatusLine, readResponse, readResponseBody, readResponseHeaders, readStatusLine, recycle, releaseConnection, removeRequestHeader, responseBodyConsumed, setDoAuthentication, setFollowRedirects, setHostConfiguration, setHttp11, setPath, setQueryString, setQueryString, setRequestHeader, setRequestHeader, setResponseStream, setStrictMode, shouldCloseConnection, validate, writeRequest, writeRequestBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
the name of this method

See Also:
Constant Field Values
Constructor Detail

ConnectMethod

public ConnectMethod(HttpMethod method)
Create a connect method wrapping the existing method

Parameters:
method - the method to execute after connecting to the server
Method Detail

getName

public String getName()
Provide the name of this method.

Specified by:
getName in interface HttpMethod
Specified by:
getName in class HttpMethodBase
Returns:
the String "CONNECT"

execute

public int execute(HttpState state,
                   HttpConnection conn)
            throws IOException,
                   HttpException
Execute this method by tunnelling and then executing the wrapped method.

Specified by:
execute in interface HttpMethod
Overrides:
execute in class HttpMethodBase
Parameters:
state - the current http state
conn - the connection to write to
Returns:
the http status code from execution
Throws:
HttpException - when an error occurs writing the headers
IOException - when an error occurs writing the headers

writeRequestHeaders

protected void writeRequestHeaders(HttpState state,
                                   HttpConnection conn)
                            throws HttpException,
                                   IOException
Writes a minimal set of headers to the proxy.

Overrides:
writeRequestHeaders in class HttpMethodBase
Parameters:
state - the current http state
conn - the connection to write to
Throws:
HttpException - when an error occurs writing the headers
IOException - when an error occurs writing the headers
See Also:
HttpMethodBase.addRequestHeaders(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection), HttpMethodBase.getRequestHeaders()

writeRequestLine

protected void writeRequestLine(HttpState state,
                                HttpConnection conn)
                         throws IOException,
                                HttpException
Special Connect request.

Overrides:
writeRequestLine in class HttpMethodBase
Parameters:
state - the current http state
conn - the connection to write to
Throws:
IOException - when an error occurs writing the request
HttpException - when an error occurs writing the request
See Also:
HttpMethodBase.generateRequestLine(org.apache.commons.httpclient.HttpConnection, java.lang.String, java.lang.String, java.lang.String, java.lang.String)


Copyright (c) 1999-2002 - Apache Software Foundation