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();
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected byte[] | |
| protected Class | findClass(String
The binary name of the class name)Overrides java. Finds the specified class. |
| public int | |
| public String | |
| protected synchronized Class | loadClass(String
The binary name of the class name, boolean If resolve)true then resolve the classOverrides java. Requests the class loader to load a class. |
| public static void | |
| private byte[] | |
| public void |
| Viewer | back to summary |
|---|---|
| public Viewer(String host, int p) Constructs a viewer.
| |
| fetchClass | back to summary |
|---|---|
| protected byte[] fetchClass(String classname) throws Exception Fetches the class file of the specified class from the http server. | |
| findClass | back to summary |
|---|---|
| protected Class Overrides java. Finds the specified class. The implementation in this class
fetches the class from the http server. If the class is
either This method can be overridden by a subclass of
| |
| getPort | back to summary |
|---|---|
| public int getPort() Returns the port number. | |
| getServer | back to summary |
|---|---|
| public String getServer() Returns the server name. | |
| loadClass | back to summary |
|---|---|
| protected synchronized Class Overrides java. Requests the class loader to load a class.
| |
| main | back to summary |
|---|---|
| public static void main(String[] args) throws Throwable Starts a program. | |
| readStream | back to summary |
|---|---|
| private byte[] readStream(InputStream fin) throws IOException | |
| run | back to summary |
|---|---|
| public void run(String classname, String[] args) throws Throwable Invokes main() in the class specified by | |