Skip to content

Commit a63088e

Browse files
committed
Basic content service project setup.
0 parents  commit a63088e

File tree

6 files changed

+161
-0
lines changed

6 files changed

+161
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# IntelliJ
2+
*.iml
3+
*.iws
4+
.idea/
5+
6+
# Maven
7+
target/

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM payara/micro:5-SNAPSHOT
2+
COPY target/content-service.war /opt/payara/deployments

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Building Web Services with Java EE 8 <br>Section 3: Content Marshalling with JSON-B and JSON-P
2+
3+
## Videos
4+
5+
### Video 3.1: Introduction to Content-Types and Content Negotiation
6+
7+
In this video we are going to talk about Content-Types and Content Negotiation.
8+
9+
| Method | URI | Status | Description |
10+
|--------|-----|--------|-------------|
11+
| GET | /api/version | 200 | |
12+
13+
### Video 3.2: Easy Data Binding using JSON-B
14+
15+
In this video we are showing how to use JSON-B for easy data binding.
16+
17+
| Method | URI | Status | Description |
18+
|--------|-----|--------|-------------|
19+
| GET | /api/json-b/ | 200 | |
20+
21+
### Video 3.3: Flexible JSON processing with JSON-P
22+
23+
In this video we are showing how to use JSON-P for flexible JSON processing.
24+
25+
| Method | URI | Status | Description |
26+
|--------|-----|--------|-------------|
27+
| GET | /api/json-p/ | 200 | |
28+
29+
### Video 2.4: Implementing hypermedia-driven REST APIs
30+
31+
In this video we are showing how to build hypermedia-driven REST APIs.
32+
33+
| Method | URI | Status | Description |
34+
|--------|-----|--------|-------------|
35+
| GET | /api/hypermedia/ | 200 | |
36+
37+
38+
## Building and Running
39+
40+
```bash
41+
$ mvn clean verify
42+
43+
$ docker build -t content-service:1.0 .
44+
$ docker run -it -p 8080:8080 content-service:1.0
45+
```

pom.xml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.packtpub</groupId>
5+
<artifactId>content-service</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<packaging>war</packaging>
8+
9+
<dependencies>
10+
<dependency>
11+
<groupId>javax</groupId>
12+
<artifactId>javaee-api</artifactId>
13+
<version>8.0</version>
14+
<scope>provided</scope>
15+
</dependency>
16+
17+
<dependency>
18+
<groupId>junit</groupId>
19+
<artifactId>junit</artifactId>
20+
<version>4.12</version>
21+
<scope>test</scope>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.mockito</groupId>
25+
<artifactId>mockito-core</artifactId>
26+
<version>2.13.0</version>
27+
<scope>test</scope>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.assertj</groupId>
31+
<artifactId>assertj-core</artifactId>
32+
<version>3.9.0</version>
33+
<scope>test</scope>
34+
</dependency>
35+
36+
<dependency>
37+
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
38+
<artifactId>jersey-test-framework-provider-grizzly2</artifactId>
39+
<version>${jersey.version}</version>
40+
<scope>test</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.glassfish.jersey.core</groupId>
44+
<artifactId>jersey-client</artifactId>
45+
<version>${jersey.version}</version>
46+
<scope>test</scope>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.glassfish.jersey.inject</groupId>
50+
<artifactId>jersey-hk2</artifactId>
51+
<version>${jersey.version}</version>
52+
<scope>test</scope>
53+
</dependency>
54+
<dependency>
55+
<groupId>org.glassfish.jersey.media</groupId>
56+
<artifactId>jersey-media-json-binding</artifactId>
57+
<version>${jersey.version}</version>
58+
<scope>test</scope>
59+
</dependency>
60+
</dependencies>
61+
62+
<build>
63+
<finalName>content-service</finalName>
64+
65+
<plugins>
66+
<plugin>
67+
<groupId>org.apache.maven.plugins</groupId>
68+
<artifactId>maven-surefire-plugin</artifactId>
69+
<version>2.20.1</version>
70+
<configuration>
71+
<includes>
72+
<include>**/*Test.java</include>
73+
</includes>
74+
<excludes>
75+
<exclude>**/*IntegrationTest.java</exclude>
76+
</excludes>
77+
</configuration>
78+
</plugin>
79+
</plugins>
80+
</build>
81+
82+
<properties>
83+
<jersey.version>2.26</jersey.version>
84+
<maven.compiler.source>1.8</maven.compiler.source>
85+
<maven.compiler.target>1.8</maven.compiler.target>
86+
<failOnMissingWebXml>false</failOnMissingWebXml>
87+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
88+
</properties>
89+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.packtpub.javaee8;
2+
3+
import javax.ws.rs.ApplicationPath;
4+
import javax.ws.rs.core.Application;
5+
import java.util.Set;
6+
7+
/**
8+
* Configures a JAX-RS endpoint.
9+
*/
10+
@ApplicationPath("api")
11+
public class JAXRSConfiguration extends Application {
12+
}

src/main/webapp/WEB-INF/beans.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
5+
bean-discovery-mode="all">
6+
</beans>

0 commit comments

Comments
 (0)