classUtils.javassist.sample.evolve
Class DemoServer
java.lang.Object
classUtils.javassist.web.Webserver
classUtils.javassist.sample.evolve.DemoServer
public class DemoServer
- extends Webserver
A web server for demonstrating class evolution. It must be
run with a DemoLoader.
If a html file /java.html is requested, this web server calls
WebPage.showAndRegister() for constructing the contents of that html file
So if a DemoLoader changes the definition of WebPage, then
the image of /java.html is also changed.
Note that WebPage is not an applet. It is rather
similar to a CGI script or a servlet. The web server never
sends the class file of WebPage to web browsers.
Furthermore, if a html file /update.html is requested, this web
server overwrites WebPage.class (class file) and calls update()
in VersionManager so that WebPage.class is loaded into the JVM
again. The new contents of WebPage.class are copied from
either WebPage.class.0 or WebPage.class.1.
Method Summary |
void |
doReply(java.io.InputStream in,
java.io.OutputStream out,
java.lang.String cmd)
Proceses a HTTP request from a client. |
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DemoServer
public DemoServer(int port)
throws java.io.IOException
- Throws:
java.io.IOException
main
public static void main(java.lang.String[] args)
throws java.io.IOException
- Throws:
java.io.IOException
doReply
public void doReply(java.io.InputStream in,
java.io.OutputStream out,
java.lang.String cmd)
throws java.io.IOException,
BadHttpRequest
- Description copied from class:
Webserver
- Proceses a HTTP request from a client.
- Overrides:
doReply
in class Webserver
out
- the output stream to a clientcmd
- the command received from a client
- Throws:
java.io.IOException
BadHttpRequest