Package javassist.tools.rmi
Class AppletServer
- java.lang.Object
-
- javassist.tools.web.Webserver
-
- javassist.tools.rmi.AppletServer
-
public class AppletServer extends Webserver
An AppletServer object is a web server that an ObjectImporter communicates with. It makes the objects specified byexportObject()remotely accessible from applets. If the classes of the exported objects are requested by the client-side JVM, this web server sends proxy classes for the requested classes.- See Also:
ObjectImporter
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,ExportedObject>exportedNamesprivate java.util.List<ExportedObject>exportedObjectsprivate static byte[]okHeaderprivate StubGeneratorstubGen-
Fields inherited from class javassist.tools.web.Webserver
debugDir, htmlfileBase, translator
-
-
Constructor Summary
Constructors Modifier Constructor Description AppletServer(int port)Constructs a web server.AppletServer(int port, ClassPool src)Constructs a web server.AppletServer(java.lang.String port)Constructs a web server.privateAppletServer(ClassPool loader, StubGenerator gen, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.ObjectconvertRvalue(java.lang.Object rvalue)voiddoReply(java.io.InputStream in, java.io.OutputStream out, java.lang.String cmd)Processes a request from a web browser (an ObjectImporter).intexportObject(java.lang.String name, java.lang.Object obj)Exports an object.private voidlookupName(java.lang.String cmd, java.io.InputStream ins, java.io.OutputStream outs)private voidprocessRMI(java.io.InputStream ins, java.io.OutputStream outs)private java.lang.Object[]readParameters(java.io.ObjectInputStream in)voidrun()Begins the HTTP service.-
Methods inherited from class javassist.tools.web.Webserver
addTranslator, end, logging, logging, logging, logging2, main, setClassPool
-
-
-
-
Field Detail
-
stubGen
private StubGenerator stubGen
-
exportedNames
private java.util.Map<java.lang.String,ExportedObject> exportedNames
-
exportedObjects
private java.util.List<ExportedObject> exportedObjects
-
okHeader
private static final byte[] okHeader
-
-
Constructor Detail
-
AppletServer
public AppletServer(java.lang.String port) throws java.io.IOException, NotFoundException, CannotCompileExceptionConstructs a web server.- Parameters:
port- port number- Throws:
java.io.IOExceptionNotFoundExceptionCannotCompileException
-
AppletServer
public AppletServer(int port) throws java.io.IOException, NotFoundException, CannotCompileExceptionConstructs a web server.- Parameters:
port- port number- Throws:
java.io.IOExceptionNotFoundExceptionCannotCompileException
-
AppletServer
public AppletServer(int port, ClassPool src) throws java.io.IOException, NotFoundException, CannotCompileExceptionConstructs a web server.- Parameters:
port- port numbersrc- the source of classs files.- Throws:
java.io.IOExceptionNotFoundExceptionCannotCompileException
-
AppletServer
private AppletServer(ClassPool loader, StubGenerator gen, int port) throws java.io.IOException, NotFoundException, CannotCompileException
- Throws:
java.io.IOExceptionNotFoundExceptionCannotCompileException
-
-
Method Detail
-
exportObject
public int exportObject(java.lang.String name, java.lang.Object obj) throws CannotCompileExceptionExports an object. This method produces the bytecode of the proxy class used to access the exported object. A remote applet can load the proxy class and call a method on the exported object.- Parameters:
name- the name used for looking the object up.obj- the exported object.- Returns:
- the object identifier
- Throws:
CannotCompileException- See Also:
ObjectImporter.lookupObject(String)
-
doReply
public void doReply(java.io.InputStream in, java.io.OutputStream out, java.lang.String cmd) throws java.io.IOException, BadHttpRequestProcesses a request from a web browser (an ObjectImporter).- Overrides:
doReplyin classWebserverout- the output stream to a clientcmd- the command received from a client- Throws:
java.io.IOExceptionBadHttpRequest
-
processRMI
private void processRMI(java.io.InputStream ins, java.io.OutputStream outs) throws java.io.IOException- Throws:
java.io.IOException
-
readParameters
private java.lang.Object[] readParameters(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
convertRvalue
private java.lang.Object convertRvalue(java.lang.Object rvalue) throws CannotCompileException- Throws:
CannotCompileException
-
lookupName
private void lookupName(java.lang.String cmd, java.io.InputStream ins, java.io.OutputStream outs) throws java.io.IOException- Throws:
java.io.IOException
-
-