2024-12-18 10:38:31 +08:00
|
|
|
import com.dev.energy.client.utils.StringUtils;
|
2024-12-23 15:35:40 +08:00
|
|
|
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
import org.apache.log4j.PropertyConfigurator;
|
2024-12-18 10:38:31 +08:00
|
|
|
import org.mortbay.http.SocketListener;
|
|
|
|
|
import org.mortbay.jetty.Server;
|
|
|
|
|
|
|
|
|
|
public class AjaxJettyLauncher {
|
|
|
|
|
protected int port = 8080;
|
|
|
|
|
protected String contextName = "zwwms";
|
|
|
|
|
protected String deployPath = null;
|
2024-12-23 15:35:40 +08:00
|
|
|
private static Logger logger = Logger.getLogger(AjaxJettyLauncher.class);
|
2024-12-18 10:38:31 +08:00
|
|
|
public static void main(String[] args) throws Exception {
|
2024-12-23 15:35:40 +08:00
|
|
|
String currentDir = System.getProperty("user.dir");
|
2024-12-23 17:43:04 +08:00
|
|
|
logger.info("当前根目录是: " + currentDir);
|
2024-12-23 15:35:40 +08:00
|
|
|
PropertyConfigurator.configure("log4j.properties");
|
2025-02-05 15:48:44 +08:00
|
|
|
logger.error("JVM编码"+System.getProperty("file.encoding"));
|
2024-12-18 10:38:31 +08:00
|
|
|
AjaxJettyLauncher jl = new AjaxJettyLauncher();
|
|
|
|
|
jl.run();
|
2024-12-23 15:35:40 +08:00
|
|
|
|
2024-12-18 10:38:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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();
|
2024-12-23 15:35:40 +08:00
|
|
|
logger.error("1232221231");
|
2025-02-05 15:48:44 +08:00
|
|
|
logger.error("JVM编码"+System.getProperty("file.encoding"));
|
2024-12-18 10:38:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected int getPort() {
|
|
|
|
|
return port;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected String getContextName() {
|
|
|
|
|
return contextName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected String getDeployPath() {
|
|
|
|
|
if (StringUtils.isEmpty(deployPath)) {
|
|
|
|
|
deployPath = "./target/" + contextName + "/";
|
|
|
|
|
}
|
|
|
|
|
return deployPath;
|
|
|
|
|
}
|
|
|
|
|
}
|