Skip to content

Commit 6300f13

Browse files
committed
All samples running with Java 11 modules
1 parent f0bc2f4 commit 6300f13

File tree

32 files changed

+136
-32
lines changed

32 files changed

+136
-32
lines changed

http-client/README.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ In that case the application must be reachable under `http://localhost:8080/simp
4040
==== Java
4141

4242
To start the JavaFX client simply run `mvn jfx:run` from the client-javafx folder.
43-
Next to this the client can be started by the `dev.rico.samples.http.RestClient` class.
43+
Next to this the client can be started by the `dev.rico.samples.http.client.RestClient` class.
4444

4545

4646
==== JavaFx
4747

4848
To start the JavaFX client simply run `mvn jfx:run` from the client-javafx folder.
49-
Next to this the client can be started by the `dev.rico.samples.http.RestClient` class.
49+
Next to this the client can be started by the `dev.rico.samples.http.client.RestClient` class.

http-client/client-java/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<artifactId>javafx-maven-plugin</artifactId>
3939
<version>8.7.0</version>
4040
<configuration>
41-
<mainClass>dev.rico.samples.http.RestClient</mainClass>
41+
<mainClass>dev.rico.samples.http.client.RestClient</mainClass>
4242
</configuration>
4343
</plugin>
4444
</plugins>

http-client/client-java/src/main/java/dev/rico/samples/http/RestClient.java http-client/client-java/src/main/java/dev/rico/samples/http/client/RestClient.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
package dev.rico.samples.http;
1+
package dev.rico.samples.http.client;
22

33
import dev.rico.client.Client;
44
import dev.rico.core.http.HttpClient;
5+
import dev.rico.samples.http.common.City;
6+
import dev.rico.samples.http.common.CityDetails;
57

68
public class RestClient {
79

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module dev.rico.samples.http.client.java {
2+
3+
requires dev.rico.samples.http.common;
4+
requires dev.rico.client;
5+
}

http-client/client-javafx/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<artifactId>javafx-maven-plugin</artifactId>
4444
<version>8.7.0</version>
4545
<configuration>
46-
<mainClass>dev.rico.samples.http.RestClient</mainClass>
46+
<mainClass>dev.rico.samples.http.client.RestClient</mainClass>
4747
</configuration>
4848
</plugin>
4949
</plugins>

http-client/client-javafx/src/main/java/dev/rico/samples/http/RestClient.java http-client/client-javafx/src/main/java/dev/rico/samples/http/client/RestClient.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
package dev.rico.samples.http;
1+
package dev.rico.samples.http.client;
22

33
import dev.rico.client.Client;
44
import dev.rico.client.javafx.FxToolkit;
55
import dev.rico.core.http.HttpClient;
66
import dev.rico.core.http.RequestMethod;
7+
import dev.rico.samples.http.common.City;
8+
import dev.rico.samples.http.common.CityDetails;
79
import javafx.application.Application;
810
import javafx.geometry.Insets;
911
import javafx.scene.Scene;
@@ -36,7 +38,7 @@ public void start(Stage primaryStage) throws Exception {
3638
withContent(city).
3739
readObject(CityDetails.class).
3840
onDone(d -> showResult(d.getContent())).
39-
onError(ex -> showError(city)).
41+
onError(ex -> showError(city, ex)).
4042
execute();
4143
});
4244

@@ -55,7 +57,8 @@ public void showResult(final CityDetails details) {
5557
alert.showAndWait();
5658
}
5759

58-
public void showError(final City city) {
60+
public void showError(final City city, final Exception exception) {
61+
exception.printStackTrace();
5962
final Alert alert = new Alert(Alert.AlertType.ERROR);
6063
alert.setTitle("Error");
6164
alert.setContentText("Can not get details for city " + city.getName());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module dev.rico.samples.http.client.javafx {
2+
3+
exports dev.rico.samples.http.client;
4+
5+
requires dev.rico.samples.http.common;
6+
requires dev.rico.client.javafx;
7+
requires javafx.controls;
8+
}

http-client/common/src/main/java/dev/rico/samples/http/City.java http-client/common/src/main/java/dev/rico/samples/http/common/City.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package dev.rico.samples.http;
16+
package dev.rico.samples.http.common;
1717

1818
import java.io.Serializable;
1919

http-client/common/src/main/java/dev/rico/samples/http/CityDetails.java http-client/common/src/main/java/dev/rico/samples/http/common/CityDetails.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package dev.rico.samples.http;
16+
package dev.rico.samples.http.common;
1717

1818
public class CityDetails extends City {
1919

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module dev.rico.samples.http.common {
2+
exports dev.rico.samples.http.common;
3+
opens dev.rico.samples.http.common;
4+
}

http-client/server-javaee/src/main/java/dev/rico/samples/http/CityEndpoint.java

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package dev.rico.samples.http;
1717

18+
import dev.rico.samples.http.common.City;
19+
import dev.rico.samples.http.common.CityDetails;
20+
1821
import javax.ws.rs.POST;
1922
import javax.ws.rs.Path;
2023

http-client/server-spring/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
<dependency>
2828
<groupId>org.springframework.boot</groupId>
2929
<artifactId>spring-boot-starter-web</artifactId>
30-
<version>1.5.9.RELEASE</version>
30+
<version>2.2.6.RELEASE</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>${groupId}</groupId>
34+
<artifactId>servlet-fake</artifactId>
35+
<version>${version}</version>
3136
</dependency>
3237
</dependencies>
3338

@@ -36,7 +41,7 @@
3641
<plugin>
3742
<groupId>org.springframework.boot</groupId>
3843
<artifactId>spring-boot-maven-plugin</artifactId>
39-
<version>1.5.9.RELEASE</version>
44+
<version>2.2.6.RELEASE</version>
4045
</plugin>
4146
</plugins>
4247
</build>

http-client/server-spring/src/main/java/dev/rico/samples/http/CityEndpoint.java http-client/server-spring/src/main/java/dev/rico/samples/http/server/CityEndpoint.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package dev.rico.samples.http;
16+
package dev.rico.samples.http.server;
1717

18+
import dev.rico.samples.http.common.City;
19+
import dev.rico.samples.http.common.CityDetails;
1820
import org.springframework.web.bind.annotation.RequestBody;
1921
import org.springframework.web.bind.annotation.RequestMapping;
2022
import org.springframework.web.bind.annotation.RequestMethod;
@@ -25,8 +27,8 @@
2527
public class CityEndpoint {
2628

2729
@RequestMapping(method = RequestMethod.POST)
28-
public CityDetails getDetails(@RequestBody final City city) {
29-
final CityDetails cityDetails = new CityDetails(city);
30+
public CityDetails getDetails(@RequestBody final City input) {
31+
final CityDetails cityDetails = new CityDetails(input);
3032
cityDetails.setDescription("No description");
3133
cityDetails.setPopulation((long) (Math.random() * 1_000_000));
3234
return cityDetails;

http-client/server-spring/src/main/java/dev/rico/samples/http/ServerApplication.java http-client/server-spring/src/main/java/dev/rico/samples/http/server/ServerApplication.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package dev.rico.samples.http;
16+
package dev.rico.samples.http.server;
1717

1818
import dev.rico.server.spring.RicoApplication;
1919
import org.springframework.boot.SpringApplication;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module dev.rico.samples.http.server.spring {
2+
3+
requires dev.rico.samples.http.common;
4+
requires dev.rico.server.spring;
5+
requires spring.boot;
6+
requires spring.web;
7+
requires com.fasterxml.jackson.databind;
8+
9+
opens dev.rico.samples.http.server;
10+
}

http-client/server-spring/src/main/resources/application.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
# limitations under the License.
1515
#
1616

17-
server.contextPath=/simple-rest
17+
server.servlet.context-path=/simple-rest
18+
logging.level.dev.rico=debug

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
</repositories>
3232

3333
<modules>
34+
<module>servlet-fake</module>
3435
<module>todo-list</module>
3536
<module>http-client</module>
3637
<module>rest-security</module>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module dev.rico.samples.simple.security.client.javafx {
2+
3+
requires dev.rico.security.client;
4+
}

rest-security/pom.xml

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
<modules>
1616
<module>server-spring</module>
1717
<module>client-javafx</module>
18-
<module>client-javascript</module>
19-
<module>client-polymer</module>
2018
</modules>
2119

2220
</project>

rest-security/server-spring/pom.xml

+17-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
<groupId>dev.rico</groupId>
1919
<artifactId>rico-security-server-spring</artifactId>
2020
<version>${rico.version}</version>
21+
<exclusions>
22+
<exclusion>
23+
<groupId>com.fasterxml.jackson.core</groupId>
24+
<artifactId>jackson-core</artifactId>
25+
</exclusion>
26+
<exclusion>
27+
<groupId>com.fasterxml.jackson.core</groupId>
28+
<artifactId>jackson-databind</artifactId>
29+
</exclusion>
30+
</exclusions>
2131
</dependency>
2232
<dependency>
2333
<groupId>dev.rico</groupId>
@@ -27,12 +37,17 @@
2737
<dependency>
2838
<groupId>org.springframework.boot</groupId>
2939
<artifactId>spring-boot-starter-web</artifactId>
30-
<version>1.5.9.RELEASE</version>
40+
<version>2.2.6.RELEASE</version>
3141
</dependency>
3242
<dependency>
3343
<groupId>org.slf4j</groupId>
3444
<artifactId>slf4j-api</artifactId>
35-
<version>1.7.25</version>
45+
<version>1.7.30</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>${groupId}</groupId>
49+
<artifactId>servlet-fake</artifactId>
50+
<version>${version}</version>
3651
</dependency>
3752
</dependencies>
3853
</project>

rest-security/server-spring/src/main/java/dev/rico/samples/security/OpenRestEndpoint.java rest-security/server-spring/src/main/java/dev/rico/samples/security/server/OpenRestEndpoint.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package dev.rico.samples.security;
17+
package dev.rico.samples.security.server;
1818

1919
import org.slf4j.Logger;
2020
import org.slf4j.LoggerFactory;

rest-security/server-spring/src/main/java/dev/rico/samples/security/SecureRestEndpoint.java rest-security/server-spring/src/main/java/dev/rico/samples/security/server/SecureRestEndpoint.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package dev.rico.samples.security;
17+
package dev.rico.samples.security.server;
1818

1919
import dev.rico.security.server.SecurityContext;
2020
import org.slf4j.Logger;

rest-security/server-spring/src/main/java/dev/rico/samples/security/SecurityServer.java rest-security/server-spring/src/main/java/dev/rico/samples/security/server/SecurityServer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package dev.rico.samples.security;
17+
package dev.rico.samples.security.server;
1818

1919
import dev.rico.security.server.spring.EnableSecurity;
2020
import dev.rico.server.spring.RicoApplication;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module dev.rico.samples.simple.security.server.spring {
2+
3+
exports dev.rico.samples.security.server;
4+
opens dev.rico.samples.security.server;
5+
6+
requires org.slf4j;
7+
requires spring.web;
8+
requires spring.beans;
9+
requires spring.boot;
10+
requires dev.rico.security.server.spring;
11+
requires dev.rico.server.spring;
12+
requires com.fasterxml.jackson.databind;
13+
}

servlet-fake/pom.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>dev.rico.samples</groupId>
9+
<artifactId>rico-samples</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../</relativePath>
12+
</parent>
13+
14+
<artifactId>servlet-fake</artifactId>
15+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module java.servlet {
2+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module todo.list.client.javafx {
2+
exports dev.rico.samples.todo.client;
3+
opens dev.rico.samples.todo.client;
4+
5+
6+
requires dev.rico.samples.todolist.common;
7+
requires dev.rico.remoting.client.javafx;
8+
requires javafx.fxml;
9+
requires javafx.controls;
10+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module dev.rico.samples.todolist.common {
22
exports dev.rico.samples.todo;
3+
opens dev.rico.samples.todo;
34

45
requires dev.rico.remoting.common;
56
}

todo-list/pom.xml

-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
<module>server-javaee</module>
2020
<module>server-spring</module>
2121
<module>client-javafx</module>
22-
<module>client-polymer</module>
23-
<module>client-angular</module>
24-
<module>client-angularjs</module>
2522
</modules>
2623

2724
</project>

todo-list/server-base/src/main/java/module-info.java

+2
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@
99
requires dev.rico.core;
1010
requires dev.rico.remoting.server;
1111
requires dev.rico.remoting.common;
12+
13+
opens dev.rico.samples.todo.server to dev.rico.core;
1214
}

todo-list/server-spring/pom.xml

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<groupId>dev.rico.samples</groupId>
99
<artifactId>todo-list</artifactId>
1010
<version>1.0-SNAPSHOT</version>
11-
<relativePath>../</relativePath>
1211
</parent>
1312

1413
<artifactId>todo-list-server-spring</artifactId>
@@ -19,6 +18,11 @@
1918
<artifactId>todo-list-server-base</artifactId>
2019
<version>${version}</version>
2120
</dependency>
21+
<dependency>
22+
<groupId>${groupId}</groupId>
23+
<artifactId>servlet-fake</artifactId>
24+
<version>${version}</version>
25+
</dependency>
2226
<dependency>
2327
<groupId>dev.rico</groupId>
2428
<artifactId>rico-remoting-server-spring</artifactId>
@@ -30,13 +34,11 @@
3034
<version>${rico.version}</version>
3135
<scope>test</scope>
3236
</dependency>
33-
3437
<dependency>
3538
<groupId>org.springframework.boot</groupId>
3639
<artifactId>spring-boot-starter-web</artifactId>
3740
<version>2.2.6.RELEASE</version>
3841
</dependency>
39-
4042
</dependencies>
4143

4244
<build>

0 commit comments

Comments
 (0)