hdtms/src/main/java/AjaxJettyLauncher.java

43 lines
963 B
Java
Raw Normal View History

2024-08-03 16:54:00 +08:00
2024-11-13 15:12:54 +08:00
import org.apache.commons.lang.StringUtils;
2024-08-03 16:54:00 +08:00
import org.mortbay.http.SocketListener;
import org.mortbay.jetty.Server;
public class AjaxJettyLauncher {
protected int port = 8088;
protected String contextName = "hdtms";
2024-11-13 15:12:54 +08:00
protected String deployPath = null;
2024-08-03 16:54:00 +08:00
public static void main(String[] args) throws Exception {
AjaxJettyLauncher jl = new AjaxJettyLauncher();
jl.run();
}
protected void init() {
}
protected void run() throws Exception {
Server server = new Server();
SocketListener listener = new SocketListener();
listener.setPort(getPort());
server.addListener(listener);
server.addWebApplication("/" + getContextName() , getDeployPath());
server.start();
}
protected int getPort() {
return port;
}
protected String getContextName() {
return contextName;
}
protected String getDeployPath() {
2024-11-13 15:12:54 +08:00
if (StringUtils.isEmpty(deployPath)) {
2024-08-03 16:54:00 +08:00
deployPath = "./target/" + contextName + "/";
}
return deployPath;
}
}