Skip to content

Commit a75ed7e

Browse files
danidemiKevinGilmore
authored andcommitted
BAEL-554 Spring Remoting with Hessian and Burlap (eugenp#1166)
* Burlap & Hessian server added * Burlap & Hessian client work * Fixed main * Fixed formatting
1 parent 3371c90 commit a75ed7e

7 files changed

Lines changed: 185 additions & 5 deletions

File tree

‎spring-remoting/pom.xml‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.baeldung</groupId>
7+
<artifactId>spring-remoting</artifactId>
8+
<packaging>pom</packaging>
9+
<version>1.0-SNAPSHOT</version>
10+
<name>spring-remoting</name>
11+
<description>Parent for all projects related to Spring Remoting.</description>
612
<parent>
713
<groupId>org.springframework.boot</groupId>
814
<artifactId>spring-boot-starter-parent</artifactId>
915
<version>1.4.3.RELEASE</version>
1016
</parent>
11-
<groupId>com.baeldung</groupId>
12-
<artifactId>spring-remoting</artifactId>
13-
<version>1.0-SNAPSHOT</version>
14-
<description>Parent for all projects related to Spring Remoting.</description>
15-
<packaging>pom</packaging>
1617

1718
<properties>
1819
<java.version>1.8</java.version>
@@ -34,6 +35,7 @@
3435

3536
<modules>
3637
<module>remoting-http</module>
38+
<module>remoting-hessian-burlap</module>
3739
</modules>
3840

3941
</project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>remoting-hessian-burlap</artifactId>
7+
<groupId>com.baeldung</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>spring-remoting-hessian-burlap-client</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>org.springframework.boot</groupId>
17+
<artifactId>spring-boot-starter-web</artifactId>
18+
<exclusions>
19+
<exclusion>
20+
<groupId>org.springframework.boot</groupId>
21+
<artifactId>spring-boot-starter-tomcat</artifactId>
22+
</exclusion>
23+
</exclusions>
24+
</dependency>
25+
<dependency>
26+
<groupId>${project.groupId}</groupId>
27+
<artifactId>api</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>com.caucho</groupId>
31+
<artifactId>hessian</artifactId>
32+
<version>4.0.38</version>
33+
</dependency>
34+
</dependencies>
35+
</project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.baeldung.client;
2+
3+
import com.baeldung.api.BookingException;
4+
import com.baeldung.api.CabBookingService;
5+
import org.springframework.boot.SpringApplication;
6+
import org.springframework.context.annotation.Bean;
7+
import org.springframework.context.annotation.Configuration;
8+
import org.springframework.remoting.caucho.BurlapProxyFactoryBean;
9+
10+
import static java.lang.System.out;
11+
12+
@Configuration
13+
public class BurlapClient {
14+
15+
@Bean
16+
public BurlapProxyFactoryBean burlapInvoker() {
17+
BurlapProxyFactoryBean invoker = new BurlapProxyFactoryBean();
18+
invoker.setServiceUrl("http://localhost:8080/b_booking");
19+
invoker.setServiceInterface(CabBookingService.class);
20+
return invoker;
21+
}
22+
23+
public static void main(String[] args) throws BookingException {
24+
CabBookingService service = SpringApplication.run(BurlapClient.class, args).getBean(CabBookingService.class);
25+
out.println(service.bookRide("13 Seagate Blvd, Key Largo, FL 33037"));
26+
}
27+
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.baeldung.client;
2+
3+
import com.baeldung.api.BookingException;
4+
import com.baeldung.api.CabBookingService;
5+
import org.springframework.boot.SpringApplication;
6+
import org.springframework.context.annotation.Bean;
7+
import org.springframework.context.annotation.Configuration;
8+
import org.springframework.remoting.caucho.HessianProxyFactoryBean;
9+
10+
import static java.lang.System.out;
11+
12+
@Configuration
13+
public class HessianClient {
14+
15+
@Bean
16+
public HessianProxyFactoryBean hessianInvoker() {
17+
HessianProxyFactoryBean invoker = new HessianProxyFactoryBean();
18+
invoker.setServiceUrl("http://localhost:8080/booking");
19+
invoker.setServiceInterface(CabBookingService.class);
20+
return invoker;
21+
}
22+
23+
public static void main(String[] args) throws BookingException {
24+
CabBookingService service = SpringApplication.run(HessianClient.class, args).getBean(CabBookingService.class);
25+
out.println(service.bookRide("13 Seagate Blvd, Key Largo, FL 33037"));
26+
}
27+
28+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>spring-remoting</artifactId>
7+
<groupId>com.baeldung</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<packaging>pom</packaging>
11+
<modules>
12+
<module>server</module>
13+
<module>client</module>
14+
</modules>
15+
<modelVersion>4.0.0</modelVersion>
16+
17+
<artifactId>remoting-hessian-burlap</artifactId>
18+
19+
20+
</project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>remoting-hessian-burlap</artifactId>
7+
<groupId>com.baeldung</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>remoting-hessian-burlap-server</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>com.baeldung</groupId>
17+
<artifactId>spring-remoting-http-server</artifactId>
18+
<version>1.0-SNAPSHOT</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter-web</artifactId>
23+
</dependency>
24+
<dependency>
25+
<groupId>com.caucho</groupId>
26+
<artifactId>hessian</artifactId>
27+
<version>4.0.38</version>
28+
</dependency>
29+
</dependencies>
30+
</project>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.baeldung.server;
2+
3+
import com.baeldung.api.CabBookingService;
4+
import org.springframework.boot.SpringApplication;
5+
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
6+
import org.springframework.context.annotation.Bean;
7+
import org.springframework.context.annotation.ComponentScan;
8+
import org.springframework.context.annotation.Configuration;
9+
import org.springframework.remoting.caucho.BurlapServiceExporter;
10+
import org.springframework.remoting.caucho.HessianServiceExporter;
11+
import org.springframework.remoting.support.RemoteExporter;
12+
13+
@Configuration @ComponentScan @EnableAutoConfiguration public class Server {
14+
15+
@Bean CabBookingService bookingService() {
16+
return new CabBookingServiceImpl();
17+
}
18+
19+
@Bean(name = "/booking") RemoteExporter hessianService(CabBookingService service) {
20+
HessianServiceExporter exporter = new HessianServiceExporter();
21+
exporter.setService(bookingService());
22+
exporter.setServiceInterface(CabBookingService.class);
23+
return exporter;
24+
}
25+
26+
@Bean(name = "/b_booking") RemoteExporter burlapService(CabBookingService service) {
27+
BurlapServiceExporter exporter = new BurlapServiceExporter();
28+
exporter.setService(bookingService());
29+
exporter.setServiceInterface(CabBookingService.class);
30+
return exporter;
31+
}
32+
33+
public static void main(String[] args) {
34+
SpringApplication.run(Server.class, args);
35+
}
36+
37+
}

0 commit comments

Comments
 (0)