| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectclassUtils.javassist.web.Webserver
public class Webserver
A web server for Javassist.
This enables a Java program to instrument class files loaded by web browsers for applets. Since the (standard) security manager does not allow an applet to create and use a class loader, instrumenting class files must be done by this web server.
Programmers can register a ClassPool object for
 instrumenting class files when they are sent to web browsers.
 
Note: although this class is included in the Javassist API, it is provided as a sample implementation of the web server using Javassist. Especially, there might be security flaws in this server. Please use this with YOUR OWN RISK.
| Field Summary | |
|---|---|
|  java.lang.String | debugDirIf this field is not null, the class files taken from ClassPoolare written out under the directory
 specified by this field. | 
|  java.lang.String | htmlfileBaseThe top directory of html (and .gif, .class, ...) files. | 
| Constructor Summary | |
|---|---|
| Webserver(int port)Constructs a web server. | |
| Webserver(java.lang.String port)Constructs a web server. | |
| Method Summary | |
|---|---|
|  void | doReply(java.io.InputStream in,
        java.io.OutputStream out,
        java.lang.String cmd)Proceses a HTTP request from a client. | 
|  void | end()Closes the socket. | 
|  void | logging(java.lang.String msg)Prints a log message. | 
|  void | logging(java.lang.String msg1,
        java.lang.String msg2)Prints a log message. | 
|  void | logging(java.lang.String msg1,
        java.lang.String msg2,
        java.lang.String msg3)Prints a log message. | 
|  void | logging2(java.lang.String msg)Prints a log message with indentation. | 
| static void | main(java.lang.String[] args)Starts a web server. | 
|  void | run()Begins the HTTP service. | 
|  void | setClassPool(ClassPool loader)Requests the web server to use the specified ClassPoolobject for obtaining a class file. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public java.lang.String debugDir
ClassPool are written out under the directory
 specified by this field.  The directory name must not end
 with a directory separator.
public java.lang.String htmlfileBase
If the given URL indicates a class file and the class file
 is not found under the directory specified by this variable,
 then Class.getResourceAsStream() is called
 for searching the Java class paths.
| Constructor Detail | 
|---|
public Webserver(java.lang.String port)
          throws java.io.IOException
port - port number
java.io.IOException
public Webserver(int port)
          throws java.io.IOException
port - port number
java.io.IOException| Method Detail | 
|---|
public static void main(java.lang.String[] args)
                 throws java.io.IOException
java.io.IOExceptionpublic void setClassPool(ClassPool loader)
ClassPool object for obtaining a class file.
public void end()
         throws java.io.IOException
java.io.IOExceptionpublic void logging(java.lang.String msg)
public void logging(java.lang.String msg1,
                    java.lang.String msg2)
public void logging(java.lang.String msg1,
                    java.lang.String msg2,
                    java.lang.String msg3)
public void logging2(java.lang.String msg)
public void run()
public void doReply(java.io.InputStream in,
                    java.io.OutputStream out,
                    java.lang.String cmd)
             throws java.io.IOException,
                    BadHttpRequest
out - the output stream to a clientcmd - the command received from a client
java.io.IOException
BadHttpRequest| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||