diff --git a/spring-remoting/pom.xml b/spring-remoting/pom.xml index a43dd52a3e..52d670a726 100644 --- a/spring-remoting/pom.xml +++ b/spring-remoting/pom.xml @@ -3,16 +3,17 @@ 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"> 4.0.0 + com.baeldung + spring-remoting + pom + 1.0-SNAPSHOT + spring-remoting + Parent for all projects related to Spring Remoting. org.springframework.boot spring-boot-starter-parent 1.4.3.RELEASE - com.baeldung - spring-remoting - 1.0-SNAPSHOT - Parent for all projects related to Spring Remoting. - pom 1.8 @@ -34,6 +35,7 @@ remoting-http + remoting-hessian-burlap \ No newline at end of file diff --git a/spring-remoting/remoting-hessian-burlap/client/pom.xml b/spring-remoting/remoting-hessian-burlap/client/pom.xml new file mode 100644 index 0000000000..11250e63d2 --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/client/pom.xml @@ -0,0 +1,35 @@ + + + + remoting-hessian-burlap + com.baeldung + 1.0-SNAPSHOT + + 4.0.0 + + spring-remoting-hessian-burlap-client + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + ${project.groupId} + api + + + com.caucho + hessian + 4.0.38 + + + \ No newline at end of file diff --git a/spring-remoting/remoting-hessian-burlap/client/src/main/java/com/baeldung/client/BurlapClient.java b/spring-remoting/remoting-hessian-burlap/client/src/main/java/com/baeldung/client/BurlapClient.java new file mode 100644 index 0000000000..477c29eb26 --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/client/src/main/java/com/baeldung/client/BurlapClient.java @@ -0,0 +1,28 @@ +package com.baeldung.client; + +import com.baeldung.api.BookingException; +import com.baeldung.api.CabBookingService; +import org.springframework.boot.SpringApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.remoting.caucho.BurlapProxyFactoryBean; + +import static java.lang.System.out; + +@Configuration +public class BurlapClient { + + @Bean + public BurlapProxyFactoryBean burlapInvoker() { + BurlapProxyFactoryBean invoker = new BurlapProxyFactoryBean(); + invoker.setServiceUrl("http://localhost:8080/b_booking"); + invoker.setServiceInterface(CabBookingService.class); + return invoker; + } + + public static void main(String[] args) throws BookingException { + CabBookingService service = SpringApplication.run(BurlapClient.class, args).getBean(CabBookingService.class); + out.println(service.bookRide("13 Seagate Blvd, Key Largo, FL 33037")); + } + +} diff --git a/spring-remoting/remoting-hessian-burlap/client/src/main/java/com/baeldung/client/HessianClient.java b/spring-remoting/remoting-hessian-burlap/client/src/main/java/com/baeldung/client/HessianClient.java new file mode 100644 index 0000000000..b5f366094e --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/client/src/main/java/com/baeldung/client/HessianClient.java @@ -0,0 +1,28 @@ +package com.baeldung.client; + +import com.baeldung.api.BookingException; +import com.baeldung.api.CabBookingService; +import org.springframework.boot.SpringApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.remoting.caucho.HessianProxyFactoryBean; + +import static java.lang.System.out; + +@Configuration +public class HessianClient { + + @Bean + public HessianProxyFactoryBean hessianInvoker() { + HessianProxyFactoryBean invoker = new HessianProxyFactoryBean(); + invoker.setServiceUrl("http://localhost:8080/booking"); + invoker.setServiceInterface(CabBookingService.class); + return invoker; + } + + public static void main(String[] args) throws BookingException { + CabBookingService service = SpringApplication.run(HessianClient.class, args).getBean(CabBookingService.class); + out.println(service.bookRide("13 Seagate Blvd, Key Largo, FL 33037")); + } + +} diff --git a/spring-remoting/remoting-hessian-burlap/pom.xml b/spring-remoting/remoting-hessian-burlap/pom.xml new file mode 100644 index 0000000000..682e460880 --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/pom.xml @@ -0,0 +1,20 @@ + + + + spring-remoting + com.baeldung + 1.0-SNAPSHOT + + pom + + server + client + + 4.0.0 + + remoting-hessian-burlap + + + \ No newline at end of file diff --git a/spring-remoting/remoting-hessian-burlap/server/pom.xml b/spring-remoting/remoting-hessian-burlap/server/pom.xml new file mode 100644 index 0000000000..c97092b247 --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/server/pom.xml @@ -0,0 +1,30 @@ + + + + remoting-hessian-burlap + com.baeldung + 1.0-SNAPSHOT + + 4.0.0 + + remoting-hessian-burlap-server + + + + com.baeldung + spring-remoting-http-server + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-web + + + com.caucho + hessian + 4.0.38 + + + \ No newline at end of file diff --git a/spring-remoting/remoting-hessian-burlap/server/src/main/java/com/baeldung/server/Server.java b/spring-remoting/remoting-hessian-burlap/server/src/main/java/com/baeldung/server/Server.java new file mode 100644 index 0000000000..9b7e463871 --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/server/src/main/java/com/baeldung/server/Server.java @@ -0,0 +1,37 @@ +package com.baeldung.server; + +import com.baeldung.api.CabBookingService; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.remoting.caucho.BurlapServiceExporter; +import org.springframework.remoting.caucho.HessianServiceExporter; +import org.springframework.remoting.support.RemoteExporter; + +@Configuration @ComponentScan @EnableAutoConfiguration public class Server { + + @Bean CabBookingService bookingService() { + return new CabBookingServiceImpl(); + } + + @Bean(name = "/booking") RemoteExporter hessianService(CabBookingService service) { + HessianServiceExporter exporter = new HessianServiceExporter(); + exporter.setService(bookingService()); + exporter.setServiceInterface(CabBookingService.class); + return exporter; + } + + @Bean(name = "/b_booking") RemoteExporter burlapService(CabBookingService service) { + BurlapServiceExporter exporter = new BurlapServiceExporter(); + exporter.setService(bookingService()); + exporter.setServiceInterface(CabBookingService.class); + return exporter; + } + + public static void main(String[] args) { + SpringApplication.run(Server.class, args); + } + +} \ No newline at end of file