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!).

Since: 2.0

Version: $Id: HttpURLConnection.java 155418 2005-02-26 13:01:52Z dirkv $

Author: Vincent Massol Jeff Dever Mike Bowler

Constructor Summary
HttpURLConnection(HttpMethod method, URL url)
Creates an HttpURLConnection from a HttpMethod.
protected HttpURLConnection(URL url)
Create an instance.
Method Summary
voidconnect()
Not available: the data must have already been retrieved.
voiddisconnect()
Not yet implemented.
booleangetAllowUserInteraction()
Not yet implemented.
ObjectgetContent()
Not yet implemented.
ObjectgetContent(Class[] classes)
Not yet implemented.
booleangetDefaultUseCaches()
Not available: the data must have already been retrieved.
booleangetDoInput()
Not yet implemented.
booleangetDoOutput()
Not yet implemented.
InputStreamgetErrorStream()
Not yet implemented.
StringgetHeaderField(String name)
Return the header field
StringgetHeaderField(int position)
Return the header field at the specified position
StringgetHeaderFieldKey(int keyPosition)
Return the header field key
longgetIfModifiedSince()
Not yet implemented.
InputStreamgetInputStream()
Gets an input stream for the HttpMethod response body.
booleangetInstanceFollowRedirects()
Not yet implemented.
OutputStreamgetOutputStream()
PermissiongetPermission()
Not yet implemented.
StringgetRequestMethod()
Return the request method.
StringgetRequestProperty(String key)
Not yet implemented.
intgetResponseCode()
Return the response code.
StringgetResponseMessage()
Return the response message
URLgetURL()
Return the URL
booleangetUseCaches()
Not yet implemented.
voidsetAllowUserInteraction(boolean isAllowInteraction)
Not available: the data must have already been retrieved.
voidsetDefaultUseCaches(boolean isUsingCaches)
Not available: the data must have already been retrieved.
voidsetDoInput(boolean isInput)
Not available: the data must have already been retrieved.
voidsetDoOutput(boolean isOutput)
Not available: the data must have already been retrieved.
voidsetIfModifiedSince(long modificationDate)
Not available: the data must have already been retrieved.
voidsetInstanceFollowRedirects(boolean isFollowingRedirects)
Not available: the data must have already been retrieved.
voidsetRequestMethod(String method)
Not available: the data must have already been retrieved.
voidsetRequestProperty(String key, String value)
Not available: the data must have already been retrieved.
voidsetUseCaches(boolean isUsingCaches)
Not available: the data must have already been retrieved.
booleanusingProxy()
Not yet implemented.

Constructor Detail

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)

HttpURLConnection

protected HttpURLConnection(URL url)
Create an instance.

Parameters: url The URL.

See Also: java.net.HttpURLConnection#HttpURLConnection(URL)

Method Detail

connect

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

Throws: IOException If an IO problem occurs.

See Also: java.net.HttpURLConnection#connect()

disconnect

public void disconnect()
Not yet implemented.

See Also: java.net.HttpURLConnection#disconnect()

getAllowUserInteraction

public boolean getAllowUserInteraction()
Not yet implemented.

See Also: java.net.HttpURLConnection#getAllowUserInteraction()

getContent

public Object getContent()
Not yet implemented.

See Also: java.net.HttpURLConnection#getContent()

getContent

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

getDefaultUseCaches

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

See Also: java.net.HttpURLConnection#getDefaultUseCaches()

getDoInput

public boolean getDoInput()
Not yet implemented.

See Also: java.net.HttpURLConnection#getDoInput()

getDoOutput

public boolean getDoOutput()
Not yet implemented.

See Also: java.net.HttpURLConnection#getDoOutput()

getErrorStream

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

See Also: java.net.HttpURLConnection#getErrorStream()

getHeaderField

public String getHeaderField(String name)
Return the header field

Parameters: name the name of the header

Returns: the header field.

See Also: java.net.HttpURLConnection#getHeaderField(String) getResponseHeaders

getHeaderField

public String getHeaderField(int position)
Return the header field at the specified position

Parameters: position The position

Returns: The header field.

See Also: java.net.HttpURLConnection#getHeaderField(int) getResponseHeaders

getHeaderFieldKey

public String getHeaderFieldKey(int keyPosition)
Return the header field key

Parameters: keyPosition The key position

Returns: The header field key.

See Also: java.net.HttpURLConnection#getHeaderFieldKey(int) getResponseHeaders

getIfModifiedSince

public long getIfModifiedSince()
Not yet implemented.

See Also: java.net.HttpURLConnection#getIfModifiedSince()

getInputStream

public InputStream getInputStream()
Gets an input stream for the HttpMethod response body.

Returns: The input stream.

Throws: IOException If an IO problem occurs.

See Also: java.net.HttpURLConnection#getInputStream() getResponseBodyAsStream

getInstanceFollowRedirects

public boolean getInstanceFollowRedirects()
Not yet implemented.

getOutputStream

public OutputStream getOutputStream()

See Also: java.net.HttpURLConnection#getOutputStream()

getPermission

public Permission getPermission()
Not yet implemented.

See Also: java.net.HttpURLConnection#getPermission()

getRequestMethod

public String getRequestMethod()
Return the request method.

Returns: The request method.

See Also: java.net.HttpURLConnection#getRequestMethod() getName

getRequestProperty

public String getRequestProperty(String key)
Not yet implemented.

See Also: java.net.HttpURLConnection#getRequestProperty(String)

getResponseCode

public int getResponseCode()
Return the response code.

Returns: The response code.

Throws: IOException If an IO problem occurs.

See Also: java.net.HttpURLConnection#getResponseCode() getStatusCode

getResponseMessage

public String getResponseMessage()
Return the response message

Returns: The response message

Throws: IOException If an IO problem occurs.

See Also: java.net.HttpURLConnection#getResponseMessage() getStatusText

getURL

public URL getURL()
Return the URL

Returns: The URL.

See Also: java.net.HttpURLConnection#getURL()

getUseCaches

public boolean getUseCaches()
Not yet implemented.

See Also: java.net.HttpURLConnection#getUseCaches()

setAllowUserInteraction

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

See Also: java.net.HttpURLConnection#setAllowUserInteraction(boolean)

setDefaultUseCaches

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

See Also: java.net.HttpURLConnection#setDefaultUseCaches(boolean)

setDoInput

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

See Also: java.net.HttpURLConnection#setDoInput(boolean)

setDoOutput

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

See Also: java.net.HttpURLConnection#setDoOutput(boolean)

setIfModifiedSince

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

See Also: java.net.HttpURLConnection#setIfModifiedSince(long)

setInstanceFollowRedirects

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

setRequestMethod

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

See Also: java.net.HttpURLConnection#setRequestMethod(String)

setRequestProperty

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

See Also: java.net.HttpURLConnection#setRequestProperty(String,String)

setUseCaches

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

See Also: java.net.HttpURLConnection#setUseCaches(boolean)

usingProxy

public boolean usingProxy()
Not yet implemented.

Returns: true if we are using a proxy.

See Also: java.net.HttpURLConnection#usingProxy()

Copyright (c) 1999-2005 - Apache Software Foundation