org.caleigo.toolkit.tunnel
Class HTTPTunnel
java.lang.Object
org.caleigo.toolkit.tunnel.AbstractTunnel
org.caleigo.toolkit.tunnel.HTTPTunnel
- All Implemented Interfaces:
- ITunnel
- public class HTTPTunnel
- extends AbstractTunnel
- Version:
- 1.00
- Author:
- Mattias Hagstrand
Nested classes inherited from class org.caleigo.toolkit.tunnel.AbstractTunnel |
AbstractTunnel.DefaultConnectionMessage, AbstractTunnel.DefaultPackage, AbstractTunnel.DefaultStatusMessage, AbstractTunnel.ErrorMessage, AbstractTunnel.IConnectionMessage, AbstractTunnel.IFinalizeMessage, AbstractTunnel.InputThread, AbstractTunnel.IPackage, AbstractTunnel.IStatusMessage, AbstractTunnel.OutputThread, AbstractTunnel.WorkerThread |
Fields inherited from class org.caleigo.toolkit.tunnel.AbstractTunnel |
DEBUG, DEFAULT_NBR_OF_WORKER_THREADS, ERROR, INFO, mCodec, mCurrentPackageID, mInputThread, mInQueue, mLogLevel, mMessageConsumers, mOutputThread, mOutQueue, mPackers, mReplyMessages, mStatusCallbacks, mTunnelListeners, mWorkerThreads, sNbrOfWorkerThreads, WARNING |
Method Summary |
protected java.net.HttpURLConnection |
createConnection()
|
void |
finalize()
Performs cleanup for this ITunnel. |
protected java.io.InputStream |
getInputStream()
Returns an InputStream that should be used to receive messages. |
protected java.io.OutputStream |
getOutputStream()
Returns an OutputStream that should be used to send messages. |
void |
initialize()
Initializes the ITunnel. |
boolean |
isActive()
Returns true if this tunnel is active, that is, if it is
correctly initialized. |
protected void |
setUpConnection()
|
Methods inherited from class org.caleigo.toolkit.tunnel.AbstractTunnel |
addMessageConsumer, addPacker, addStatusCallback, addToInQueue, addToOutQueue, addTunnelListener, ask, createConnectionMessage, createPackage, doOnConnectionLost, doOnTunnelClose, finalizeTunnel, fireConnectionLostEvent, fireTunnelClosedEvent, getDescription, getLogLevel, getNextFromInQueue, getNextFromOutQueue, getNextPackageID, log, log, ping, remomveMessageConsumer, remomvePacker, removeStatusCallback, removeTunnelListener, send, setCodec, setLogLevel, setNbrOfWorkerThreads, waitForReply |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mURL
protected java.net.URL mURL
mOutputStream
protected java.io.OutputStream mOutputStream
mInputStream
protected java.io.InputStream mInputStream
mSessionID
protected int mSessionID
HTTPTunnel
protected HTTPTunnel(java.io.InputStream inputStream,
java.io.OutputStream outputStream)
HTTPTunnel
public HTTPTunnel(java.net.URL url)
HTTPTunnel
public HTTPTunnel(java.net.URL url,
ITunnelCodec codec)
initialize
public void initialize()
throws java.lang.IllegalStateException,
TunnelException
- Description copied from class:
AbstractTunnel
- Initializes the ITunnel. This method must be called before any messages
can be sent. After this method has been called it is not possible to
set the ITunnelCodec or to add or remove ITunnelPackers. Subclasses of
AbstractTunnel must call super.initialize(). Successful initialization
recuires that the methods getInStream and getOutStream does not return
null
.
- Specified by:
initialize
in interface ITunnel
- Overrides:
initialize
in class AbstractTunnel
- Throws:
java.lang.IllegalStateException
TunnelException
finalize
public void finalize()
throws java.lang.IllegalStateException,
TunnelException
- Description copied from class:
AbstractTunnel
- Performs cleanup for this ITunnel. No messages can be sent after this
method has been called. This method will send all messages in the message
queue before closing down. Subclasses of AbstractTunnel must call super.finalize()
before they do any finalization of their own.
- Specified by:
finalize
in interface ITunnel
- Overrides:
finalize
in class AbstractTunnel
- Throws:
java.lang.IllegalStateException
TunnelException
isActive
public boolean isActive()
- Returns
true
if this tunnel is active, that is, if it is
correctly initialized. If this method returns true
then
a call to finalize must not throw an IllegalStateException.
- Specified by:
isActive
in interface ITunnel
- Overrides:
isActive
in class AbstractTunnel
getOutputStream
protected java.io.OutputStream getOutputStream()
- Returns an OutputStream that should be used to send messages.
- Specified by:
getOutputStream
in class AbstractTunnel
getInputStream
protected java.io.InputStream getInputStream()
- Returns an InputStream that should be used to receive messages.
- Specified by:
getInputStream
in class AbstractTunnel
createConnection
protected java.net.HttpURLConnection createConnection()
throws java.io.IOException
- Throws:
java.io.IOException
setUpConnection
protected void setUpConnection()
throws TunnelException
- Throws:
TunnelException
Copyright © 2005 Caleigo. All Rights Reserved.