diff --git a/pom.xml b/pom.xml index 93e626c..3633259 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,10 @@ + 4.0.0 com.dd LuliChat - war + jar 1.0-SNAPSHOT LuliChat Maven Webapp http://maven.apache.org @@ -11,14 +12,29 @@ UTF-8 + 2.2-SNAPSHOT - + + org.nutz + nutzboot-starter-jetty + ${nutzboot-version} + + + org.nutz + nutzboot-starter-nutz-mvc + ${nutzboot-version} + + + org.nutz + nutzboot-starter-shiro + ${nutzboot-version} + org.nutz - nutz - 1.r.63.r2 + nutzboot-starter-freemarker + ${nutzboot-version} @@ -26,18 +42,6 @@ mysql-connector-java 5.1.40 - - javax.servlet - javax.servlet-api - 3.1.0 - provided - - - - com.alibaba - druid - 1.1.5 - log4j log4j @@ -49,12 +53,16 @@ 1.7.21 test - - org.freemarker - freemarker - 2.3.26-incubating + com.alibaba + druid + 1.1.5 + + + + + org.t-io @@ -78,47 +86,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - org.nutz - nutz-plugins-views - 1.r.62 + commons-logging + commons-logging + 1.1.3 + junit junit 4.12 - - org.nutz - nutz-integration-shiro - 1.r.60 - - - org.apache.shiro - shiro-all - 1.4.0 - - - ehcache-core - net.sf.ehcache - - - - - org.apache.shiro - shiro-core - 1.4.0 - - - org.apache.shiro - shiro-web - 1.4.0 - - - commons-logging - commons-logging - 1.1.3 - + @@ -143,23 +153,6 @@ - - - nutz - https://jfrog.nutz.cn/artifactory/jcenter - - - nutz-snapshots - https://jfrog.nutz.cn/artifactory/snapshots - - true - always - - - false - - - @@ -177,4 +170,24 @@ + + + nutz + http://jfrog.nutz.cn/artifactory/libs-release + + false + + + + nutz-snapshots + http://jfrog.nutz.cn/artifactory/snapshots + + true + always + + + false + + + diff --git a/src/main/java/com/dd/MainLauncher.java b/src/main/java/com/dd/MainLauncher.java new file mode 100644 index 0000000..44979a3 --- /dev/null +++ b/src/main/java/com/dd/MainLauncher.java @@ -0,0 +1,13 @@ +package com.dd; + +import org.nutz.boot.NbApp; +import org.nutz.ioc.loader.annotation.IocBean; + +@IocBean +public class MainLauncher { + + public static void main(String[] args) { + new NbApp().setMainClass(MainModule.class).setPrintProcDoc(true).run(); + } + +} diff --git a/src/main/java/com/dd/MainModule.java b/src/main/java/com/dd/MainModule.java index 4fd9ddd..3968a64 100644 --- a/src/main/java/com/dd/MainModule.java +++ b/src/main/java/com/dd/MainModule.java @@ -1,19 +1,11 @@ package com.dd; -import com.dd.setup.MySetup; -import org.nutz.integration.shiro.ShiroSessionProvider; +import com.dd.setup.InitSetup; import org.nutz.mvc.annotation.*; -import org.nutz.mvc.ioc.provider.ComboIocProvider; -import org.nutz.plugins.view.freemarker.FreemarkerViewMaker; -@Modules(scanPackage = true) -@SetupBy(MySetup.class) -@SessionBy(ShiroSessionProvider.class) +@SetupBy(InitSetup.class) +//@SessionBy(ShiroSessionProvider.class) @Encoding(input = "UTF-8", output = "UTF-8") -@IocBy(type = ComboIocProvider.class, - args = {"*js", "ioc/", "*anno", "com.dd"}) //@Views(DDView.class) -@Views(FreemarkerViewMaker.class) -@Fail("json") public class MainModule { } \ No newline at end of file diff --git a/src/main/java/com/dd/controller/IndexController.java b/src/main/java/com/dd/controller/IndexController.java new file mode 100644 index 0000000..a3917f0 --- /dev/null +++ b/src/main/java/com/dd/controller/IndexController.java @@ -0,0 +1,31 @@ +package com.dd.controller; + +import com.dd.mvc.Response; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; + +@IocBean +@At("/") +public class IndexController { + + @At + @Ok("fm:/login") + public Object login(){ + return NutMap.NEW(); + } + + @At + @Ok("fm:/chat") + public Object chat(){ + return NutMap.NEW(); + } + + @At + @Ok("fm:/find") + public Object find(){ + return Response.ok(); + } + +} diff --git a/src/main/java/com/dd/controller/TestController.java b/src/main/java/com/dd/controller/TestController.java new file mode 100644 index 0000000..975995a --- /dev/null +++ b/src/main/java/com/dd/controller/TestController.java @@ -0,0 +1,35 @@ +package com.dd.controller; + +import com.dd.mvc.Response; +import org.apache.shiro.web.session.HttpServletSession; +import org.nutz.ioc.impl.PropertiesProxy; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; + +import javax.servlet.http.HttpSession; + +@IocBean +@At("/test") +public class TestController { + + @Inject + private PropertiesProxy conf; + + + @At("/test") + @Ok("json") + public Object test(){ + return NutMap.NEW().setv("test","test"); + } + + + @At("/test2") + @Ok("fm:test") + public Object test2(HttpSession servletSession){ + servletSession.setAttribute("name","Wendal"); + return Response.ok().setv("hello","hello"); + } +} diff --git a/src/main/java/com/dd/controller/UserController.java b/src/main/java/com/dd/controller/UserController.java index de5f7d7..a2e6635 100644 --- a/src/main/java/com/dd/controller/UserController.java +++ b/src/main/java/com/dd/controller/UserController.java @@ -657,6 +657,11 @@ public Object random(){ return str; } + @At("/login") + @Ok("fm:/login") + public Object login(){ + return ""; + } // @At // @Ok("fm:/user/hello") diff --git a/src/main/java/com/dd/setup/MySetup.java b/src/main/java/com/dd/setup/InitSetup.java similarity index 94% rename from src/main/java/com/dd/setup/MySetup.java rename to src/main/java/com/dd/setup/InitSetup.java index 97a362f..53bad06 100644 --- a/src/main/java/com/dd/setup/MySetup.java +++ b/src/main/java/com/dd/setup/InitSetup.java @@ -13,7 +13,8 @@ import java.io.IOException; -public class MySetup implements Setup{ + +public class InitSetup implements Setup{ Log log = Logs.get(); @Override @@ -26,5 +27,6 @@ public void init(NutConfig nc) { @Override public void destroy(NutConfig nc) { + } } diff --git a/src/main/java/com/dd/socket/SocketServer.java b/src/main/java/com/dd/socket/SocketServer.java index 91f4104..e84d5b2 100644 --- a/src/main/java/com/dd/socket/SocketServer.java +++ b/src/main/java/com/dd/socket/SocketServer.java @@ -26,7 +26,7 @@ public void start(){ IWsMsgHandler accepter = getIoc().get(IWsMsgHandler.class, "accepter"); PropertiesProxy conf = getIoc().get(PropertiesProxy.class, "conf"); int port = 5210; - port = Integer.valueOf( conf.get("tio.port")); + port = Integer.valueOf( conf.get("websocket.port")); try { WsServerStarter wsServerStarter = new WsServerStarter(port, accepter); groupContext= wsServerStarter.getServerGroupContext(); diff --git a/src/main/resources/config/application.properties b/src/main/resources/config/application.properties deleted file mode 100644 index cc07414..0000000 --- a/src/main/resources/config/application.properties +++ /dev/null @@ -1 +0,0 @@ -tio.port=5210 \ No newline at end of file diff --git a/src/main/resources/config/db.properties b/src/main/resources/config/db.properties index 18b28af..b651566 100644 --- a/src/main/resources/config/db.properties +++ b/src/main/resources/config/db.properties @@ -1,5 +1,5 @@ #Test Server -db.url=jdbc:mysql://127.0.0.1/mychat?useOldAliasMetadataBehavior=true&useUnicode=true&characterEncoding=utf8 +db.url=jdbc:mysql://rm-uf6wfchh87fcd6m46o.mysql.rds.aliyuncs.com/mychat?useOldAliasMetadataBehavior=true&useUnicode=true&characterEncoding=utf8 db.username=root db.password=Adminhuage1 db.validationQuery=select 1 diff --git a/src/main/resources/ioc/conf.js b/src/main/resources/ioc/conf.js index b3c0014..2f130f3 100644 --- a/src/main/resources/ioc/conf.js +++ b/src/main/resources/ioc/conf.js @@ -1,41 +1,9 @@ var ioc = { - conf : { - type : "org.nutz.ioc.impl.PropertiesProxy", - fields : { - paths : [ "config/" ] - } - }, - siteConf : { type : "org.nutz.ioc.impl.PropertiesProxy", fields : { utf8 : false, paths : [ "website.properties" ] } - }, - currentTime : { - type : "org.nutz.plugins.view.freemarker.directive.CurrentTimeDirective" - }, - configuration : { - type : "freemarker.template.Configuration" - }, - freeMarkerConfigurer : { - type : "org.nutz.plugins.view.freemarker.FreeMarkerConfigurer", - events : { - create : 'init' - }, - args : [ { - refer : "configuration" - }, { - app : '$servlet' - }, "/", ".html", { - refer : "freemarkerDirectiveFactory" - } ] - }, - freemarkerDirectiveFactory : { - type : "org.nutz.plugins.view.freemarker.FreemarkerDirectiveFactory", - fields : { - freemarker : 'org/nutz/plugins/view/freemarker/freemarker.properties', - } } } \ No newline at end of file diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties index e68edb3..1e1e049 100644 --- a/src/main/resources/log4j.properties +++ b/src/main/resources/log4j.properties @@ -5,7 +5,12 @@ log4j.logger.org.nutz.ioc =debug log4j.logger.freemarker =debug log4j.logger.org.apache.commons =debug log4j.logger.me.zouooh.mvc.quartz.QuartzIocLoader =debug -log4j.logger.org.nutz.mvc.impl.Loadings =debug +log4j.logger.org.nutz.mvc.impl.Loadings =debug +log4j.logger.org.eclipse.jetty=error +log4j.logger.org.eclipse.jetty.util.thread=error +log4j.logger.org.apache.commons.beanutils.converters=error +log4j.logger.org.eclipse.jetty.util=error + log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout diff --git a/src/main/resources/shiro.ini b/src/main/resources/shiro.ini index 289a0d2..13f29c9 100644 --- a/src/main/resources/shiro.ini +++ b/src/main/resources/shiro.ini @@ -33,14 +33,16 @@ user_realm.cacheManager = $cacheManager #mis authc = com.dd.filter.AuthenticationFilter -authc.loginUrl = /login.html -authc.successUrl = /chat.html +authc.loginUrl = /login +authc.successUrl = /chat authc.failureKeyAttribute=shiroLoginFailure [urls] /user/registry = anon +/login = anon /login.html = anon /user/login = anon +/test/** = anon /css/** = anon /js/** = anon /img/** = anon diff --git a/src/main/webapp/css/menu.css b/src/main/resources/static/css/menu.css similarity index 100% rename from src/main/webapp/css/menu.css rename to src/main/resources/static/css/menu.css diff --git a/src/main/webapp/img/load.gif b/src/main/resources/static/img/load.gif similarity index 100% rename from src/main/webapp/img/load.gif rename to src/main/resources/static/img/load.gif diff --git a/src/main/webapp/img/load.png b/src/main/resources/static/img/load.png similarity index 100% rename from src/main/webapp/img/load.png rename to src/main/resources/static/img/load.png diff --git a/src/main/webapp/img/photo.png b/src/main/resources/static/img/photo.png similarity index 100% rename from src/main/webapp/img/photo.png rename to src/main/resources/static/img/photo.png diff --git a/src/main/webapp/imgs/1.jpg b/src/main/resources/static/imgs/1.jpg similarity index 100% rename from src/main/webapp/imgs/1.jpg rename to src/main/resources/static/imgs/1.jpg diff --git a/src/main/webapp/imgs/10.jpg b/src/main/resources/static/imgs/10.jpg similarity index 100% rename from src/main/webapp/imgs/10.jpg rename to src/main/resources/static/imgs/10.jpg diff --git a/src/main/webapp/imgs/11.jpg b/src/main/resources/static/imgs/11.jpg similarity index 100% rename from src/main/webapp/imgs/11.jpg rename to src/main/resources/static/imgs/11.jpg diff --git a/src/main/webapp/imgs/12.jpg b/src/main/resources/static/imgs/12.jpg similarity index 100% rename from src/main/webapp/imgs/12.jpg rename to src/main/resources/static/imgs/12.jpg diff --git a/src/main/webapp/imgs/13.jpg b/src/main/resources/static/imgs/13.jpg similarity index 100% rename from src/main/webapp/imgs/13.jpg rename to src/main/resources/static/imgs/13.jpg diff --git a/src/main/webapp/imgs/14.jpg b/src/main/resources/static/imgs/14.jpg similarity index 100% rename from src/main/webapp/imgs/14.jpg rename to src/main/resources/static/imgs/14.jpg diff --git a/src/main/webapp/imgs/15.jpg b/src/main/resources/static/imgs/15.jpg similarity index 100% rename from src/main/webapp/imgs/15.jpg rename to src/main/resources/static/imgs/15.jpg diff --git a/src/main/webapp/imgs/2.jpg b/src/main/resources/static/imgs/2.jpg similarity index 100% rename from src/main/webapp/imgs/2.jpg rename to src/main/resources/static/imgs/2.jpg diff --git a/src/main/webapp/imgs/3.jpg b/src/main/resources/static/imgs/3.jpg similarity index 100% rename from src/main/webapp/imgs/3.jpg rename to src/main/resources/static/imgs/3.jpg diff --git a/src/main/webapp/imgs/4.jpg b/src/main/resources/static/imgs/4.jpg similarity index 100% rename from src/main/webapp/imgs/4.jpg rename to src/main/resources/static/imgs/4.jpg diff --git a/src/main/webapp/imgs/5.jpg b/src/main/resources/static/imgs/5.jpg similarity index 100% rename from src/main/webapp/imgs/5.jpg rename to src/main/resources/static/imgs/5.jpg diff --git a/src/main/webapp/imgs/6.jpg b/src/main/resources/static/imgs/6.jpg similarity index 100% rename from src/main/webapp/imgs/6.jpg rename to src/main/resources/static/imgs/6.jpg diff --git a/src/main/webapp/imgs/7.jpg b/src/main/resources/static/imgs/7.jpg similarity index 100% rename from src/main/webapp/imgs/7.jpg rename to src/main/resources/static/imgs/7.jpg diff --git a/src/main/webapp/imgs/8.jpg b/src/main/resources/static/imgs/8.jpg similarity index 100% rename from src/main/webapp/imgs/8.jpg rename to src/main/resources/static/imgs/8.jpg diff --git a/src/main/webapp/imgs/9.jpg b/src/main/resources/static/imgs/9.jpg similarity index 100% rename from src/main/webapp/imgs/9.jpg rename to src/main/resources/static/imgs/9.jpg diff --git a/src/main/webapp/imgs/java.jpg b/src/main/resources/static/imgs/java.jpg similarity index 100% rename from src/main/webapp/imgs/java.jpg rename to src/main/resources/static/imgs/java.jpg diff --git a/src/main/webapp/imgs/laotie.jpg b/src/main/resources/static/imgs/laotie.jpg similarity index 100% rename from src/main/webapp/imgs/laotie.jpg rename to src/main/resources/static/imgs/laotie.jpg diff --git a/src/main/webapp/imgs/user.png b/src/main/resources/static/imgs/user.png similarity index 100% rename from src/main/webapp/imgs/user.png rename to src/main/resources/static/imgs/user.png diff --git a/src/main/webapp/imgs/wendal.jpg b/src/main/resources/static/imgs/wendal.jpg similarity index 100% rename from src/main/webapp/imgs/wendal.jpg rename to src/main/resources/static/imgs/wendal.jpg diff --git a/src/main/webapp/js/WebSocketMain.swf b/src/main/resources/static/js/WebSocketMain.swf similarity index 100% rename from src/main/webapp/js/WebSocketMain.swf rename to src/main/resources/static/js/WebSocketMain.swf diff --git a/src/main/webapp/js/common.js b/src/main/resources/static/js/common.js similarity index 100% rename from src/main/webapp/js/common.js rename to src/main/resources/static/js/common.js diff --git a/src/main/webapp/js/contextmenu.js b/src/main/resources/static/js/contextmenu.js similarity index 100% rename from src/main/webapp/js/contextmenu.js rename to src/main/resources/static/js/contextmenu.js diff --git a/src/main/webapp/js/handler.js b/src/main/resources/static/js/handler.js similarity index 100% rename from src/main/webapp/js/handler.js rename to src/main/resources/static/js/handler.js diff --git a/src/main/webapp/js/hgUtils.js b/src/main/resources/static/js/hgUtils.js similarity index 100% rename from src/main/webapp/js/hgUtils.js rename to src/main/resources/static/js/hgUtils.js diff --git a/src/main/webapp/js/jquery-1.11.1.js b/src/main/resources/static/js/jquery-1.11.1.js similarity index 100% rename from src/main/webapp/js/jquery-1.11.1.js rename to src/main/resources/static/js/jquery-1.11.1.js diff --git a/src/main/webapp/js/menu.js b/src/main/resources/static/js/menu.js similarity index 100% rename from src/main/webapp/js/menu.js rename to src/main/resources/static/js/menu.js diff --git a/src/main/webapp/js/socket.js b/src/main/resources/static/js/socket.js similarity index 100% rename from src/main/webapp/js/socket.js rename to src/main/resources/static/js/socket.js diff --git a/src/main/webapp/js/swfobject.js b/src/main/resources/static/js/swfobject.js similarity index 100% rename from src/main/webapp/js/swfobject.js rename to src/main/resources/static/js/swfobject.js diff --git a/src/main/webapp/js/web_socket.js b/src/main/resources/static/js/web_socket.js similarity index 100% rename from src/main/webapp/js/web_socket.js rename to src/main/resources/static/js/web_socket.js diff --git a/src/main/webapp/json/getList.json b/src/main/resources/static/json/getList.json similarity index 100% rename from src/main/webapp/json/getList.json rename to src/main/resources/static/json/getList.json diff --git a/src/main/webapp/json/getMembers.json b/src/main/resources/static/json/getMembers.json similarity index 100% rename from src/main/webapp/json/getMembers.json rename to src/main/resources/static/json/getMembers.json diff --git a/src/main/webapp/layim-v3.7.5/dist/css/layui.css b/src/main/resources/static/layim-v3.7.5/dist/css/layui.css similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/layui.css rename to src/main/resources/static/layim-v3.7.5/dist/css/layui.css diff --git a/src/main/webapp/layim-v3.7.5/dist/css/layui.mobile.css b/src/main/resources/static/layim-v3.7.5/dist/css/layui.mobile.css similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/layui.mobile.css rename to src/main/resources/static/layim-v3.7.5/dist/css/layui.mobile.css diff --git a/src/main/webapp/layim-v3.7.5/dist/css/modules/code.css b/src/main/resources/static/layim-v3.7.5/dist/css/modules/code.css similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/modules/code.css rename to src/main/resources/static/layim-v3.7.5/dist/css/modules/code.css diff --git a/src/main/webapp/layim-v3.7.5/dist/css/modules/laydate/default/laydate.css b/src/main/resources/static/layim-v3.7.5/dist/css/modules/laydate/default/laydate.css similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/modules/laydate/default/laydate.css rename to src/main/resources/static/layim-v3.7.5/dist/css/modules/laydate/default/laydate.css diff --git a/src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/icon-ext.png b/src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/icon-ext.png similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/icon-ext.png rename to src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/icon-ext.png diff --git a/src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/icon.png b/src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/icon.png similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/icon.png rename to src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/icon.png diff --git a/src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/layer.css b/src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/layer.css similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/layer.css rename to src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/layer.css diff --git a/src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/loading-0.gif b/src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/loading-0.gif similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/loading-0.gif rename to src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/loading-0.gif diff --git a/src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/loading-1.gif b/src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/loading-1.gif similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/loading-1.gif rename to src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/loading-1.gif diff --git a/src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/loading-2.gif b/src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/loading-2.gif similarity index 100% rename from src/main/webapp/layim-v3.7.5/dist/css/modules/layer/default/loading-2.gif rename to src/main/resources/static/layim-v3.7.5/dist/css/modules/layer/default/loading-2.gif diff --git a/src/main/webapp/layim-v3.7.5/dist/css/modules/layim/html/chatlog.html b/src/main/resources/static/layim-v3.7.5/dist/css/modules/layim/html/chatlog.html similarity index 81% rename from src/main/webapp/layim-v3.7.5/dist/css/modules/layim/html/chatlog.html rename to src/main/resources/static/layim-v3.7.5/dist/css/modules/layim/html/chatlog.html index ae6f62a..ae0c253 100644 --- a/src/main/webapp/layim-v3.7.5/dist/css/modules/layim/html/chatlog.html +++ b/src/main/resources/static/layim-v3.7.5/dist/css/modules/layim/html/chatlog.html @@ -4,9 +4,9 @@ 聊天记录 - - - + + + @@ -20,9 +20,9 @@ @@ -30,7 +30,7 @@ 上述模版采用了 laytpl 语法,不了解的同学可以去看下文档:http://www.layui.com/doc/modules/laytpl.html --> - + + + - - - - + + + + + + + -
当前在线人数:
+
当前在线人数:
+