Class SimpleHttpFileServer
- java.lang.Object
 - 
- org.codehaus.cargo.container.jboss.internal.SimpleHttpFileServer
 
 
- 
- All Implemented Interfaces:
 Runnable,ISimpleHttpFileServer
public class SimpleHttpFileServer extends Object implements Runnable, ISimpleHttpFileServer
Implementation of a Web server that serves one file. 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected intcallCountCall count.protected FileHandlerfileHandlerCARGO file handler.protected StringfilePathPath of the file to serve.protected ThrowablelastExceptionLast exception.protected LoggerloggerLogger instance.protected StringremotePathRemote path of served file.protected ServerSocketserverSocketTCP socket.protected booleanstoppedHas stop been called?protected URLurlURL for retrieving file. 
- 
Constructor Summary
Constructors Constructor Description SimpleHttpFileServer()create the simple http file server. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCallCount()ThrowablegetException()URLgetURL()voidrun()voidsetFile(Deployable deployable, String keepOriginalWarFilename)voidsetFileHandler(FileHandler fileHandler)voidsetListeningParameters(InetSocketAddress listenSocket, String remoteDeployAddress)voidsetLogger(Logger logger)voidstart()starts the server.voidstop()stops the server. 
 - 
 
- 
- 
Field Detail
- 
logger
protected Logger logger
Logger instance. 
- 
url
protected URL url
URL for retrieving file. 
- 
fileHandler
protected FileHandler fileHandler
CARGO file handler. 
- 
filePath
protected String filePath
Path of the file to serve. 
- 
remotePath
protected String remotePath
Remote path of served file. 
- 
serverSocket
protected ServerSocket serverSocket
TCP socket. 
- 
callCount
protected int callCount
Call count. 
- 
stopped
protected boolean stopped
Has stop been called? 
- 
lastException
protected Throwable lastException
Last exception. 
 - 
 
- 
Method Detail
- 
setFileHandler
public void setFileHandler(FileHandler fileHandler)
- Specified by:
 setFileHandlerin interfaceISimpleHttpFileServer- Parameters:
 fileHandler- file handler to use.
 
- 
setLogger
public void setLogger(Logger logger)
- Specified by:
 setLoggerin interfaceISimpleHttpFileServer- Parameters:
 logger- logger to use.
 
- 
setFile
public void setFile(Deployable deployable, String keepOriginalWarFilename)
- Specified by:
 setFilein interfaceISimpleHttpFileServer- Parameters:
 deployable- deployable to handle.keepOriginalWarFilename- whether to keep the original file name, seeJBossPropertySet.DEPLOYER_KEEP_ORIGINAL_WAR_FILENAMEfor details.
 
- 
setListeningParameters
public void setListeningParameters(InetSocketAddress listenSocket, String remoteDeployAddress)
- Specified by:
 setListeningParametersin interfaceISimpleHttpFileServer- Parameters:
 listenSocket- socket to listen on.remoteDeployAddress- remote hostname to use in the url, if null it will be obtained from the listenSocket.
 
- 
getURL
public URL getURL()
- Specified by:
 getURLin interfaceISimpleHttpFileServer- Returns:
 - url this server serves.
 
 
- 
getCallCount
public int getCallCount()
- Specified by:
 getCallCountin interfaceISimpleHttpFileServer- Returns:
 - the number of successful calls received.
 
 
- 
getException
public Throwable getException()
- Specified by:
 getExceptionin interfaceISimpleHttpFileServer- Returns:
 - exception, if any occured.
 
 
- 
start
public void start()
starts the server.- Specified by:
 startin interfaceISimpleHttpFileServer
 
- 
stop
public void stop()
stops the server.- Specified by:
 stopin interfaceISimpleHttpFileServer
 
 - 
 
 -