Intro to Spring Remoting with HTTP Invokers (#964)

* First test with log4j rolling appenders

* small fix

* Log4j rolling appender

* First set up with rolling file on log4j 2

* Added logback code.

* log4j2 more detailed example

* log4j2 more detailed example

* Improved names and examples

* Fixed configurations

* improved configs

* formatted

* Final fix

* fixed formatting

* Formatting fix

* Fix sample apps to avoid try / catch

* Fix request to replace files

* Fix end lines

* Log4j2 logger is shot down at the end.

* Initial commit, the server starts launched from maven

* made room for client and server projects

* made room for client and server projects

* base example works

* poms restructured

* packages restructured

* packages restructured

* Some renaming and a proper formatting string

* Small renamings

* Small renamings

* Fixed invoked URL in client through fixing bean name
This commit is contained in:
Daniele Demichelis
2017-01-10 19:54:07 +01:00
committed by KevinGilmore
parent 6e9b667aef
commit a0de46efb9
17 changed files with 515 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
<?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">
<parent>
<artifactId>spring-remoting-http</artifactId>
<groupId>com.baeldung</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api</artifactId>
<name>spring-remoting-http-api</name>
<description>API definition shared between client and server.</description>
</project>
@@ -0,0 +1,26 @@
package com.baeldung.api;
import java.io.Serializable;
public class Address implements Serializable{
private String address;
private String countryCode;
public Address(String address, String countryCode) {
this.address = address;
this.countryCode = countryCode;
}
public String getAddress() {
return address;
}
public String getCountryCode() {
return countryCode;
}
@Override public String toString() {
return address + " (" + countryCode + ")";
}
}
@@ -0,0 +1,53 @@
package com.baeldung.api;
import java.io.Serializable;
import java.util.Date;
public class Booking implements Serializable {
private int costInCent;
private int etaInSeconds;
private String bookingCode;
private Date pickUptime;
private Address pickUpAddress;
private Address dropOffAddress;
public Booking(Address pickUpAddress, Date pickUptime, Address dropOffAddress, int costInCent, int etaInSeconds, String bookingCode) {
this.costInCent = costInCent;
this.etaInSeconds = etaInSeconds;
this.bookingCode = bookingCode;
this.pickUptime = pickUptime;
this.pickUpAddress = pickUpAddress;
this.dropOffAddress = dropOffAddress;
}
public int getCostInCent() {
return costInCent;
}
public int getEtaInSeconds() {
return etaInSeconds;
}
public String getBookingCode() {
return bookingCode;
}
public Date getPickUptime() {
return pickUptime;
}
public Address getDropOffAddress() {
return dropOffAddress;
}
@Override public String toString() {
return String.format("Booking: pick up @ %tr in %s, drop down in %s after %d minutes, %.2f $.", pickUptime, pickUpAddress, dropOffAddress, etaInSeconds/60, costInCent/100.0);
}
public static void main(String[] args) throws InterruptedException {
System.out.println(
new Booking(new Address("a", "b"), new Date(), new Address("c", "d"), 123_00, 600, "abc")
);
}
}
@@ -0,0 +1,7 @@
package com.baeldung.api;
public class BookingException extends Exception {
public BookingException(String message) {
super(message);
}
}
@@ -0,0 +1,5 @@
package com.baeldung.api;
public interface CabBookingService {
Booking bookPickUp(Address pickUpLocation, Address dropOffLocation, int pax) throws BookingException;
}