org.ow2.clif.util
Class CodeServer
java.lang.Object
java.net.ServerSocket
org.ow2.clif.util.CodeServer
- All Implemented Interfaces:
- java.lang.Runnable
public class CodeServer
- extends java.net.ServerSocket
- implements java.lang.Runnable
This class implements a Java resource or class server. The typical client of this code server is
the ClifClassLoader.
The requested resource or class is first looked for in jar files in CLIF's extension libraries
directory.
Then, current directory and directories set by property clif.codeserver.path are visited, in
this order. The property, when set, should contain a ';' separated list of directory paths.
In detail, the codeserver listens on a given port, and upon any connection request:
- reads from the socket an UTF String representing the class or resource name
- writes a positive int stating the resource or class file length or a negative int providing
an error code (resource/class not found or resource/class too big).
- if the class/resource file has been found and can be transfered, all of its bytes are written
in the socket.
- the socket is not closed by the code server, except when an exception occurs while handling
the socket.
As of current implementation, class/resource files bigger than 2GB can't be transfered.
- Author:
- Bruno Dillenseger
- See Also:
ClifClassLoader
Method Summary |
static void |
launch(java.net.InetAddress localAddr,
int port,
java.lang.String extdir,
java.lang.String path)
|
void |
run()
|
Methods inherited from class java.net.ServerSocket |
accept, bind, bind, close, getChannel, getInetAddress, getLocalPort, getLocalSocketAddress, getReceiveBufferSize, getReuseAddress, getSoTimeout, implAccept, isBound, isClosed, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketFactory, setSoTimeout, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NO_SUCH_RESOURCE
public static final int NO_SUCH_RESOURCE
- See Also:
- Constant Field Values
RESOURCE_TOO_BIG
public static final int RESOURCE_TOO_BIG
- See Also:
- Constant Field Values
DEFAULT_PATH
public static final java.lang.String DEFAULT_PATH
- See Also:
- Constant Field Values
PATH_SEPARATOR
public static final java.lang.String PATH_SEPARATOR
- See Also:
- Constant Field Values
launch
public static void launch(java.net.InetAddress localAddr,
int port,
java.lang.String extdir,
java.lang.String path)
throws java.io.IOException
- Throws:
java.io.IOException
run
public void run()
- Specified by:
run
in interface java.lang.Runnable