| java.lang.Object java.lang.ClassLoader javassist.tools.web.Viewer
Viewer | public class Viewer extends ClassLoader (Code) | | A sample applet viewer.
This is a sort of applet viewer that can run any program even if
the main class is not a subclass of Applet .
This viewwer first calls main() in the main class.
To run, you should type:
% java javassist.tools.web.Viewer host port Main arg1, ...
This command calls Main.main() with arg1,...
All classes including Main are fetched from
a server http://host:port.
Only the class file for Viewer must exist
on a local file system at the client side; even other
javassist.* classes are not needed at the client side.
Viewer uses only Java core API classes.
Note: since a Viewer object is a class loader,
a program loaded by this object can call a method in Viewer .
For example, you can write something like this:
Viewer v = (Viewer)this.getClass().getClassLoader();
String port = v.getPort();
|
Constructor Summary | |
public | Viewer(String host, int p) Constructs a viewer. |
Method Summary | |
protected byte[] | fetchClass(String classname) Fetches the class file of the specified class from the http
server. | protected Class | findClass(String name) Finds the specified class. | public int | getPort() Returns the port number. | public String | getServer() Returns the server name. | protected synchronized Class | loadClass(String name, boolean resolve) Requests the class loader to load a class. | public static void | main(String[] args) Starts a program. | public void | run(String classname, String[] args) Invokes main() in the class specified by classname . |
Viewer | public Viewer(String host, int p)(Code) | | Constructs a viewer.
Parameters: host - server name Parameters: p - port number |
fetchClass | protected byte[] fetchClass(String classname) throws Exception(Code) | | Fetches the class file of the specified class from the http
server.
|
findClass | protected Class findClass(String name) throws ClassNotFoundException(Code) | | Finds the specified class. The implementation in this class
fetches the class from the http server. If the class is
either java.* , javax.* , or
Viewer , then it is loaded by the parent class
loader.
This method can be overridden by a subclass of
Viewer .
|
getPort | public int getPort()(Code) | | Returns the port number.
|
getServer | public String getServer()(Code) | | Returns the server name.
|
run | public void run(String classname, String[] args) throws Throwable(Code) | | Invokes main() in the class specified by classname .
Parameters: classname - executed class Parameters: args - the arguments passed to main() . |
Methods inherited from java.lang.ClassLoader | public synchronized void clearAssertionStatus()(Code)(Java Doc) final protected Class> defineClass(byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, java.nio.ByteBuffer b, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException(Code)(Java Doc) protected Class> findClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected String findLibrary(String libname)(Code)(Java Doc) final protected Class> findLoadedClass(String name)(Code)(Java Doc) protected URL findResource(String name)(Code)(Java Doc) protected Enumeration<URL> findResources(String name) throws IOException(Code)(Java Doc) final protected Class> findSystemClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected Package getPackage(String name)(Code)(Java Doc) protected Package[] getPackages()(Code)(Java Doc) final public ClassLoader getParent()(Code)(Java Doc) public URL getResource(String name)(Code)(Java Doc) public InputStream getResourceAsStream(String name)(Code)(Java Doc) public Enumeration<URL> getResources(String name) throws IOException(Code)(Java Doc) public static ClassLoader getSystemClassLoader()(Code)(Java Doc) public static URL getSystemResource(String name)(Code)(Java Doc) public static InputStream getSystemResourceAsStream(String name)(Code)(Java Doc) public static Enumeration<URL> getSystemResources(String name) throws IOException(Code)(Java Doc) public Class> loadClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected synchronized Class> loadClass(String name, boolean resolve) throws ClassNotFoundException(Code)(Java Doc) final protected void resolveClass(Class> c)(Code)(Java Doc) public synchronized void setClassAssertionStatus(String className, boolean enabled)(Code)(Java Doc) public synchronized void setDefaultAssertionStatus(boolean enabled)(Code)(Java Doc) public synchronized void setPackageAssertionStatus(String packageName, boolean enabled)(Code)(Java Doc) final protected void setSigners(Class> c, Object[] signers)(Code)(Java Doc)
|
|
|