Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ java -jar target/*.jar

The application ships with the [HAL browser](https://github.com/mikekelly/hal-browser) embedded, so simply browsing to [http://localhost:8080/browser/index.html](http://localhost:8080/browser/index.html) will allow you to explore the web service.

> Note, that the curie links in the representations are currently not backed by any documents served but they will be in the future. Imagine simple HTML pages being served documenting the individual relation types.
> Note, that the curie links in the representations are currently not backed by any documents served, but they will be in the future. Imagine simple HTML pages being served documenting the individual relation types.

## IDE setup

For the usage inside an IDE do the following:
For the usage inside an IDE, do the following:

1. Make sure you have an Eclipse with m2e installed (preferably [STS](http://spring.io/sts)).
2. Install [Lombok](http://projectlombok.org).
1. Download it from the [project page](http://projectlombok.org/download.html).
2. Run the JAR (double click or `java -jar …`).
3. Point it to your Eclipse installation, run the install.
3. Point it to your Eclipse installation and run the install.
4. Restart Eclipse.

3. Import the checked out code through *File > Import > Existing Maven Project…*
Expand All @@ -47,7 +47,7 @@ The project uses:

The implementation consists of mainly two parts, the `order` and the `payment` part. The `Orders` are exposed as REST resources using Spring Data RESTs capability to automatically expose Spring Data JPA repositories contained in the application. The `Payment` process and the REST application protocol described in the book are implemented manually using a Spring MVC controller (`PaymentController`).

Here's what the individual projects used contribute to the sample in from a high-level point of view:
Here's what the individual projects used contribute to the sample from a high-level point of view:

### Spring Data JPA

Expand All @@ -65,11 +65,11 @@ The final important piece is the `EntityLinks` abstraction that allows to create

### Spring Plugin

The Spring Plugin library provides means to collect Spring beans by type and exposing them for selection based on a selection criterion. It basically forms the foundation for the `EntityLinks` mechanism provided in Spring HATEOAS and our custom extension `RestResourceEntityLinks`.
The Spring Plugin library provides means to collect Spring beans by type and expose them for selection based on a selection criterion. It basically forms the foundation for the `EntityLinks` mechanism provided in Spring HATEOAS and our custom extension `RestResourceEntityLinks`.

### Spring Security / Spring Session

The `spring-session` branch contains additional configuration to secure the service using Spring Security, HTTP Basic authentication and Spring Session's HTTP header based session strategy to allow clients to obtain a security token via the `X-Auth-Token` header and using that for subsequent requests.
The `spring-session` branch contains additional configuration to secure the service using Spring Security, HTTP Basic authentication and Spring Session's HTTP header-based session strategy to allow clients to obtain a security token via the `X-Auth-Token` header and using that for subsequent requests.

If you check out the branch and run the sample you should be able to follow this interaction (I am using [HTTPie](https://github.com/jakubroztocil/httpie) here)

Expand Down Expand Up @@ -105,13 +105,13 @@ The [`restdocs`](https://github.com/odrotbohm/spring-restbucks/tree/restdocs) br
These snippets are included from the general Asciidoctor documents in `src/main/asciidoc`, turned into HTML and packaged into the application itself during the build (run `mvn clean package`).
The docs are then pointed to by a CURIE link in the HAL response (see `Restbucks.curieProvider()`) so that they appear in the `docs` column in the HAL browser (run `mvn spring-boot:run` and browse to http://localhost:8080) the service ships.

The use of the Spring Cloud Contract extension also causes WireMock stubs to be generated by those tests and placed into `generated-snippets/stubs/…`. The `pay-order` subfolder for the indivdual setups:
The use of the Spring Cloud Contract extension also causes WireMock stubs to be generated by those tests and placed into `generated-snippets/stubs/…`. The `pay-order` subfolder for the individual setups:

#### Open questions

- How to package the stubs up so that they can be used by a client project?
- How do the client tests select a particular flow to be used for stubbing?
- How to make sure WireMock "understands" the state transitions, i.e. responses to requests to a resource changing based on intermediate requests?
- How to make sure WireMock "understands" the state transitions, i.e., responses to requests to a resource changing based on intermediate requests?
- How to set up WireMock so that the client doesn't necessarily have to select a particular flow to operate against?

### Miscellaneous
Expand All @@ -120,13 +120,13 @@ The project uses [Lombok](http://projectlombok.org) to reduce the amount of boil

## Hypermedia

A core focus of this sample app is to demonstrate how easy resources can be modeled in a hypermedia driven way. There are two major aspects to this challenge in Java web-frameworks:
A core focus of this sample app is to demonstrate how easily resources can be modeled in a hypermedia-driven way. There are two major aspects to this challenge in Java web-frameworks:

1. Creating links and especially the target URL in a clean and concise way, trying to avoid the usage of Strings to define URI mappings and targets and especially the repetition of those. On the server side, we'd essentially like to express "link to the resource that manages `Order` instances" or "link to the resource that manages a single `Order` instance.

2. Cleanly separate resource functionality implementation but still allowing to leverage hypermedia to advertise new functionality for resources as the service implementation evolves. This essentially boils down to an enrichment of resource representations with links.

In our sample the core spot these challenges occur is the `payment` subsystem and the `PaymentController` in particular.
In our sample, the core spot these challenges occur is the `payment` subsystem and the `PaymentController` in particular.

### ALPS

Expand Down Expand Up @@ -186,7 +186,7 @@ resource.ifPresent("restbucks:cancel") {
}
```

The closure is only executed if the link with a relation `restbucks:cancel` is actually present.
The closure is only executed if the link with the relation `restbucks:cancel` is actually present.
It then enables the button and registers `CancelOrder` action for execution on invocation.

TODO - complete