com.caucho.quercus.lib.curl
Class CurlHttpConnection

java.lang.Object
  extended by com.caucho.quercus.lib.curl.CurlHttpConnection
Direct Known Subclasses:
HttpsConnection

public class CurlHttpConnection
extends java.lang.Object

Represents a HttpURLConnection wrapper.


Constructor Summary
protected CurlHttpConnection(java.net.URL url, java.lang.String username, java.lang.String password)
           
  CurlHttpConnection(java.net.URL url, java.lang.String username, java.lang.String password, java.net.URL proxyURL, java.lang.String proxyUsername, java.lang.String proxyPassword, java.lang.String proxyType)
           
 
Method Summary
 void authenticate()
          Handles the authentication for this connection.
 void authenticateImpl()
          Handles the authentication for this connection.
 void close()
           
 void connect(CurlResource curl)
          Connects to the server.
static CurlHttpConnection createConnection(java.net.URL url, java.lang.String username, java.lang.String password, CurlResource curl)
           
static CurlHttpConnection createConnection(java.net.URL url, java.lang.String username, java.lang.String password, CurlResource curl, java.net.URL proxyURL, java.lang.String proxyUsername, java.lang.String proxyPassword, java.lang.String proxyType)
           
 void disconnect()
           
protected  java.net.HttpURLConnection getConnection()
           
 int getContentLength()
           
 java.io.InputStream getErrorStream()
           
 java.lang.String getHeaderField(int i)
           
 java.lang.String getHeaderField(java.lang.String key)
           
 java.lang.String getHeaderFieldKey(int i)
           
 java.io.InputStream getInputStream()
           
 java.io.OutputStream getOutputStream()
           
protected  java.net.Proxy getProxy()
           
 int getResponseCode()
           
protected  java.net.URL getURL()
           
protected  void init(CurlResource curl)
           
protected  void setConnection(java.net.HttpURLConnection conn)
           
 void setConnectTimeout(int time)
           
 void setDoOutput(boolean doOutput)
           
 void setInstanceFollowRedirects(boolean isToFollowRedirects)
           
 void setReadTimeout(int time)
           
 void setRequestMethod(java.lang.String method)
           
 void setRequestProperty(java.lang.String key, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurlHttpConnection

protected CurlHttpConnection(java.net.URL url,
                             java.lang.String username,
                             java.lang.String password)
                      throws java.io.IOException
Throws:
java.io.IOException

CurlHttpConnection

public CurlHttpConnection(java.net.URL url,
                          java.lang.String username,
                          java.lang.String password,
                          java.net.URL proxyURL,
                          java.lang.String proxyUsername,
                          java.lang.String proxyPassword,
                          java.lang.String proxyType)
                   throws java.io.IOException
Throws:
java.io.IOException
Method Detail

init

protected void init(CurlResource curl)
             throws java.io.IOException
Throws:
java.io.IOException

createConnection

public static final CurlHttpConnection createConnection(java.net.URL url,
                                                        java.lang.String username,
                                                        java.lang.String password,
                                                        CurlResource curl,
                                                        java.net.URL proxyURL,
                                                        java.lang.String proxyUsername,
                                                        java.lang.String proxyPassword,
                                                        java.lang.String proxyType)
                                                 throws java.io.IOException
Throws:
java.io.IOException

createConnection

public static final CurlHttpConnection createConnection(java.net.URL url,
                                                        java.lang.String username,
                                                        java.lang.String password,
                                                        CurlResource curl)
                                                 throws java.io.IOException
Throws:
java.io.IOException

setConnectTimeout

public void setConnectTimeout(int time)

setDoOutput

public void setDoOutput(boolean doOutput)

setInstanceFollowRedirects

public void setInstanceFollowRedirects(boolean isToFollowRedirects)

setReadTimeout

public void setReadTimeout(int time)

setRequestMethod

public void setRequestMethod(java.lang.String method)
                      throws java.net.ProtocolException
Throws:
java.net.ProtocolException

setRequestProperty

public void setRequestProperty(java.lang.String key,
                               java.lang.String value)

getProxy

protected final java.net.Proxy getProxy()

getURL

protected final java.net.URL getURL()

getConnection

protected final java.net.HttpURLConnection getConnection()

setConnection

protected final void setConnection(java.net.HttpURLConnection conn)

connect

public void connect(CurlResource curl)
             throws java.net.ConnectException,
                    java.net.ProtocolException,
                    java.net.SocketTimeoutException,
                    java.io.IOException
Connects to the server.

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

authenticate

public void authenticate()
                  throws java.net.ConnectException,
                         java.net.ProtocolException,
                         java.net.SocketTimeoutException,
                         java.io.IOException
Handles the authentication for this connection.

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

authenticateImpl

public void authenticateImpl()
                      throws java.net.ConnectException,
                             java.net.ProtocolException,
                             java.net.SocketTimeoutException,
                             java.io.IOException
Handles the authentication for this connection.

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

getContentLength

public int getContentLength()

getErrorStream

public java.io.InputStream getErrorStream()

getHeaderField

public java.lang.String getHeaderField(java.lang.String key)

getHeaderField

public java.lang.String getHeaderField(int i)

getHeaderFieldKey

public java.lang.String getHeaderFieldKey(int i)

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Throws:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Throws:
java.io.IOException

getResponseCode

public int getResponseCode()
                    throws java.io.IOException
Throws:
java.io.IOException

disconnect

public void disconnect()

close

public void close()