diff --git a/pom.xml b/pom.xml
index 62c4e32..d96e3ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,8 +7,13 @@
cn.cloudowr
dict
1.0-SNAPSHOT
- war
+ jar
+
+
+ ${basedir}/src/main/webapp
+
+
org.apache.maven.plugins
@@ -53,6 +58,19 @@
cn.cloudowr.dict.Main
+
+ maven-assembly-plugin
+
+
+
+ cn.cloudowr.dict.Main
+
+
+
+ jar-with-dependencies
+
+
+
@@ -62,10 +80,21 @@
3.0
- com.jfinal
+ org.eclipse.jetty
jetty-server
- 8.1.8
+ 9.4.1.v20170120
+
+ org.eclipse.jetty
+ jetty-servlet
+ 9.4.1.v20170120
+
+
+ org.eclipse.jetty
+ jetty-webapp
+ 9.4.1.v20170120
+
+
@@ -85,8 +114,6 @@
cn.cloudowr
sdk
1.4.16
- system
- ${basedir}/lib/sdk-1.4.16.jar
\ No newline at end of file
diff --git a/src/main/java/cn/cloudowr/dict/Main.java b/src/main/java/cn/cloudowr/dict/Main.java
index 3f21634..bd018a9 100644
--- a/src/main/java/cn/cloudowr/dict/Main.java
+++ b/src/main/java/cn/cloudowr/dict/Main.java
@@ -1,7 +1,13 @@
package cn.cloudowr.dict;
-import com.jfinal.core.JFinal;
+import com.jfinal.core.JFinalFilter;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.FilterHolder;
+import org.eclipse.jetty.webapp.WebAppContext;
+import javax.servlet.DispatcherType;
+import java.io.*;
+import java.util.EnumSet;
import java.util.Properties;
/**
@@ -15,21 +21,36 @@ public class Main {
public static int port;
public static String dabaseName;
private static int AppPort;
- public static void main(String[] args) {
+
+ public static void main(String[] args) throws IOException {
read();
- JFinal.start("src/main/webapp", AppPort, "/");
+ EnumSet all = EnumSet.of(DispatcherType.ASYNC, DispatcherType.ERROR,
+ DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST);
+ final Server server = new Server(AppPort);
+ try {
+ WebAppContext context = new WebAppContext("/", "/");
+ FilterHolder filter = new FilterHolder(new JFinalFilter());
+ filter.setInitParameter("configClass", "cn.cloudowr.dict.Config");
+ context.addFilter(filter, "/*", all);
+ server.setHandler(context);
+ server.start();
+ server.join();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
- public static void read(){
- try{
+
+ public static void read() {
+ try {
Properties pro = new Properties();
pro.load(Config.class.getResourceAsStream("/config.properties"));
username = pro.getProperty("username");
database = pro.getProperty("database");
password = pro.getProperty("password");
- host = pro.getProperty("host");
- port = Integer.parseInt(pro.getProperty("port"));
+ host = pro.getProperty("host");
+ port = Integer.parseInt(pro.getProperty("port"));
dabaseName = pro.getProperty("dabaseName");
- AppPort = Integer.parseInt(pro.getProperty("AppPort"));
+ AppPort = Integer.parseInt(pro.getProperty("AppPort"));
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
diff --git a/webDir/WEB-INF/web.xml b/webDir/WEB-INF/web.xml
new file mode 100644
index 0000000..2e5bc01
--- /dev/null
+++ b/webDir/WEB-INF/web.xml
@@ -0,0 +1,18 @@
+
+
+
+ cn.cloudowr.dict
+ com.jfinal.core.JFinalFilter
+
+ configClass
+ cn.cloudowr.dict.Config
+
+
+
+ cn.cloudowr.dict
+ /*
+
+
\ No newline at end of file