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
18 changes: 9 additions & 9 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ By building on top of HTTP, REST APIs provide the means to build:

* Backwards compatible APIs
* Evolvable APIs
* Scaleable services
* Scalable services
* Securable services
* A spectrum of stateless to stateful services

Note that REST, however ubiquitous, is not a standard _per se_ but an approach, a style, a set of _constraints_ on your architecture that can help you build web-scale systems. This tutorial uses the Spring portfolio to build a RESTful service while takin advantage of the stackless features of REST.
Note that REST, however ubiquitous, is not a standard _per se_ but an approach, a style, a set of _constraints_ on your architecture that can help you build web-scale systems. This tutorial uses the Spring portfolio to build a RESTful service while taking advantage of the stackless features of REST.

== Getting Started

Expand All @@ -58,7 +58,7 @@ As we work through this tutorial, we use https://spring.io/projects/spring-boot[

Change the Name to "Payroll" and then choose *Generate Project*. A `.zip` file downloads. Unzip it. Inside, you should find a simple, Maven-based project that includes a `pom.xml` build file. (Note: You can use Gradle. The examples in this tutorial will be Maven-based.)

To complete the tutorial, you could start a new project from scratch or you could look at the https://github.com/spring-guides/tut-rest[solution repository] in GitHub.
To complete the tutorial, you could start a new project from scratch, or you could look at the https://github.com/spring-guides/tut-rest[solution repository] in GitHub.

If you choose to create your own blank project, this tutorial walks you through building your application sequentially. You do not need multiple modules.

Expand Down Expand Up @@ -262,7 +262,7 @@ Doing so yields the following:
----
====

You can see the pre-loaded data in a compacted format.
You can see the preloaded data in a compacted format.

Now try to query a user that doesn't exist, as follows:

Expand Down Expand Up @@ -350,7 +350,7 @@ So far, you have a web-based service that handles the core operations that invol
* Merely using `GET`, `POST`, and so on is not REST.
* Having all the CRUD operations laid out is not REST.

In fact, what we have built so far is better described as *RPC* (*Remote Procedure Call*), because there is no way to know how to interact with this service. If you published this today, you wouldd also have to write a document or host a developer's portal somewhere with all the details.
In fact, what we have built so far is better described as *RPC* (*Remote Procedure Call*), because there is no way to know how to interact with this service. If you published this today, you would also have to write a document or host a developer's portal somewhere with all the details.

This statement of Roy Fielding's may further lend a clue to the difference between *REST* and *RPC*:

Expand All @@ -362,7 +362,7 @@ What needs to be done to make the REST architectural style clear on the notion t
____


The side effect of nnot including hypermedia in our representations is that clients must hard-code URIs to navigate the API. This leads to the same brittle nature that predated the rise of e-commerce on the web. It signifies that our JSON output needs a little help.
The side effect of not including hypermedia in our representations is that clients must hard-code URIs to navigate the API. This leads to the same brittle nature that predated the rise of e-commerce on the web. It signifies that our JSON output needs a little help.

[#_spring_hateoas]
== Spring HATEOAS
Expand Down Expand Up @@ -826,7 +826,7 @@ The `Employee` object built by the `save()` operation is then wrapped in the `Em

Since we want a more detailed HTTP response code than *200 OK*, we use Spring MVC's `ResponseEntity` wrapper. It has a handy
static method (`created()`) where we can plug in the resource's URI.
It is debatable whether *HTTP 201 Created* carries the right semantics, since we do not necessarily "create" a new resource. However, it comes pre-loaded with a *Location* response header, so we use it. Restart your application, run the following command, and observe the results:
It is debatable whether *HTTP 201 Created* carries the right semantics, since we do not necessarily "create" a new resource. However, it comes preloaded with a *Location* response header, so we use it. Restart your application, run the following command, and observe the results:

----
$ curl -v -X PUT localhost:8080/employees/3 -H 'Content-Type:application/json' -d '{"name": "Samwise Gamgee", "role": "ring bearer"}' | json_pp
Expand Down Expand Up @@ -1078,9 +1078,9 @@ This implements similar logic to prevent an `Order` status from being completed

// The ​ entity is a zero-width space and seems to allow us to have the 's' right next to the `Order`; having no space after breaks the inline code formatting.

Let's update `LoadDatabase` to pre-load some `Order` objectss along with the `Employee` objects it was loading before.
Let's update `LoadDatabase` to preload some `Order` objectss along with the `Employee` objects it was loading before.

.Updating the database pre-loader
.Updating the database preloader
[%collapsible%open]
====
[source,java,tabsize=2,indent=0]
Expand Down