org.apache.commons.httpclient.util

Class HttpURLConnection


public class HttpURLConnection
extends HttpURLConnection

Provides a HttpURLConnection wrapper around HttpClient's HttpMethod. This allows existing code to easily switch to HttpClieht without breaking existing interfaces using the JDK HttpURLConnection. Note 1: The current implementations wraps only a connected HttpMethod, ie a method that has alreayd been used to connect to an HTTP server. Note 2: It is a best try effort as different version of the JDK have different behaviours for HttpURLConnection (And I'm not even including the numerous HttpURLConnection bugs!).
Version:
$Id: HttpURLConnection.java 155418 2005-02-26 13:01:52Z dirkv $
Authors:
Vincent Massol
Jeff Dever
Mike Bowler
Since:
2.0

Constructor Summary

HttpURLConnection(URL url)
Create an instance.
HttpURLConnection(HttpMethod method, URL url)
Creates an HttpURLConnection from a HttpMethod.

Method Summary

void
connect()
Not available: the data must have already been retrieved.
void
disconnect()
Not yet implemented.
boolean
getAllowUserInteraction()
Not yet implemented.
Object
getContent()
Not yet implemented.
Object
getContent(Class[] classes)
Not yet implemented.
boolean
getDefaultUseCaches()
Not available: the data must have already been retrieved.
boolean
getDoInput()
Not yet implemented.
boolean
getDoOutput()
Not yet implemented.
InputStream
getErrorStream()
Not yet implemented.
String
getHeaderField(String name)
Return the header field
String
getHeaderField(int position)
Return the header field at the specified position
String
getHeaderFieldKey(int keyPosition)
Return the header field key
long
getIfModifiedSince()
Not yet implemented.
InputStream
getInputStream()
Gets an input stream for the HttpMethod response body.
boolean
getInstanceFollowRedirects()
Not yet implemented.
OutputStream
getOutputStream()
Permission
getPermission()
Not yet implemented.
String
getRequestMethod()
Return the request method.
String
getRequestProperty(String key)
Not yet implemented.
int
getResponseCode()
Return the response code.
String
getResponseMessage()
Return the response message
URL
getURL()
Return the URL
boolean
getUseCaches()
Not yet implemented.
void
setAllowUserInteraction(boolean isAllowInteraction)
Not available: the data must have already been retrieved.
void
setDefaultUseCaches(boolean isUsingCaches)
Not available: the data must have already been retrieved.
void
setDoInput(boolean isInput)
Not available: the data must have already been retrieved.
void
setDoOutput(boolean isOutput)
Not available: the data must have already been retrieved.
void
setIfModifiedSince(long modificationDate)
Not available: the data must have already been retrieved.
void
setInstanceFollowRedirects(boolean isFollowingRedirects)
Not available: the data must have already been retrieved.
void
setRequestMethod(String method)
Not available: the data must have already been retrieved.
void
setRequestProperty(String key, String value)
Not available: the data must have already been retrieved.
void
setUseCaches(boolean isUsingCaches)
Not available: the data must have already been retrieved.
boolean
usingProxy()
Not yet implemented.

Constructor Details

HttpURLConnection

protected HttpURLConnection(URL url)
Create an instance.
Parameters:
url - The URL.

HttpURLConnection

public HttpURLConnection(HttpMethod method,
                         URL url)
Creates an HttpURLConnection from a HttpMethod.
Parameters:
method - the theMethod that was used to connect to the HTTP server and which contains the returned data.
url - the URL to which we are connected (includes query string)

Method Details

connect

public void connect()
            throws IOException
Not available: the data must have already been retrieved.

disconnect

public void disconnect()
Not yet implemented.

getAllowUserInteraction

public boolean getAllowUserInteraction()
Not yet implemented.

getContent

public Object getContent()
            throws IOException
Not yet implemented.

getContent

public Object getContent(Class[] classes)
            throws IOException
Not yet implemented.

getDefaultUseCaches

public boolean getDefaultUseCaches()
Not available: the data must have already been retrieved.

getDoInput

public boolean getDoInput()
Not yet implemented.

getDoOutput

public boolean getDoOutput()
Not yet implemented.

getErrorStream

public InputStream getErrorStream()
Not yet implemented. Return the error stream.

getHeaderField

public String getHeaderField(String name)
Return the header field
Parameters:
name - the name of the header
Returns:
the header field.

getHeaderField

public String getHeaderField(int position)
Return the header field at the specified position
Parameters:
position - The position
Returns:
The header field.

getHeaderFieldKey

public String getHeaderFieldKey(int keyPosition)
Return the header field key
Parameters:
keyPosition - The key position
Returns:
The header field key.

getIfModifiedSince

public long getIfModifiedSince()
Not yet implemented.

getInputStream

public InputStream getInputStream()
            throws IOException
Gets an input stream for the HttpMethod response body.
Returns:
The input stream.

getInstanceFollowRedirects

public boolean getInstanceFollowRedirects()
Not yet implemented.

getOutputStream

public OutputStream getOutputStream()
            throws IOException

getPermission

public Permission getPermission()
            throws IOException
Not yet implemented.

getRequestMethod

public String getRequestMethod()
Return the request method.
Returns:
The request method.

getRequestProperty

public String getRequestProperty(String key)
Not yet implemented.

getResponseCode

public int getResponseCode()
            throws IOException
Return the response code.
Returns:
The response code.

getResponseMessage

public String getResponseMessage()
            throws IOException
Return the response message
Returns:
The response message

getURL

public URL getURL()
Return the URL
Returns:
The URL.

getUseCaches

public boolean getUseCaches()
Not yet implemented.

setAllowUserInteraction

public void setAllowUserInteraction(boolean isAllowInteraction)
Not available: the data must have already been retrieved.

setDefaultUseCaches

public void setDefaultUseCaches(boolean isUsingCaches)
Not available: the data must have already been retrieved.

setDoInput

public void setDoInput(boolean isInput)
Not available: the data must have already been retrieved.

setDoOutput

public void setDoOutput(boolean isOutput)
Not available: the data must have already been retrieved.

setIfModifiedSince

public void setIfModifiedSince(long modificationDate)
Not available: the data must have already been retrieved.

setInstanceFollowRedirects

public void setInstanceFollowRedirects(boolean isFollowingRedirects)
Not available: the data must have already been retrieved.

setRequestMethod

public void setRequestMethod(String method)
            throws ProtocolException
Not available: the data must have already been retrieved.

setRequestProperty

public void setRequestProperty(String key,
                               String value)
Not available: the data must have already been retrieved.

setUseCaches

public void setUseCaches(boolean isUsingCaches)
Not available: the data must have already been retrieved.

usingProxy

public boolean usingProxy()
Not yet implemented.
Returns:
true if we are using a proxy.

Copyright (c) 1999-2005 - Apache Software Foundation