org.mortbay.http
Class HttpTunnel
java.lang.Object
org.mortbay.http.HttpTunnel
public class HttpTunnel
extends java.lang.Object
HTTP Tunnel.
A HTTP Tunnel can be used to take over a HTTP connection in order to
tunnel another protocol over it. The prime example is the CONNECT method
handled by the ProxyHandler to setup a SSL tunnel between the client and
the real server.
static int | copyBytes(InputStream in, OutputStream out, long byteCount) - Copy Stream in to Stream for byteCount bytes or until EOF or exception.
|
Socket | getSocket()
|
int | getTimeoutMs()
|
void | handle(InputStream in, OutputStream out) - handle method.
|
void | setTimeoutMs(int timeoutMs)
|
HttpTunnel
protected HttpTunnel()
Constructor.
HttpTunnel
public HttpTunnel(Socket socket,
InputStream in,
OutputStream out)
throws IOException
Constructor.
socket
- The tunnel socket.in
- Alternative input stream or null if using normal socket streamout
- Alternative output stream or null if using normal socket stream
copyBytes
public static int copyBytes(InputStream in,
OutputStream out,
long byteCount)
throws IOException
Copy Stream in to Stream for byteCount bytes or until EOF or exception.
- Copied bytes count or -1 if no bytes were read *and* EOF was reached
getSocket
public Socket getSocket()
getTimeoutMs
public int getTimeoutMs()
handle
public void handle(InputStream in,
OutputStream out)
handle method.
This method is called by the HttpConnection.handleNext() method if
this HttpTunnel has been set on that connection.
The default implementation of this method copies between the HTTP
socket and the socket passed in the constructor.
setTimeoutMs
public void setTimeoutMs(int timeoutMs)
timeoutMs
- The timeoutMs to set.
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.