public static Object forwardStatic(Object[] args, int identifier) throws RemoteException { throw new RemoteException("cannot call a static method."); } }
private CtClass[] toCtClass(Class[] rtclasses) throws NotFoundException { int n = rtclasses.length; CtClass[] ctclasses = new CtClass[n]; for (int i = 0; i < n; ++i) ctclasses[i] = toCtClass(rtclasses[i]); return ctclasses; }
public Object forward(Object[] args, int identifier) { return importer.call(objectId, identifier, args); }
private Object convertRvalue(Object rvalue) throws CannotCompileException { if (rvalue == null) return null; // the return type is void. String classname = rvalue.getClass().getName(); if (stubGen.isProxyClass(classname)) return new RemoteRef(exportObject(null, rvalue), classname); else return rvalue; }
private void writeParameters(ObjectOutputStream dout, Object[] params) throws IOException { int n = params.length; dout.writeInt(n); for (int i = 0; i < n; ++i) if (params[i] instanceof Proxy) { Proxy p = (Proxy)params[i]; dout.writeObject(new RemoteRef(p._getObjectId())); } else dout.writeObject(params[i]); } }
/** * Processes a request from a web browser (an ObjectImporter). */ public void doReply(InputStream in, OutputStream out, String cmd) throws IOException, BadHttpRequest { if (cmd.startsWith("POST /rmi ")) processRMI(in, out); else if (cmd.startsWith("POST /lookup ")) lookupName(cmd, in, out); else super.doReply(in, out, cmd); }
/** * Constructs a web server. * * @param port port number */ public AppletServer(int port) throws IOException, NotFoundException, CannotCompileException { this(ClassPool.getDefault(), new StubGenerator(), port); }
/** * Finds the object exported by a server with the specified name. * If the object is not found, this method returns null. * * @param name the name of the exported object. * @return the proxy object or null. */ public Object getObject(String name) { try { return lookupObject(name); } catch (ObjectNotFoundException e) { return null; } }
private AppletServer(ClassPool loader, StubGenerator gen, int port) throws IOException, NotFoundException, CannotCompileException { super(port); exportedNames = new Hashtable(); exportedObjects = new Vector(); stubGen = gen; addTranslator(loader, gen); }
private Object convertRvalue(Object rvalue) throws CannotCompileException { if (rvalue == null) return null; // the return type is void. String classname = rvalue.getClass().getName(); if (stubGen.isProxyClass(classname)) return new RemoteRef(exportObject(null, rvalue), classname); return rvalue; }
private void writeParameters(ObjectOutputStream dout, Object[] params) throws IOException { int n = params.length; dout.writeInt(n); for (int i = 0; i < n; ++i) if (params[i] instanceof Proxy) { Proxy p = (Proxy)params[i]; dout.writeObject(new RemoteRef(p._getObjectId())); } else dout.writeObject(params[i]); } }
/** * Processes a request from a web browser (an ObjectImporter). */ @Override public void doReply(InputStream in, OutputStream out, String cmd) throws IOException, BadHttpRequest { if (cmd.startsWith("POST /rmi ")) processRMI(in, out); else if (cmd.startsWith("POST /lookup ")) lookupName(cmd, in, out); else super.doReply(in, out, cmd); }
/** * Constructs a web server. * * @param port port number */ public AppletServer(int port) throws IOException, NotFoundException, CannotCompileException { this(ClassPool.getDefault(), new StubGenerator(), port); }
public static Object forwardStatic(Object[] args, int identifier) throws RemoteException { throw new RemoteException("cannot call a static method."); } }
private CtClass[] toCtClass(Class<?>[] rtclasses) throws NotFoundException { int n = rtclasses.length; CtClass[] ctclasses = new CtClass[n]; for (int i = 0; i < n; ++i) ctclasses[i] = toCtClass(rtclasses[i]); return ctclasses; }
public Object forward(Object[] args, int identifier) { return importer.call(objectId, identifier, args); }
/** * Finds the object exported by a server with the specified name. * If the object is not found, this method returns null. * * @param name the name of the exported object. * @return the proxy object or null. */ public Object getObject(String name) { try { return lookupObject(name); } catch (ObjectNotFoundException e) { return null; } }
private AppletServer(ClassPool loader, StubGenerator gen, int port) throws IOException, NotFoundException, CannotCompileException { super(port); exportedNames = new Hashtable<String,ExportedObject>(); exportedObjects = new Vector<ExportedObject>(); stubGen = gen; addTranslator(loader, gen); }
/** * Constructs a web server. * * @param port port number * @param src the source of classs files. */ public AppletServer(int port, ClassPool src) throws IOException, NotFoundException, CannotCompileException { this(new ClassPool(src), new StubGenerator(), port); }
/** * Constructs a web server. * * @param port port number * @param src the source of classs files. */ public AppletServer(int port, ClassPool src) throws IOException, NotFoundException, CannotCompileException { this(new ClassPool(src), new StubGenerator(), port); }