com.caucho.quercus.lib.curl
Class CurlHttpRequest

java.lang.Object
  extended by com.caucho.quercus.lib.curl.CurlHttpRequest
All Implemented Interfaces:
EnvCleanup
Direct Known Subclasses:
HttpGetRequest, HttpPostRequest, HttpPutRequest

public class CurlHttpRequest
extends java.lang.Object
implements EnvCleanup

Represents a generic Http request.


Constructor Summary
CurlHttpRequest(CurlResource curlResource)
           
 
Method Summary
 void cleanup()
          Cleanup resources associated with this connection.
protected  void connect(Env env)
          Attempt to connect to the server.
protected  void create(Env env)
          Opens the connection.
protected  void error(Env env, int code, java.lang.String error)
           
protected  void error(Env env, int code, java.lang.String error, java.lang.Throwable e)
           
 boolean execute(Env env)
          Perform this request.
protected  boolean finish(Env env)
          Closes the connection and sends data and connection info to curl.
protected  CurlResource getCurlResource()
           
protected  CurlHttpConnection getHttpConnection()
           
static CurlHttpRequest getRequest(CurlResource curl)
          Returns a HttpRequest specific to the Http request method.
protected  java.net.URL getURL(Env env, java.lang.String urlString, int port)
          Returns a valid URL or null on error.
protected  boolean init(Env env)
          Initializes the connection.
protected  void transfer(Env env)
          Transfer data to the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurlHttpRequest

public CurlHttpRequest(CurlResource curlResource)
Method Detail

getRequest

public static final CurlHttpRequest getRequest(CurlResource curl)
Returns a HttpRequest specific to the Http request method.


create

protected final void create(Env env)
                     throws java.net.MalformedURLException,
                            java.io.IOException
Opens the connection.

Throws:
java.net.MalformedURLException
java.io.IOException

init

protected boolean init(Env env)
                throws java.net.ProtocolException
Initializes the connection.

Throws:
java.net.ProtocolException

connect

protected void connect(Env env)
                throws java.net.ConnectException,
                       java.net.SocketTimeoutException,
                       java.net.UnknownHostException,
                       java.io.IOException
Attempt to connect to the server.

Throws:
java.net.ConnectException
java.net.SocketTimeoutException
java.net.UnknownHostException
java.io.IOException

transfer

protected void transfer(Env env)
                 throws java.io.IOException
Transfer data to the server.

Throws:
java.io.IOException

finish

protected boolean finish(Env env)
                  throws java.io.IOException
Closes the connection and sends data and connection info to curl.

Throws:
java.io.IOException

execute

public final boolean execute(Env env)
Perform this request.


getCurlResource

protected final CurlResource getCurlResource()

getHttpConnection

protected final CurlHttpConnection getHttpConnection()

error

protected final void error(Env env,
                           int code,
                           java.lang.String error)

error

protected final void error(Env env,
                           int code,
                           java.lang.String error,
                           java.lang.Throwable e)

getURL

protected final java.net.URL getURL(Env env,
                                    java.lang.String urlString,
                                    int port)
                             throws java.net.MalformedURLException
Returns a valid URL or null on error.

Throws:
java.net.MalformedURLException

cleanup

public void cleanup()
Cleanup resources associated with this connection.

Specified by:
cleanup in interface EnvCleanup