Skip to content

Commit

Permalink
finish invodke
Browse files Browse the repository at this point in the history
  • Loading branch information
Percy0601 committed May 27, 2015
0 parents commit 947a91f
Show file tree
Hide file tree
Showing 45 changed files with 1,555 additions and 0 deletions.
125 changes: 125 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
## .gitignore for Grails 1.2 and 1.3

# .gitignore for maven
target/
*.releaseBackup

# web application files
#/web-app/WEB-INF

# IDE support files
/.classpath
/.launch
/.project
/.settings
/*.launch
/*.tmproj
/ivy*
/eclipse

# default HSQL database files for production mode
/prodDb.*

# general HSQL database files
*Db.properties
*Db.script

# logs
/stacktrace.log
/test/reports
/logs
*.log

# project release file
/*.war

# plugin release file
/*.zip
/*.zip.sha1

# older plugin install locations
/plugins
/web-app/plugins
/web-app/WEB-INF/classes

# "temporary" build files
target/
out/

# other
*.iws

#.gitignore for java
*.class

# Package Files #
*.war
*.ear

## .gitignore for eclipse

*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath

## .gitignore for intellij

*.iml
*.ipr
*.iws
.idea/

## .gitignore for linux
.*
!.gitignore
*~

## .gitignore for windows

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

## .gitignore for mac os x

.DS_Store
.AppleDouble
.LSOverride
Icon


# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes
138 changes: 138 additions & 0 deletions boot-dubbo-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.creditease</groupId>
<artifactId>boot-dubbo</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>boot-dubbo-api</artifactId>
<name>boot-dubbo-api</name>
<url>http://maven.apache.org</url>
<properties>
<servlet.version>3.1.0</servlet.version>
<asm.version>5.0.3</asm.version>
<cglib.version>3.1</cglib.version>
<zookeeper.version>3.4.6</zookeeper.version>
</properties>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.8.4</version>
<exclusions>
<exclusion>
<artifactId>curator-framework</artifactId>
<groupId>org.apache.curator</groupId>
</exclusion>
<exclusion>
<artifactId>curator-client</artifactId>
<groupId>org.apache.curator</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>spring-web</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-core</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-context</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-aop</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>javassist</artifactId>
<groupId>org.javassist</groupId>
</exclusion>
<exclusion>
<artifactId>spring-expression</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>aopalliance</artifactId>
<groupId>aopalliance</groupId>
</exclusion>
<exclusion>
<artifactId>netty</artifactId>
<groupId>io.netty</groupId>
</exclusion>
<exclusion>
<artifactId>javax.servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
<artifactId>commons-pool</artifactId>
<groupId>commons-pool</groupId>
</exclusion>
<exclusion>
<artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.7.Final</version>
<exclusions>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.0.7.Final</version>
</dependency>
<!-- 如果要使用xml序列化 -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>3.0.7.Final</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>

</dependencies>
</project>
13 changes: 13 additions & 0 deletions boot-dubbo-api/src/main/java/boot/dubbo/api/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package boot.dubbo.api;

/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
18 changes: 18 additions & 0 deletions boot-dubbo-api/src/main/java/boot/dubbo/api/DemoService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package boot.dubbo.api;

import javax.ws.rs.Path;

import com.alibaba.dubbo.config.annotation.Service;

@Service(protocol = {"rest"}, group = "annotationConfig", validation = "true")
@Path("demo")
public interface DemoService {
/**
* 基本测试
*
* @param name
* @return
*/
String sayHello(String name);

}
14 changes: 14 additions & 0 deletions boot-dubbo-api/src/main/java/boot/dubbo/api/MyExceptionMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package boot.dubbo.api;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;

public class MyExceptionMapper implements ExceptionMapper<Exception> {

public Response toResponse(Exception e) {
return Response.status(Response.Status.OK)
.entity("{ex:'" + e.getMessage() + "'}")
.type(MediaType.APPLICATION_JSON).build();
}
}
42 changes: 42 additions & 0 deletions boot-dubbo-api/src/main/java/boot/dubbo/api/User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package boot.dubbo.api;

import java.io.Serializable;

import javax.xml.bind.annotation.XmlRootElement;

/**
* 用户
*
* @author percy
*
*/
@XmlRootElement
public class User implements Serializable {

private static final long serialVersionUID = 1L;
/**
* 用户标识
*/
private Integer id;
/**
* 用户姓名
*/
private String name;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

}
24 changes: 24 additions & 0 deletions boot-dubbo-api/src/main/java/boot/dubbo/api/UserService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package boot.dubbo.api;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("user")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public interface UserService {
/**
* 获取所有用户
*
* @return所有用户
*/
@GET
@Path("findAll")
List<User> findAll();

}
Loading

0 comments on commit 947a91f

Please sign in to comment.