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.4 $ $Date: 2002/08/05 12:26:24 $
Author:
Ortwin Glück, dIon Gillard

Field Summary
static java.lang.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.
 java.lang.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, getFollowRedirects, getPath, getQueryString, getRequestContentLength, getRequestHeader, getRequestHeaders, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaders, getStatusCode, getStatusText, hasBeenUsed, isHttp11, isStrictMode, processResponseBody, processResponseHeaders, processStatusLine, readResponse, readResponseBody, readResponseHeaders, readStatusLine, recycle, removeRequestHeader, setFollowRedirects, setHttp11, setPath, setQueryString, setQueryString, setRequestHeader, setRequestHeader, setResponseStream, setStrictMode, 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 java.lang.String NAME
the name of this method
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 java.lang.String getName()
Provide the name of this method.
Overrides:
getName in class HttpMethodBase
Returns:
the String "CONNECT"

execute

public int execute(HttpState state,
                   HttpConnection conn)
            throws java.io.IOException,
                   HttpException
Execute this method by tunnelling and then executing the wrapped method.
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
java.io.IOException - when an error occurs writing the headers

writeRequestHeaders

protected void writeRequestHeaders(HttpState state,
                                   HttpConnection conn)
                            throws HttpException,
                                   java.io.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
java.io.IOException - when an error occurs writing the headers

writeRequestLine

protected void writeRequestLine(HttpState state,
                                HttpConnection conn)
                         throws java.io.IOException,
                                HttpException
Special Connect request.
Overrides:
writeRequestLine in class HttpMethodBase
Parameters:
state - the current http state
conn - the connection to write to
Throws:
java.io.IOException - when an error occurs writing the request
HttpException - when an error occurs writing the request


Copyright (c) 2001 - Apache Software Foundation