|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.webdav.http.client.HttpConnection
public class HttpConnection
A connection to an HTTP/1.0 or HTTP/1.1 compatable server.
Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Nested Class Summary | |
---|---|
class |
HttpConnection.Header
A request or response header. |
Field Summary | |
---|---|
protected HttpConnection.Header |
internalHeader
|
protected HttpConnection.Header |
requestHeader
|
protected HttpConnection.Header |
responseHeader
|
protected InputStream |
socketIn
|
protected OutputStream |
socketOut
|
Constructor Summary | |
---|---|
HttpConnection(URL resourceUrl)
Creates a new connection on the specified resource. |
|
HttpConnection(URL proxyServerUrl,
URL resourceUrl)
Creates a new connection on the specified resource. |
Method Summary | |
---|---|
void |
clearRequestHeader()
Clear the request header. |
void |
close()
Close this connection. |
double |
getHttpVersion()
Returns the version of HTTP this connection uses for communication with servers. |
InputStream |
getInputStream()
Returns this connection's InputStream . |
OutputStream |
getOutputStream()
Returns this connection's OutputStream . |
boolean |
getPersistent()
Returns a boolean indicating whether this connection should remain open after each request. |
URL |
getProxyServerUrl()
Returns the URL of the proxy server this connection uses
to communicate with the origin server, or null if a proxy
server is not used. |
int |
getReceiveBufferSize()
|
String |
getRequestHeaderFieldValue(String fieldName)
Returns the request header value associated with the given field name, or null if there is no such field name. |
String |
getRequestMethod()
Returns the request method. |
URL |
getResourceUrl()
Returns the URL of this connection's resource. |
String |
getResponseHeaderFieldName(int position)
Returns the response header field name at the given position, or null if there is no field name at that position. |
String |
getResponseHeaderFieldValue(int position)
Returns the response header field value at the given position, or null if there is no value at that position. |
String |
getResponseHeaderFieldValue(String fieldName)
Returns the response header field value that is associated with the given field name, or null if there is no value associated
with that field name. |
int |
getSendBufferSize()
|
boolean |
getSendChunked()
Returns a boolean indicating whether the request's body should be sent chunked encoded. |
int |
getSoLinger()
|
int |
getSoTimeout()
|
int |
getStatusCode()
Returns the status code of the server's response. |
String |
getStatusMessage()
Returns the status message of the server's response. |
boolean |
getTcpNoDelay()
|
Date |
getTimestamp()
Returns this connection's timestamp. |
protected void |
output(OutputStream stream,
String output)
|
protected void |
readHeader(HttpConnection.Header header)
|
protected String |
readln()
|
protected void |
readServerResponse()
|
protected void |
sendRequest()
|
void |
setHttpVersion(double version)
Sets the version of HTTP this connection uses for communication with servers. |
void |
setPersistent(boolean close)
Sets a boolean indicating whether this connection should remain open after each request. |
void |
setProxyServerUrl(URL proxyServerUrl)
Sets the URL of the proxy server this connection uses to
communicate with the origin server. |
void |
setReceiveBufferSize(int size)
|
void |
setRequestHeaderField(String fieldName,
String fieldValue)
Sets the request header value associated with the given field. |
void |
setRequestMethod(String method)
Sets the request method. |
void |
setResourceUrl(URL resourceUrl)
Sets the URL of this connection's resource. |
void |
setSendBufferSize(int size)
|
void |
setSendChunked(boolean chunked)
Sets a boolean indicating whether the request's body should be sent chunked encoded. |
void |
setSocketFactory(ISocketFactory socketFactory)
Sets the factory this connection uses to create sockets. |
void |
setSoLinger(boolean on,
int linger)
|
void |
setSoTimeout(int timeout)
|
void |
setTcpNoDelay(boolean on)
|
void |
setTimestamp(Date date)
Sets this connection's timestamp. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected HttpConnection.Header requestHeader
protected HttpConnection.Header responseHeader
protected HttpConnection.Header internalHeader
protected InputStream socketIn
protected OutputStream socketOut
Constructor Detail |
---|
public HttpConnection(URL resourceUrl)
resourceUrl
- the URL
of a resourcepublic HttpConnection(URL proxyServerUrl, URL resourceUrl)
URL
.
proxyServerUrl
- the URL
of a proxy serverresourceUrl
- the URL
of a resourceMethod Detail |
---|
public void clearRequestHeader()
public void close() throws IOException
IOException
- if there is an I/O error closing the socketpublic double getHttpVersion()
setHttpVersion(double)
public InputStream getInputStream() throws IOException
InputStream
.
InputStream
IOException
- if an I/O error occurs while sending the
requestpublic OutputStream getOutputStream() throws IOException
OutputStream
.
OutputStream
IOException
- if an I/O error occurs while sending the
requestpublic boolean getPersistent()
setPersistent(boolean)
public URL getProxyServerUrl()
URL
of the proxy server this connection uses
to communicate with the origin server, or null
if a proxy
server is not used.
URL
of the proxy server this connection uses
to communicate with the origin serversetProxyServerUrl(URL)
public int getReceiveBufferSize() throws IOException
IOException
Socket.getReceiveBufferSize()
,
setReceiveBufferSize(int)
public String getRequestHeaderFieldValue(String fieldName)
null
if there is no such field name.
fieldName
- the request header field name
setRequestHeaderField(String, String)
public String getRequestMethod()
setRequestMethod(String)
public URL getResourceUrl()
URL
of this connection's resource.
URL
of this connection's resourcesetResourceUrl(URL)
public String getResponseHeaderFieldName(int position) throws IOException
null
if there is no field name at that position.
position
- a position in the response header greater than or
equal to zero
IOException
- if an I/O error occurs while sending the
requestgetResponseHeaderFieldValue(int)
,
getResponseHeaderFieldValue(String)
public String getResponseHeaderFieldValue(int position) throws IOException
null
if there is no value at that position.
position
- a position in the response header greater than or
equal to zero
IOException
- if an I/O error occurs while sending the
requestgetResponseHeaderFieldName(int)
,
getResponseHeaderFieldValue(String)
public String getResponseHeaderFieldValue(String fieldName) throws IOException
null
if there is no value associated
with that field name.
fieldName
- the name of a response header field
IOException
- if an I/O error occurs while sending the
requestgetResponseHeaderFieldValue(int)
,
getResponseHeaderFieldName(int)
public int getSendBufferSize() throws IOException
IOException
Socket.getSendBufferSize()
,
setSendBufferSize(int)
public boolean getSendChunked()
setSendChunked(boolean)
public int getSoLinger()
Socket.getSoLinger()
,
setSoLinger(boolean, int)
public int getSoTimeout()
Socket.getSoTimeout()
,
setSoTimeout(int)
public int getStatusCode() throws IOException
IOException
- if an I/O error occurs while sending the
requestgetStatusMessage()
public String getStatusMessage() throws IOException
IOException
- if an I/O error occurs while sending the
requestgetStatusCode()
public boolean getTcpNoDelay()
Socket.getTcpNoDelay()
,
setTcpNoDelay(boolean)
public Date getTimestamp()
setTimestamp(Date)
protected void output(OutputStream stream, String output) throws IOException
IOException
protected void readHeader(HttpConnection.Header header) throws IOException
IOException
protected String readln() throws IOException
IOException
protected void readServerResponse() throws IOException
IOException
protected void sendRequest() throws IOException
IOException
public void setHttpVersion(double version)
version
- the version of HTTP this connection uses for
communication with serversgetHttpVersion()
public void setPersistent(boolean close)
close
- a boolean indicating whether this connection should
remain open after each requestgetPersistent()
public void setProxyServerUrl(URL proxyServerUrl)
URL
of the proxy server this connection uses to
communicate with the origin server. If null
is given, no
proxy server is used.
proxyServerUrl
- the URL
of a proxy servergetProxyServerUrl()
public void setReceiveBufferSize(int size) throws IOException
IOException
Socket.setReceiveBufferSize(int)
,
getReceiveBufferSize()
public void setRequestHeaderField(String fieldName, String fieldValue)
fieldName
- the request header fieldfieldValue
- the request header valuegetRequestHeaderFieldValue(String)
public void setRequestMethod(String method)
method
- the request methodgetRequestMethod()
public void setResourceUrl(URL resourceUrl)
URL
of this connection's resource.
resourceUrl
- the URL
of this connection's resourcegetResourceUrl()
public void setSendBufferSize(int size) throws IOException
IOException
Socket.setSendBufferSize(int)
,
getSendBufferSize()
public void setSendChunked(boolean chunked)
chunked
- a boolean indicating whether the request's body should
be sent chunked encodedgetSendChunked()
public void setSocketFactory(ISocketFactory socketFactory)
null
the default socket is used.
socketFactory
- the factory this connection uses to create
socketspublic void setSoLinger(boolean on, int linger) throws IOException
IOException
Socket.setSoLinger(boolean, int)
,
getSoLinger()
public void setSoTimeout(int timeout) throws IOException
IOException
Socket.setSoTimeout(int)
,
getSoTimeout()
public void setTcpNoDelay(boolean on) throws IOException
IOException
Socket.setTcpNoDelay(boolean)
,
getTcpNoDelay()
public void setTimestamp(Date date)
date
- this connection's timestampgetTimestamp()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |