Compare commits
1 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
aa2e791cc1 |
34
pom.xml
34
pom.xml
|
|
@ -19,6 +19,40 @@
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
|
<version>8.1.8.v20121106</version>
|
||||||
|
<configuration>
|
||||||
|
<stopKey>stop</stopKey>
|
||||||
|
<stopPort>5200</stopPort>
|
||||||
|
<webAppConfig>
|
||||||
|
<contextPath>/</contextPath>
|
||||||
|
</webAppConfig>
|
||||||
|
<scanIntervalSeconds>5</scanIntervalSeconds>
|
||||||
|
<connectors>
|
||||||
|
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
|
||||||
|
<port>4200</port>
|
||||||
|
<maxIdleTime>60000</maxIdleTime>
|
||||||
|
</connector>
|
||||||
|
</connectors>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>1.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>java</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>cn.cloudowr.dict.Main</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,9 @@ public class Config extends com.jfinal.config.JFinalConfig{
|
||||||
public void afterJFinalStart() {
|
public void afterJFinalStart() {
|
||||||
// MongoCredential mongoCredential = MongoCredential.createCredential("root", "admin", "CoWR1111".toCharArray());
|
// MongoCredential mongoCredential = MongoCredential.createCredential("root", "admin", "CoWR1111".toCharArray());
|
||||||
// MongoClient mongoClient = new MongoClient(new ServerAddress("120.24.5.249", 3717), Arrays.asList(mongoCredential));
|
// MongoClient mongoClient = new MongoClient(new ServerAddress("120.24.5.249", 3717), Arrays.asList(mongoCredential));
|
||||||
MongoClientURI connectionString = new MongoClientURI("mongodb://root:CoWR1111@dds-wz9ceed1f19591041.mongodb.rds.aliyuncs.com:3717,dds-wz9ceed1f19591042.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-5320915");
|
MongoClientURI connectionString = new MongoClientURI("mongodb://root:CoWR1111@dds-wz9ceed1f19591041217-pub.mongodb.rds.aliyuncs.com:3717,dds-wz9ceed1f19591042677-pub.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-5320915");
|
||||||
MongoClient mongoClient = new MongoClient(connectionString);
|
MongoClient mongoClient = new MongoClient(connectionString);
|
||||||
mongoDatabase = mongoClient.getDatabase("gxhy");
|
mongoDatabase = mongoClient.getDatabase("dict");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MongoDatabase getMongoDataBase() {
|
public static MongoDatabase getMongoDataBase() {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.cloudowr.dict;
|
package cn.cloudowr.dict;
|
||||||
|
|
||||||
import cn.cloudowr.sdk.FastJSONUtil;
|
import cn.cloudowr.sdk.FastJSONUtil;
|
||||||
import cn.cloudowr.sdk.jfinal.AbsController;
|
|
||||||
import cn.cloudowr.sdk.jfinal.IdInterceptor;
|
import cn.cloudowr.sdk.jfinal.IdInterceptor;
|
||||||
|
import cn.cloudowr.sdk.jfinal.RestfulStyle;
|
||||||
import com.jfinal.aop.Before;
|
import com.jfinal.aop.Before;
|
||||||
import com.mongodb.client.FindIterable;
|
import com.mongodb.client.FindIterable;
|
||||||
import com.mongodb.client.MongoCollection;
|
import com.mongodb.client.MongoCollection;
|
||||||
|
|
@ -22,7 +22,7 @@ import java.util.regex.Pattern;
|
||||||
/**
|
/**
|
||||||
* Created by lyf66 on 2017/2/16.
|
* Created by lyf66 on 2017/2/16.
|
||||||
*/
|
*/
|
||||||
public class Controller extends AbsController {
|
public class Controller extends cn.cloudowr.sdk.jfinal.Controller implements RestfulStyle {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void index() {
|
public void index() {
|
||||||
|
|
@ -322,7 +322,7 @@ public class Controller extends AbsController {
|
||||||
renderJson("result", result.getDeletedCount() == 1);
|
renderJson("result", result.getDeletedCount() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MongoCollection<Document> getCollection() {
|
private MongoCollection<Document> getCollection() {
|
||||||
MongoDatabase mongoDataBase = Config.getMongoDataBase();
|
MongoDatabase mongoDataBase = Config.getMongoDataBase();
|
||||||
MongoCollection<Document> collection = mongoDataBase.getCollection("dict");
|
MongoCollection<Document> collection = mongoDataBase.getCollection("dict");
|
||||||
return collection;
|
return collection;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue