org.naokishibata.generic
Class TinyHttpd

java.lang.Object
  extended by org.naokishibata.generic.TinyHttpd
All Implemented Interfaces:
java.lang.Runnable

public class TinyHttpd
extends java.lang.Object
implements java.lang.Runnable

This class implements a tiny HTTP server whose responses can be generated by a method given by a user.


Nested Class Summary
static interface TinyHttpd.Responder
          An interface for a callback method with which the server response can be generated by a method given by the user.
static class TinyHttpd.Response
          This class represents a HTTP response given by this server class
 
Constructor Summary
TinyHttpd(int port, TinyHttpd.Responder res)
           
 
Method Summary
static void main(java.lang.String[] args)
          An example implementation of an HTTP server.
 void run()
          Do not call
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TinyHttpd

public TinyHttpd(int port,
                 TinyHttpd.Responder res)
          throws java.io.IOException
Parameters:
port - The port number on which the created server will listen.
res - The responder method which will generate responses from the server.
Throws:
java.io.IOException
Method Detail

run

public void run()
Do not call

Specified by:
run in interface java.lang.Runnable

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
An example implementation of an HTTP server.

Throws:
java.lang.Exception