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 int
callCount
Call count.protected FileHandler
fileHandler
CARGO file handler.protected String
filePath
Path of the file to serve.protected Throwable
lastException
Last exception.protected Logger
logger
Logger instance.protected String
remotePath
Remote path of served file.protected ServerSocket
serverSocket
TCP socket.protected boolean
stopped
Has stop been called?protected URL
url
URL 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 int
getCallCount()
Throwable
getException()
URL
getURL()
void
run()
void
setFile(Deployable deployable, String keepOriginalWarFilename)
void
setFileHandler(FileHandler fileHandler)
void
setListeningParameters(InetSocketAddress listenSocket, String remoteDeployAddress)
void
setLogger(Logger logger)
void
start()
starts the server.void
stop()
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:
setFileHandler
in interfaceISimpleHttpFileServer
- Parameters:
fileHandler
- file handler to use.
-
setLogger
public void setLogger(Logger logger)
- Specified by:
setLogger
in interfaceISimpleHttpFileServer
- Parameters:
logger
- logger to use.
-
setFile
public void setFile(Deployable deployable, String keepOriginalWarFilename)
- Specified by:
setFile
in interfaceISimpleHttpFileServer
- Parameters:
deployable
- deployable to handle.keepOriginalWarFilename
- whether to keep the original file name, seeJBossPropertySet.DEPLOYER_KEEP_ORIGINAL_WAR_FILENAME
for details.
-
setListeningParameters
public void setListeningParameters(InetSocketAddress listenSocket, String remoteDeployAddress)
- Specified by:
setListeningParameters
in 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:
getURL
in interfaceISimpleHttpFileServer
- Returns:
- url this server serves.
-
getCallCount
public int getCallCount()
- Specified by:
getCallCount
in interfaceISimpleHttpFileServer
- Returns:
- the number of successful calls received.
-
getException
public Throwable getException()
- Specified by:
getException
in interfaceISimpleHttpFileServer
- Returns:
- exception, if any occured.
-
start
public void start()
starts the server.- Specified by:
start
in interfaceISimpleHttpFileServer
-
stop
public void stop()
stops the server.- Specified by:
stop
in interfaceISimpleHttpFileServer
-
-