Startup Server
public static void main(String[] args) {
StartupServer startupServer = new StartupServer(8080);
List
protocols = new ArrayList<>();
protocols.add(newHttpServletProtocol());
for (AbstractProtocol protocol : protocols) {
startupServer.getProtocolHandlers().add(protocol);
startupServer.getServerListeners().add(protocol);
}
startupServer.start();
}
private static HttpServletProtocol newHttpServletProtocol(){
ServletContext servletContext = new ServletContext();
servletContext.addServlet("myHttpServlet",new MyHttpServlet())
.addMapping("/test/sayHello");
HttpServletProtocol protocol = new HttpServletProtocol(null, servletContext);
protocol.setMaxBufferBytes(1024 * 1024);//The upper limit of the output stream buffer each connection, good speed write large dots.