Skip to content

Commit

Permalink
update:NutzBoot版本. fix:issues #5
Browse files Browse the repository at this point in the history
  • Loading branch information
EggsBlue committed Feb 5, 2018
1 parent 0bcf014 commit c6c9bc1
Show file tree
Hide file tree
Showing 178 changed files with 250 additions and 295 deletions.
155 changes: 84 additions & 71 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,47 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.dd</groupId>
<artifactId>LuliChat</artifactId>
<packaging>war</packaging>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>LuliChat Maven Webapp</name>
<url>http://maven.apache.org</url>

<properties>
<!-- UTF8大法好 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<nutzboot-version>2.2-SNAPSHOT</nutzboot-version>
</properties>

<dependencies>
<!-- 核心jar -->
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-jetty</artifactId>
<version>${nutzboot-version}</version>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-nutz-mvc</artifactId>
<version>${nutzboot-version}</version>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-shiro</artifactId>
<version>${nutzboot-version}</version>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz</artifactId>
<version>1.r.63.r2</version>
<artifactId>nutzboot-starter-freemarker</artifactId>
<version>${nutzboot-version}</version>
</dependency>
<!-- mysql驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- Druid连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
Expand All @@ -49,12 +53,16 @@
<version>1.7.21</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.26-incubating</version>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.5</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.freemarker</groupId>-->
<!--<artifactId>freemarker</artifactId>-->
<!--<version>2.3.26-incubating</version>-->
<!--</dependency>-->

<dependency>
<groupId>org.t-io</groupId>
Expand All @@ -78,47 +86,49 @@
<!--<version>1.r.57</version>-->
<!--</dependency>-->

<!--<dependency>-->
<!--<groupId>org.nutz</groupId>-->
<!--<artifactId>nutz-plugins-views</artifactId>-->
<!--<version>1.r.63.r5</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.nutz</groupId>-->
<!--<artifactId>nutz-integration-shiro</artifactId>-->
<!--<version>1.r.60</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.shiro</groupId>-->
<!--<artifactId>shiro-all</artifactId>-->
<!--<version>1.4.0</version>-->
<!--<exclusions>-->
<!--<exclusion>-->
<!--<artifactId>ehcache-core</artifactId>-->
<!--<groupId>net.sf.ehcache</groupId>-->
<!--</exclusion>-->
<!--</exclusions>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.shiro</groupId>-->
<!--<artifactId>shiro-core</artifactId>-->
<!--<version>1.4.0</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.shiro</groupId>-->
<!--<artifactId>shiro-web</artifactId>-->
<!--<version>1.4.0</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz-plugins-views</artifactId>
<version>1.r.62</version>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz-integration-shiro</artifactId>
<version>1.r.60</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-all</artifactId>
<version>1.4.0</version>
<exclusions>
<exclusion>
<artifactId>ehcache-core</artifactId>
<groupId>net.sf.ehcache</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>

<!--<dependency>-->
<!--<groupId>org.springframework</groupId>-->
<!--<artifactId>spring-aop</artifactId>-->
Expand All @@ -143,23 +153,6 @@
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>nutz</id>
<url>https://jfrog.nutz.cn/artifactory/jcenter</url>
</repository>
<repository>
<id>nutz-snapshots</id>
<url>https://jfrog.nutz.cn/artifactory/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>

<profiles>
<profile>
Expand All @@ -177,4 +170,24 @@
</profile>
</profiles>

<repositories>
<repository>
<id>nutz</id>
<url>http://jfrog.nutz.cn/artifactory/libs-release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>nutz-snapshots</id>
<url>http://jfrog.nutz.cn/artifactory/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
</project>
13 changes: 13 additions & 0 deletions src/main/java/com/dd/MainLauncher.java
Original file line number Diff line number Diff line change
@@ -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();
}

}
14 changes: 3 additions & 11 deletions src/main/java/com/dd/MainModule.java
Original file line number Diff line number Diff line change
@@ -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 {
}
31 changes: 31 additions & 0 deletions src/main/java/com/dd/controller/IndexController.java
Original file line number Diff line number Diff line change
@@ -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();
}

}
35 changes: 35 additions & 0 deletions src/main/java/com/dd/controller/TestController.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
5 changes: 5 additions & 0 deletions src/main/java/com/dd/controller/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,11 @@ public Object random(){
return str;
}

@At("/login")
@Ok("fm:/login")
public Object login(){
return "";
}

// @At
// @Ok("fm:/user/hello")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

import java.io.IOException;

public class MySetup implements Setup{

public class InitSetup implements Setup{
Log log = Logs.get();

@Override
Expand All @@ -26,5 +27,6 @@ public void init(NutConfig nc) {

@Override
public void destroy(NutConfig nc) {

}
}
2 changes: 1 addition & 1 deletion src/main/java/com/dd/socket/SocketServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/config/application.properties

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/config/db.properties
Original file line number Diff line number Diff line change
@@ -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

This comment has been minimized.

Copy link
@EggsBlue

EggsBlue Feb 5, 2018

Author Owner

我擦.....

db.validationQuery=select 1
Expand Down
Loading

0 comments on commit c6c9bc1

Please sign in to comment.