Class AppletServer


  • public class AppletServer
    extends Webserver
    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:
    ObjectImporter
    • Field Detail

      • exportedNames

        private java.util.Map<java.lang.String,​ExportedObject> exportedNames
      • exportedObjects

        private java.util.List<ExportedObject> exportedObjects
      • okHeader

        private static final byte[] okHeader
    • Method Detail

      • run

        public void run()
        Begins the HTTP service.
        Overrides:
        run in class Webserver
      • exportObject

        public int exportObject​(java.lang.String name,
                                java.lang.Object obj)
                         throws CannotCompileException
        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:
        ObjectImporter.lookupObject(String)
      • doReply

        public void doReply​(java.io.InputStream in,
                            java.io.OutputStream out,
                            java.lang.String cmd)
                     throws java.io.IOException,
                            BadHttpRequest
        Processes a request from a web browser (an ObjectImporter).
        Overrides:
        doReply in class Webserver
        out - the output stream to a client
        cmd - the command received from a client
        Throws:
        java.io.IOException
        BadHttpRequest
      • 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.IOException
        java.lang.ClassNotFoundException
      • lookupName

        private void lookupName​(java.lang.String cmd,
                                java.io.InputStream ins,
                                java.io.OutputStream outs)
                         throws java.io.IOException
        Throws:
        java.io.IOException