Created
March 28, 2013 01:33
-
-
Save linux-china/5259757 to your computer and use it in GitHub Desktop.
Nailgun servlet to start Nailgun server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.martiansoftware.nailgun.NGServer; | |
import javax.servlet.ServletConfig; | |
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServlet; | |
/** | |
* nailgun servlet | |
* | |
* @author linux_china | |
*/ | |
public class NailgunServlet extends HttpServlet { | |
/** | |
* start Nailgun Server | |
* | |
* @param config servlet config | |
* @throws ServletException servlet exception | |
*/ | |
public void init(ServletConfig config) throws ServletException { | |
super.init(config); | |
new Thread(new Runnable() { | |
@Override | |
public void run() { | |
try { | |
NGServer ngServer = new NGServer(); | |
ngServer.run(); | |
System.out.println("Nailgun started with listen port 2113."); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
}).start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maven dependency
web.xml modify