diff --git a/.gitignore b/.gitignore
index e02cf48..59b2c02 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
/.project
/.settings
-/src
+/src
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index ea644d2..fc96993 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,5 +11,6 @@
spring3-mvc-simple
spring3-jmx-example
spring3-rmi-example
+ spring3-rmi-httpinvoker-example
\ No newline at end of file
diff --git a/spring3-mvc-simple/pom.xml b/spring3-mvc-simple/pom.xml
index 81a626b..32e7a06 100644
--- a/spring3-mvc-simple/pom.xml
+++ b/spring3-mvc-simple/pom.xml
@@ -58,8 +58,6 @@
-
-
diff --git a/spring3-rmi-httpinvoker-example/.gitignore b/spring3-rmi-httpinvoker-example/.gitignore
new file mode 100644
index 0000000..ca618a0
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/.gitignore
@@ -0,0 +1,5 @@
+/target/
+/dependency-reduced-pom.xml
+/.settings
+/.classpath
+/.project
diff --git a/spring3-rmi-httpinvoker-example/README.md b/spring3-rmi-httpinvoker-example/README.md
new file mode 100644
index 0000000..65151f0
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/README.md
@@ -0,0 +1,19 @@
+spring3-rmi-httpinvoker-example
+=======================
+
+基于Spring Http invoker的远程方法调用
+
+先使用```mvn jetty:run```运行服务端,再运行```HttpUserServiceClient```client端。注意看控制台日志输出
+
+注意的配置文件
+
+server
+
+* [spring-servlet.xml](src/main/webapp/WEB-INF/spring-servlet.xml)
+* [web.xml](src/main/webapp/WEB-INF/web.xml)
+
+
+client
+
+* [httpClientApplicationContext.xml](src/main/resources/httpClientApplicationContext.xml)
+* [HttpUserServiceClient.java](src/main/java/net/aimeizi/rmi/httpinvoke/example/http/client/HttpUserServiceClient.java)
\ No newline at end of file
diff --git a/spring3-rmi-httpinvoker-example/pom.xml b/spring3-rmi-httpinvoker-example/pom.xml
new file mode 100644
index 0000000..71a0578
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/pom.xml
@@ -0,0 +1,103 @@
+
+ 4.0.0
+
+ net.aimeizi
+ maven-framework-project
+ 1.0.0
+
+ net.aimeizi.rmi.httpinvoke.example
+ spring3-rmi-httpinvoker-example
+ war
+
+
+ 3.1.1.RELEASE
+
+
+
+
+ org.springframework
+ spring-core
+ ${spring.version}
+
+
+ org.springframework
+ spring-context
+ ${spring.version}
+
+
+ org.springframework
+ spring-remoting
+ 2.0.8
+
+
+ org.springframework
+ spring-web
+ ${spring.version}
+
+
+ org.springframework
+ spring-webmvc
+ ${spring.version}
+
+
+
+ log4j
+ log4j
+ 1.2.16
+
+
+
+
+ spring3-rmi-httpinvoker-example
+
+
+ org.eclipse.jetty
+ jetty-maven-plugin
+ 9.2.1.v20140609
+
+
+
+ org.apache.tomcat.maven
+ tomcat7-maven-plugin
+ 2.2
+
+
+
+ org.apache.tomcat.maven
+ tomcat6-maven-plugin
+ 2.2
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.3
+
+
+ package
+
+ shade
+
+
+
+
+ net.aimeizi.rmi.httpinvoke.example.http.client.HttpUserServiceClient
+
+
+ META-INF/spring.handlers
+
+
+ META-INF/spring.schemas
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/cache/service/CacheService.java b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/cache/service/CacheService.java
new file mode 100644
index 0000000..3455f70
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/cache/service/CacheService.java
@@ -0,0 +1,29 @@
+package net.aimeizi.rmi.httpinvoke.example.cache.service;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import net.aimeizi.rmi.httpinvoke.example.model.User;
+
+public class CacheService implements ICacheService {
+
+ ConcurrentHashMap userMap;
+
+ /**
+ * Get User Map
+ *
+ * @return ConcurrentHashMap User Map
+ */
+ public ConcurrentHashMap getUserMap() {
+ return userMap;
+ }
+
+ /**
+ * Set User Map
+ *
+ * @param ConcurrentHashMap User Map
+ */
+ public void setUserMap(ConcurrentHashMap userMap) {
+ this.userMap = userMap;
+ }
+
+}
diff --git a/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/cache/service/ICacheService.java b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/cache/service/ICacheService.java
new file mode 100644
index 0000000..1a4e9a4
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/cache/service/ICacheService.java
@@ -0,0 +1,16 @@
+package net.aimeizi.rmi.httpinvoke.example.cache.service;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import net.aimeizi.rmi.httpinvoke.example.model.User;
+
+public interface ICacheService {
+
+ /**
+ * Get User Map
+ *
+ * @return ConcurrentHashMap User Map
+ */
+ public ConcurrentHashMap getUserMap();
+
+}
diff --git a/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/client/HttpUserServiceClient.java b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/client/HttpUserServiceClient.java
new file mode 100644
index 0000000..af63665
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/client/HttpUserServiceClient.java
@@ -0,0 +1,48 @@
+package net.aimeizi.rmi.httpinvoke.example.http.client;
+
+import net.aimeizi.rmi.httpinvoke.example.http.server.IHttpUserService;
+import net.aimeizi.rmi.httpinvoke.example.model.User;
+
+import org.apache.log4j.Logger;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class HttpUserServiceClient {
+
+ private static Logger logger = Logger.getLogger(HttpUserServiceClient.class);
+
+ /**
+ * Main method of the Http User Service Client
+ *
+ */
+ public static void main(String[] args) {
+
+ logger.debug("Http User Service Client is starting...");
+
+ //Http Client Application Context is started...
+ ApplicationContext context = new ClassPathXmlApplicationContext("httpClientApplicationContext.xml");
+
+ //Remote User Service is called via Http Client Application Context...
+ IHttpUserService httpClient = (IHttpUserService) context.getBean("HttpUserService");
+
+ //New User is created...
+ User user = new User();
+ user.setId(1);
+ user.setName("Bruce");
+ user.setSurname("Willis");
+
+ //The user is added to the remote cache...
+ httpClient.addUser(user);
+
+ //The users are gotten via remote cache...
+ httpClient.getUserList();
+
+ //The user is deleted from remote cache...
+ httpClient.deleteUser(user);
+
+ //The users are gotten via remote cache...
+ httpClient.getUserList();
+
+ logger.debug("Http User Service Client is stopped...");
+ }
+}
diff --git a/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/server/HttpUserService.java b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/server/HttpUserService.java
new file mode 100644
index 0000000..cc95d70
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/server/HttpUserService.java
@@ -0,0 +1,71 @@
+package net.aimeizi.rmi.httpinvoke.example.http.server;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.aimeizi.rmi.httpinvoke.example.cache.service.ICacheService;
+import net.aimeizi.rmi.httpinvoke.example.model.User;
+
+import org.apache.log4j.Logger;
+
+public class HttpUserService implements IHttpUserService {
+
+ private static Logger logger = Logger.getLogger(HttpUserService.class);
+
+ ICacheService cacheService;
+
+ /**
+ * Add User
+ *
+ * @param User user
+ * @return boolean response of the method
+ */
+ public boolean addUser(User user) {
+ getCacheService().getUserMap().put(user.getId(), user);
+ logger.debug("User has been added to cache. User : "+getCacheService().getUserMap().get(user.getId()));
+ return true;
+ }
+
+ /**
+ * Delete User
+ *
+ * @param User user
+ * @return boolean response of the method
+ */
+ public boolean deleteUser(User user) {
+ getCacheService().getUserMap().remove(user.getId());
+ logger.debug("User has been deleted from cache. User : "+user);
+ return true;
+ }
+
+ /**
+ * Get User List
+ *
+ * @return List user list
+ */
+ public List getUserList() {
+ List list = new ArrayList();
+ list.addAll(getCacheService().getUserMap().values());
+ logger.debug("User List : "+list);
+ return list;
+ }
+
+ /**
+ * Get Remote Cache Service
+ *
+ * @return ICacheService Remote Cache Service
+ */
+ public ICacheService getCacheService() {
+ return cacheService;
+ }
+
+ /**
+ * Set Remote Cache Service
+ *
+ * @param ICacheService Remote Cache Service
+ */
+ public void setCacheService(ICacheService cacheService) {
+ this.cacheService = cacheService;
+ }
+
+}
diff --git a/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/server/IHttpUserService.java b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/server/IHttpUserService.java
new file mode 100644
index 0000000..4e87786
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/server/IHttpUserService.java
@@ -0,0 +1,32 @@
+package net.aimeizi.rmi.httpinvoke.example.http.server;
+
+import java.util.List;
+
+import net.aimeizi.rmi.httpinvoke.example.model.User;
+
+public interface IHttpUserService {
+
+ /**
+ * Add User
+ *
+ * @param User user
+ * @return boolean response of the method
+ */
+ public boolean addUser(User user);
+
+ /**
+ * Delete User
+ *
+ * @param User user
+ * @return boolean response of the method
+ */
+ public boolean deleteUser(User user);
+
+ /**
+ * Get User List
+ *
+ * @return List user list
+ */
+ public List getUserList();
+
+}
diff --git a/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/model/User.java b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/model/User.java
new file mode 100644
index 0000000..6979965
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/model/User.java
@@ -0,0 +1,74 @@
+package net.aimeizi.rmi.httpinvoke.example.model;
+
+import java.io.Serializable;
+
+@SuppressWarnings("serial")
+public class User implements Serializable {
+
+ private long id;
+ private String name;
+ private String surname;
+
+ /**
+ * Get User Id
+ *
+ * @return long id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * Set User Id
+ *
+ * @param long id
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * Get User Name
+ *
+ * @return long id
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set User Name
+ *
+ * @param String name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get User Surname
+ *
+ * @return long id
+ */
+ public String getSurname() {
+ return surname;
+ }
+
+ /**
+ * Set User Surname
+ *
+ * @param String surname
+ */
+ public void setSurname(String surname) {
+ this.surname = surname;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder strBuilder = new StringBuilder();
+ strBuilder.append("Id : ").append(getId());
+ strBuilder.append(", Name : ").append(getName());
+ strBuilder.append(", Surname : ").append(getSurname());
+ return strBuilder.toString();
+ }
+}
diff --git a/spring3-rmi-httpinvoker-example/src/main/resources/httpClientApplicationContext.xml b/spring3-rmi-httpinvoker-example/src/main/resources/httpClientApplicationContext.xml
new file mode 100644
index 0000000..ce844bc
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/resources/httpClientApplicationContext.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring3-rmi-httpinvoker-example/src/main/resources/log4j.xml b/spring3-rmi-httpinvoker-example/src/main/resources/log4j.xml
new file mode 100644
index 0000000..6d99593
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/resources/log4j.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring3-rmi-httpinvoker-example/src/main/webapp/WEB-INF/spring-servlet.xml b/spring3-rmi-httpinvoker-example/src/main/webapp/WEB-INF/spring-servlet.xml
new file mode 100644
index 0000000..a86d5b9
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/webapp/WEB-INF/spring-servlet.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ HttpUserServiceExporter
+
+
+
+
+
diff --git a/spring3-rmi-httpinvoker-example/src/main/webapp/WEB-INF/web.xml b/spring3-rmi-httpinvoker-example/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..45d8184
--- /dev/null
+++ b/spring3-rmi-httpinvoker-example/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,23 @@
+
+
+ spring3-rmi-httpinvoker-example
+
+ contextConfigLocation
+ /WEB-INF/spring-servlet.xml
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
+ spring
+ org.springframework.web.servlet.DispatcherServlet
+ 2
+
+
+ spring
+ /HttpUserService
+
+
\ No newline at end of file