Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
**/*.iml
.idea/
**/target/**/*
rop-client-js/**/*

**/*.iml
.idea/
**/target/**/*
rop-client-js/**/*
**/.project
**/.classpath
.project
**/.settings/**/*
106 changes: 106 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.rop</groupId>
<artifactId>rop-parent</artifactId>
<version>2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>rop parent</name>
<description>rest open platform</description>
<url>https://github.com/itstamen/rop</url>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<connection>scm:git:git://github.com/itstamen/rop.git</connection>
<developerConnection>scm:git:git://github.com/itstamen/rop.git</developerConnection>
<url>git://github.com/itstamen/rop.git</url>
</scm>

<developers>
<developer>
<id>stamen</id>
<name>stamen</name>
<email>itstamen@qq.com</email>
</developer>
</developers>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<charset>${file.encoding}</charset>
<encoding>${file.encoding}</encoding>
<docencoding>${file.encoding}</docencoding>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${file.encoding}</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>${file.encoding}</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<forkMode>once</forkMode>
<argLine>-Dfile.encoding=${file.encoding}</argLine>
<systemProperties>
<property>
<name>net.sourceforge.cobertura.datafile</name>
<value>target/cobertura/cobertura.ser</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<file.encoding>UTF-8</file.encoding>
<java.version>1.5</java.version>
</properties>

<modules>
<module>rop</module>
<module>rop-client</module>
<module>rop-core</module>
<module>rop-sample</module>
</modules>
</project>
2 changes: 2 additions & 0 deletions rop-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target/
/.settings/
115 changes: 115 additions & 0 deletions rop-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.rop</groupId>
<artifactId>rop-parent</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>

<artifactId>rop-client</artifactId>
<name>ropClient</name>
<packaging>jar</packaging>
<description>rest open platform</description>

<url>http://www.github.com</url>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<connection>scm:git:git@github.com:itstamen/rop.git</connection>
<developerConnection>scm:git:git@github.com:itstamen/rop.git</developerConnection>
<url>git@github.com:itstamen/rop.git</url>
</scm>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.rop</groupId>
<artifactId>rop-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<charset>${file.encoding}</charset>
<encoding>${file.encoding}</encoding>
<docencoding>${file.encoding}</docencoding>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${file.encoding}</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>${file.encoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<file.encoding>UTF-8</file.encoding>
<java.version>1.6</java.version>
<httpclient.version>4.3.2</httpclient.version>
<junit.version>4.12</junit.version>
</properties>
</project>
103 changes: 103 additions & 0 deletions rop-client/src/main/java/com/rop/client/ClientRequest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rop.client;

import java.io.IOException;

/**
* <pre>
* 每个请求对应一个ClientRequest对象
* </pre>
*
* @author 陈雄华
* @version 1.0
*/
public interface ClientRequest {

/**
* 设置http请求头信息
* @param name
* @param value
* @return ClientRequest
*/
ClientRequest setHeader(String name, String value);

/**
* 添加请求参数,默认需要签名,如果类已经标注了{@link com.rop.annotation.IgnoreSign}则始终不加入签名
* @param paramName
* @param paramValue
* @return ClientRequest
*/
ClientRequest addParam(String paramName,Object paramValue);

/**
* 添加请求参数,如果needSign=false表示不参于签名
* @param paramName
* @param paramValue
* @param needSign
* @return ClientRequest
*/
ClientRequest addParam(String paramName,Object paramValue,boolean needSign);

/**
* 清除参数列表
* @return ClientRequest
*/
ClientRequest clearParam();

/**
* 使用POST发起请求
* @param ropResponseClass
* @param methodName
* @param version
* @param <T>
* @return CompositeResponse
*/
<T> CompositeResponse<T> post(Class<T> ropResponseClass, String methodName, String version) throws IOException;

/**
* 直接使用 ropRequest发送请求
* @param ropRequest
* @param ropResponseClass
* @param methodName
* @param version
* @param <T>
* @return CompositeResponse
*/
<T> CompositeResponse<T> post(Object ropRequest, Class<T> ropResponseClass, String methodName, String version) throws IOException;

/**
* 使用GET发送服务请求
* @param ropResponseClass
* @param methodName
* @param version
* @param <T>
* @return CompositeResponse
*/
<T> CompositeResponse<T> get(Class<T> ropResponseClass, String methodName, String version) throws IOException;

/**
* 使用GET发送ropRequest的请求
* @param ropRequest
* @param ropResponseClass
* @param methodName
* @param version
* @param <T>
* @return CompositeResponse
*/
<T> CompositeResponse<T> get(Object ropRequest, Class<T> ropResponseClass, String methodName, String version) throws IOException;
}

27 changes: 27 additions & 0 deletions rop-client/src/main/java/com/rop/client/CommonConstant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rop.client;

/**
* @author : chenxh(quickselect@163.com)
* @date: 13-11-1
*/
public class CommonConstant {

public static final String ERROR_TOKEN = "@@$-ERROR_TOKEN$-@@";

public static final String SESSION_CHANGED = "@@SESSION_CHANGED__";
}
Loading