Package javassist.tools.rmi
Class AppletServer
java.lang.Object
javassist.tools.web.Webserver
javassist.tools.rmi.AppletServer
An AppletServer object is a web server that an ObjectImporter
communicates with. It makes the objects specified by
exportObject()
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map
<String, ExportedObject> private List
<ExportedObject> private static final byte[]
private StubGenerator
Fields inherited from class javassist.tools.web.Webserver
debugDir, htmlfileBase, translator
-
Constructor Summary
ConstructorsModifierConstructorDescriptionAppletServer
(int port) Constructs a web server.AppletServer
(int port, ClassPool src) Constructs a web server.AppletServer
(String port) Constructs a web server.private
AppletServer
(ClassPool loader, StubGenerator gen, int port) -
Method Summary
Modifier and TypeMethodDescriptionprivate Object
convertRvalue
(Object rvalue) void
doReply
(InputStream in, OutputStream out, String cmd) Processes a request from a web browser (an ObjectImporter).int
exportObject
(String name, Object obj) Exports an object.private void
lookupName
(String cmd, InputStream ins, OutputStream outs) private void
processRMI
(InputStream ins, OutputStream outs) private Object[]
void
run()
Begins the HTTP service.Methods inherited from class javassist.tools.web.Webserver
addTranslator, end, logging, logging, logging, logging2, main, setClassPool
-
Field Details
-
stubGen
-
exportedNames
-
exportedObjects
-
okHeader
private static final byte[] okHeader
-
-
Constructor Details
-
AppletServer
Constructs a web server.- Parameters:
port
- port number- Throws:
IOException
NotFoundException
CannotCompileException
-
AppletServer
Constructs a web server.- Parameters:
port
- port number- Throws:
IOException
NotFoundException
CannotCompileException
-
AppletServer
public AppletServer(int port, ClassPool src) throws IOException, NotFoundException, CannotCompileException Constructs a web server.- Parameters:
port
- port numbersrc
- the source of classs files.- Throws:
IOException
NotFoundException
CannotCompileException
-
AppletServer
private AppletServer(ClassPool loader, StubGenerator gen, int port) throws IOException, NotFoundException, CannotCompileException
-
-
Method Details
-
run
public void run()Begins the HTTP service. -
exportObject
Exports 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:
-
doReply
public void doReply(InputStream in, OutputStream out, String cmd) throws IOException, BadHttpRequest Processes a request from a web browser (an ObjectImporter).- Overrides:
doReply
in classWebserver
- Parameters:
out
- the output stream to a clientcmd
- the command received from a client- Throws:
IOException
BadHttpRequest
-
processRMI
- Throws:
IOException
-
readParameters
- Throws:
IOException
ClassNotFoundException
-
convertRvalue
- Throws:
CannotCompileException
-
lookupName
- Throws:
IOException
-