gnu.java.net.protocol.http
Class HTTPConnection
A connection to an HTTP server.
static int | HTTPS_PORT - The default HTTPS port.
|
static int | HTTP_PORT - The default HTTP port.
|
protected int | connectionTimeout - The connection timeout for connecting the underlying socket.
|
protected CookieManager | cookieManager - The cookie manager for this connection.
|
protected String | hostname - The host name of the server to connect to.
|
protected InputStream | in - The socket input stream.
|
protected int | majorVersion - The major version of HTTP supported by this client.
|
protected int | minorVersion - The minor version of HTTP supported by this client.
|
protected OutputStream | out - The socket output stream.
|
protected int | port - The port to connect to.
|
protected String | proxyHostname - The host name of the proxy to connect to.
|
protected int | proxyPort - The port on the proxy to connect to.
|
protected boolean | secure - Whether the connection should use transport level security (HTTPS).
|
protected Socket | socket - The socket this connection communicates on.
|
protected int | timeout - The read timeout for reads on the underlying socket.
|
HTTPConnection(String hostname) - Creates a new HTTP connection.
|
HTTPConnection(String hostname, boolean secure) - Creates a new HTTP or HTTPS connection.
|
HTTPConnection(String hostname, boolean secure, int connectionTimeout, int timeout) - Creates a new HTTP or HTTPS connection on the specified port.
|
HTTPConnection(String hostname, int port) - Creates a new HTTP connection on the specified port.
|
HTTPConnection(String hostname, int port, boolean secure) - Creates a new HTTP or HTTPS connection on the specified port.
|
HTTPConnection(String hostname, int port, boolean secure, int connectionTimeout, int timeout) - Creates a new HTTP or HTTPS connection on the specified port.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
HTTPS_PORT
public static final int HTTPS_PORT
The default HTTPS port.
HTTP_PORT
public static final int HTTP_PORT
The default HTTP port.
connectionTimeout
protected final int connectionTimeout
The connection timeout for connecting the underlying socket.
hostname
protected final String hostname
The host name of the server to connect to.
majorVersion
protected int majorVersion
The major version of HTTP supported by this client.
minorVersion
protected int minorVersion
The minor version of HTTP supported by this client.
port
protected final int port
The port to connect to.
proxyPort
protected int proxyPort
The port on the proxy to connect to.
secure
protected final boolean secure
Whether the connection should use transport level security (HTTPS).
socket
protected Socket socket
The socket this connection communicates on.
timeout
protected final int timeout
The read timeout for reads on the underlying socket.
HTTPConnection
public HTTPConnection(String hostname)
Creates a new HTTP connection.
hostname
- the name of the host to connect to
HTTPConnection
public HTTPConnection(String hostname,
boolean secure)
Creates a new HTTP or HTTPS connection.
hostname
- the name of the host to connect tosecure
- whether to use a secure connection
HTTPConnection
public HTTPConnection(String hostname,
boolean secure,
int connectionTimeout,
int timeout)
Creates a new HTTP or HTTPS connection on the specified port.
hostname
- the name of the host to connect tosecure
- whether to use a secure connectionconnectionTimeout
- the connection timeouttimeout
- the socket read timeout
HTTPConnection
public HTTPConnection(String hostname,
int port)
Creates a new HTTP connection on the specified port.
hostname
- the name of the host to connect toport
- the port on the host to connect to
HTTPConnection
public HTTPConnection(String hostname,
int port,
boolean secure)
Creates a new HTTP or HTTPS connection on the specified port.
hostname
- the name of the host to connect toport
- the port on the host to connect tosecure
- whether to use a secure connection
HTTPConnection
public HTTPConnection(String hostname,
int port,
boolean secure,
int connectionTimeout,
int timeout)
Creates a new HTTP or HTTPS connection on the specified port.
hostname
- the name of the host to connect toport
- the port on the host to connect tosecure
- whether to use a secure connectionconnectionTimeout
- the connection timeouttimeout
- the socket read timeout
getPort
public int getPort()
Returns the port on the host to connect to.
getSocket
protected Socket getSocket()
throws IOException
Retrieves the socket associated with this connection.
This creates the socket if necessary.
getURI
protected String getURI()
Returns a URI representing the connection.
This does not include any request path component.
getVersion
public String getVersion()
Returns the HTTP version string supported by this connection.
isSecure
public boolean isSecure()
Indicates whether to use a secure connection or not.
isUsingProxy
public boolean isUsingProxy()
Indicates whether this connection is using an HTTP proxy.
newRequest
public Request newRequest(String method,
String path)
Creates a new request using this connection.
method
- the HTTP method to invokepath
- the URI-escaped RFC2396 abs_path
with
optional query part
setCookieManager
public void setCookieManager(CookieManager cookieManager)
Sets the cookie manager to use for this connection.
cookieManager
- the cookie manager
setProxy
public void setProxy(String hostname,
int port)
Directs this connection to use the specified proxy.
hostname
- the proxy host nameport
- the port on the proxy to connect to
setVersion
public void setVersion(int majorVersion,
int minorVersion)
Sets the HTTP version supported by this connection.
majorVersion
- the major versionminorVersion
- the minor version
HTTPConnection.java --
Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.