1、bootstrap (start Service and Connector)
2、connector (build Server,create Httpprocessor and process HTTP request)
3、httpprocessor (establish Httprequest,Httpresponse,invoke Container to process Servlet)
staticresourceprocessor (process static resource)
4、httprequest,httpresponse (implement HttpServletRequest/Response)
5、container(load servlet,choose a servlet based on request)
Bootstrap
|- n -Service
|- n -Connector
|- 1 -Container
|- n -Servlet
Config config = new Config();
ServiceConfig sconfig = new ServiceConfig();
sconfig.connectorQueue.add(new Config.ConnectorConfig());
sconfig.JNettyBase = "/Users/webapps-basedir/";
sconfig.WebAppName = "transaction";
config.serviceConfig.add(sconfig);
Bootstrap bootstrap = new Bootstrap();
bootstrap.setConfig(config);
bootstrap.initialize();
bootstrap.start();
Config config = new Config();
ServiceConfig sconfig = new ServiceConfig();
//if you don't want to use WAR file, you could, alternatively , add a servlet like this.
sconfig.servletList.add(new Config.MappingData("name", "com.jnetty.jnetty.servlets.SessionServlet", "/session", 0));
//add a connector, default port is 8080
sconfig.connectorQueue.add(new Config.ConnectorConfig());
sconfig.JNettyBase = "/Users/webapps-basedir/";
sconfig.WebAppName = "transaction";
sconfig.staticResourceLoc = "/resources/";
config.serviceConfig.add(sconfig);
Bootstrap bootstrap = new Bootstrap();
bootstrap.setConfig(config);
bootstrap.initialize();
System.out.println(sconfig);//print config params
bootstrap.start();