@Override public MkContainer start(final int prt) throws IOException { if (this.port != 0) { throw new IllegalStateException( String.format( "already listening on port %d, use #stop() first", this.port ) ); } this.port = prt; this.gws = new GrizzlyWebServer(this.port); this.gws.addGrizzlyAdapter(this.adapter, new String[] {"/"}); this.gws.start(); Logger.info(this, "started on port #%s", prt); return this; }
ws.addGrizzlyAdapter(sa, mapping); ws.start();
GrizzlyWebServer ws = new GrizzlyWebServer("/var/www"); try { ServletAdapter sa = new ServletAdapter(); sa.setRootFolder("/Path/To/Exploded/War/File"); sa.setServlet(new MyServlet()); ws.addGrizzlyAdapter(sa); ws.start(); } catch (IOException ex) { // Something when wrong. }