|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
gnu.cajo.utils.CodebaseServer
public final class CodebaseServer
The standard mechanism to send proxies, and other complex objects to remote VMs. It requires one outbound port. The port can be anonymous, i.e. selected from any available free port at runtime, or it can be explicitly specified, usually to operate through a firewall. It also provides the generic graphical proxy host client service, as an Applet, and via WebStart.
Note: There can be at most one CodebaseServer instance per JVM.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static int |
port
Deprecated. The preferred field to check is serverPort as this field is mutable unfortunately; it remains solely to maintain backward compatibility. |
int |
serverPort
This is the inbound ServerSocket port number providing both the HTTP client tag and codebase jar service. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
CodebaseServer(java.lang.String[] jars,
int port,
java.lang.String client,
java.lang.String title,
java.lang.String vendor,
java.lang.String icon,
java.lang.String splash)
The main constructor will start up the server's codebase transport mechanism on the specified port. |
|
CodebaseServer(java.lang.String base,
int port)
This constructor simply calls the three argument constructor, providing the standard cajo generic graphical client as the client argument. |
|
CodebaseServer(java.lang.String base,
int port,
java.lang.String client)
This constructor will start up the server's codebase transport mechanism on the specified port, using the specified codebase jar file, with the specified clent. |
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
The application creates a utility server to share any jar and class files in its working directory and subdirectories. |
void |
run()
The server thread method, it will send the proxy codebase, and it will also support installing the hosting Client ,
or application specific host, in a Java-enabled browser, or as a web start
application via JNLP. |
void |
setLog(java.io.OutputStream log)
This method can be used to log the client requests of the Codebase server. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final int serverPort
public static int port
Constructor Detail |
---|
public CodebaseServer(java.lang.String[] jars, int port, java.lang.String client, java.lang.String title, java.lang.String vendor, java.lang.String icon, java.lang.String splash) throws java.io.IOException
jars
- An array of strings representing the path and filename of a
library jar needed by the client application. The CodebaseServer will
serve them to the remote JVM. The server will first search for the jar in
its own executable jar file, if that fails, then it will check the local
filesystem. The jars could represent individual proxies, or
general-purpose shared libraries.
The first jar named in the array will be assumed to be the jar containing the main client class.
Note: if this value is null, it indicates that the proxy codebase is not in a jar. The server will then look first in its own jar file for the class files to send, and if not found, it will next look in its working directory. This feature provides an extremely simple, essentially zero-configuration, approach to proxy codebase service.
As a special safety feature, if the jar from which the service items are running is given the special> name service.jar it not be allowed to be requested over the network. This would be important for example, if you did not wish to share the server.jar file.
port
- The TCP port on which to serve the codebase, and client
applet. It can be zero, to use an anonymous port. If zero, the actual port
selected by the OS at runtime will be stored in the
serverPort
member.client
- The name of the graphical client class to be furnished as an
Applet, or via WebStart. For example, the generic cajo standard graphical
proxy is: gnu.cajo.invoke.Clienttitle
- The optional application specific titile to show in the
browser, when running as an applet.vendor
- The optional vendor name of the WebStart application.icon
- The optional custom desktop icon to represent the WebStart
application, it can also be null. It is typically of the form
"images/icon.gif", where it will be requested from the server. The image
can be in either GIF or JPEG format.splash
- The optional splash screen image to represent the WebStart
application while it is loading, it can also be null. It is typically of
the form "images/splash.jpeg", where it will be requested from the server.
The image can be in either GIF or JPEG format.
java.io.IOException
- If the HTTP socket providing the codebase and applet
tag service could not be created.public CodebaseServer(java.lang.String base, int port, java.lang.String client) throws java.io.IOException
base
- The path and name of the file containing the proxy codebase
jar file.port
- The TCP port on which to serve the codebase, and client
applet.client
- The name of the graphical client class to be furnished as an
Applet, or via WebStart.
java.io.IOException
- If the HTTP socket providing the codebase and applet
tag service could not be created.public CodebaseServer(java.lang.String base, int port) throws java.io.IOException
base
- The path and name of the file containing the proxy codebase
jar file.port
- The TCP port on which to serve the codebase, and client
applet.
java.io.IOException
- If the HTTP socket providing the codebase and applet
tag service could not be created.Method Detail |
---|
public void setLog(java.io.OutputStream log)
Note: Only one log stream can be assigned to the CodebaseServer at any given time.
log
- The OutputStream to record the client requests. If this
argument is null, no change will take place.public void run()
Client
,
or application specific host, in a Java-enabled browser, or as a web start
application via JNLP.
The format of a browser's proxy request URL one required, and five optional parameters, utilizing the following format:
http://serverHost[:serverPort]/[clientPort][:localPort][-proxyName][!]
Where the parameters have the following meanings:
To unspecify any optional object, simply omit it, from the URL, along with its preceeding delimiter, if any. The order of the arguments must be maintained however.
Note: other object servers can share this instance, by placing their proxy classes or jar files in the same working directory. However, those object servers will not be able to use the client service feature, as it is unique to the VM in which the CodebaseServer is running.
As a safety precaution, the server will send any requested jar or class file in or below its working directory except the jar file of the server itself. Typically people do not want to give this file out.
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |