xitiomet / placebohttp (http://openstatic.org/)

Embeded Http server for gcj/java applications. PlaceboHttp uses an automatic session management system, Treating each session as a HttpRequest queue.

Clone this repository (size: 135.2 KB): HTTPS / SSH
$ hg clone http://hg.openstatic.org/placebohttp
commit 18: 00cf4ae79f6b
parent 17: 8b48faa4e88d
branch: default
Added core server module
xitiomet
9 months ago
placebohttp / src / PlaceboBase.java
r18:00cf4ae79f6b 68 loc 2.0 KB embed / history / annotate / raw /
import org.openstatic.placebo.CoreServer;
import org.openstatic.placebo.ControlPanel;

public class PlaceboBase
{
    public static void help()
    {
        System.err.println("Openstatic.org HTTP Server");
        System.err.println("");
        System.err.println("  --debug                        Turn debugging output on.");
        System.err.println("  --root [path]                  Set webroot");
        System.err.println("  --port [port]                  Specify HTTP listening port");
        System.err.println("  --help                         display this menu");
        System.err.println("");
        System.err.println("");
    }
    
    public static void main(String[] args)
    {
        int http_port = 80;
        boolean debug = false;
        String web_root = "placebohttp.jar/www";
        boolean start_engine = true;
        
        for (int i = 0; i < args.length; i++)
        {
            String arg = args[i].toLowerCase();
            String arg_p1 = null;
            if (i + 1 < args.length)
            {
                arg_p1 = args[i+1];
            }
            
            if (arg.equals("--port"))
            {
                http_port = Integer.valueOf(arg_p1);
            }

            if (arg.equals("--help"))
            {
                help();
                System.exit(0);
            }
            
            if (arg.equals("--root"))
            {
                web_root = arg_p1;
            }
            
            if (arg.equals("--debug"))
            {
                System.err.println("Openstatic.org Placebo HTTP Server");
                System.err.println("----------------------------------");
                debug = true;
            }
            
            if (arg.equals("--swing"))
            {
                ControlPanel cp = new ControlPanel();
            }
        }
        
        if (start_engine)
        {
            CoreServer.web_engine(http_port, web_root, debug);
        }
    }
    
}