From 45ecfc6df9be349b80b937b17546bd417f360ea0 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Fri, 21 Sep 2018 16:33:04 +0200 Subject: [PATCH] Fix source code callouts in Reference Manual --- src/docs/asciidoc/data-access-appendix.adoc | 22 ++++++++----- src/docs/asciidoc/testing.adoc | 2 +- src/docs/asciidoc/web/webflux-webclient.adoc | 15 ++++----- src/docs/asciidoc/web/webmvc.adoc | 15 ++++----- src/docs/asciidoc/web/websocket-intro.adoc | 33 +++++++++++--------- 5 files changed, 49 insertions(+), 38 deletions(-) diff --git a/src/docs/asciidoc/data-access-appendix.adoc b/src/docs/asciidoc/data-access-appendix.adoc index 6913179881..4833f882d5 100644 --- a/src/docs/asciidoc/data-access-appendix.adoc +++ b/src/docs/asciidoc/data-access-appendix.adoc @@ -37,16 +37,19 @@ are available to you: ---- + xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd <2> - http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> + + ---- -<1> Specify the namespace. +<1> Declare usage of the `tx` namespace. <2> Specify the location (with other schema locations). ==== @@ -77,12 +80,15 @@ the correct schema so that the elements in the `jdbc` namespace are available to + xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> <2> + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> <2> + + ---- -<1> Specify the namespace. +<1> Declare usage of the `jdbc` namespace. <2> Specify the location (with other schema locations). ==== diff --git a/src/docs/asciidoc/testing.adoc b/src/docs/asciidoc/testing.adoc index 3adaf4817f..0d340a7dff 100644 --- a/src/docs/asciidoc/testing.adoc +++ b/src/docs/asciidoc/testing.adoc @@ -758,7 +758,7 @@ configuration scenarios: [source,java,indent=0] [subs="verbatim,quotes"] ---- - @DirtiesContext + @DirtiesContext <1> public class ContextDirtyingTests { // some tests that result in the Spring container being dirtied } diff --git a/src/docs/asciidoc/web/webflux-webclient.adoc b/src/docs/asciidoc/web/webflux-webclient.adoc index b0575c8fca..c324e4a556 100644 --- a/src/docs/asciidoc/web/webflux-webclient.adoc +++ b/src/docs/asciidoc/web/webflux-webclient.adoc @@ -208,16 +208,17 @@ The following example shows how to customize Jetty `HttpClient` settings: By default, `HttpClient` creates its own resources (`Executor`, `ByteBufferPool`, `Scheduler`), which remain active until the process exits or `stop()` is called. -You can share resources between multiple instances of the Jetty client (and server) and ensure that the -resources are shut down when the Spring `ApplicationContext` is closed by declaring a -Spring-managed bean of type `JettyResourceFactory`, as the following example shows: +You can share resources between multiple instances of the Jetty client (and server) and +ensure that the resources are shut down when the Spring `ApplicationContext` is closed by +declaring a Spring-managed bean of type `JettyResourceFactory`, as the following example +shows: ==== [source,java,intent=0] [subs="verbatim,quotes"] ---- @Bean - public JettyResourceFactory resourceFactory() { + public JettyResourceFactory resourceFactory() { <1> return new JettyResourceFactory(); } @@ -229,13 +230,13 @@ Spring-managed bean of type `JettyResourceFactory`, as the following example sho }; ClientHttpConnector connector = - new JettyClientHttpConnector(resourceFactory(), customizer); // <2> + new JettyClientHttpConnector(resourceFactory(), customizer); <2> - return WebClient.builder().clientConnector(connector).build(); // <3> + return WebClient.builder().clientConnector(connector).build(); <3> } ---- -<1> Create shared resources. +<1> Create resource factory for shared resources. <2> Use the `JettyClientHttpConnector` constructor with resource factory. <3> Plug the connector into the `WebClient.Builder`. ==== diff --git a/src/docs/asciidoc/web/webmvc.adoc b/src/docs/asciidoc/web/webmvc.adoc index ab1d3fbbfc..4724b01cac 100644 --- a/src/docs/asciidoc/web/webmvc.adoc +++ b/src/docs/asciidoc/web/webmvc.adoc @@ -2359,19 +2359,19 @@ specific controller. This typically lists the names of model attributes or types model attributes that should be transparently stored in the session for subsequent requests to access. -The following example uses a `@SessionAttributes` annotation: +The following example uses the `@SessionAttributes` annotation: ==== [source,java,indent=0] [subs="verbatim,quotes"] ---- @Controller - @SessionAttributes("pet") + @SessionAttributes("pet") <1> public class EditPetForm { // ... } ---- -<1> Using a `@SessionAttributes` annotation. +<1> Using the `@SessionAttributes` annotation. ==== On the first request, when a model attribute with the name, `pet`, is added to the model, @@ -2394,13 +2394,14 @@ storage, as the following example shows: if (errors.hasErrors) { // ... } - status.setComplete(); + status.setComplete(); <2> // ... } } } ---- -<1> Clearing the `Pet` value from storage. +<1> Storing the `Pet` value in the Servlet session. +<2> Clearing the `Pet` value from the Servlet session. ==== @@ -2449,11 +2450,11 @@ or `HandlerInterceptor`): [subs="verbatim,quotes"] ---- @GetMapping("/") - public String handle(@RequestAttribute Client client) { + public String handle(@RequestAttribute Client client) { <1> // ... } ---- -<1> Using a `@RequestAttribute` annotation. +<1> Using the `@RequestAttribute` annotation. ==== diff --git a/src/docs/asciidoc/web/websocket-intro.adoc b/src/docs/asciidoc/web/websocket-intro.adoc index 27aba89786..0b2e6535ce 100644 --- a/src/docs/asciidoc/web/websocket-intro.adoc +++ b/src/docs/asciidoc/web/websocket-intro.adoc @@ -11,16 +11,17 @@ to upgrade or, in this case, to switch to the WebSocket protocol. The following shows such an interaction: ==== -[subs="quotes"] +[source,yaml,indent=0] +[subs="verbatim,quotes"] ---- -GET /spring-websocket-portfolio/portfolio HTTP/1.1 -Host: localhost:8080 -Upgrade: websocket <1> -Connection: Upgrade <2> -Sec-WebSocket-Key: Uc9l9TMkWGbHFD2qnFHltg== -Sec-WebSocket-Protocol: v10.stomp, v11.stomp -Sec-WebSocket-Version: 13 -Origin: http://localhost:8080 + GET /spring-websocket-portfolio/portfolio HTTP/1.1 + Host: localhost:8080 + Upgrade: websocket <1> + Connection: Upgrade <2> + Sec-WebSocket-Key: Uc9l9TMkWGbHFD2qnFHltg== + Sec-WebSocket-Protocol: v10.stomp, v11.stomp + Sec-WebSocket-Version: 13 + Origin: http://localhost:8080 ---- <1> The `Upgrade` header. <2> Using the `Upgrade` connection. @@ -30,14 +31,16 @@ Instead of the usual 200 status code, a server with WebSocket support returns ou similar to the following: ==== -[subs="quotes"] +[source,yaml,indent=0] +[subs="verbatim,quotes"] ---- -**HTTP/1.1 101 Switching Protocols** -Upgrade: websocket -Connection: Upgrade -Sec-WebSocket-Accept: 1qVdfYHU9hPOl4JYYNXF623Gzn0= -Sec-WebSocket-Protocol: v10.stomp + HTTP/1.1 101 Switching Protocols <1> + Upgrade: websocket + Connection: Upgrade + Sec-WebSocket-Accept: 1qVdfYHU9hPOl4JYYNXF623Gzn0= + Sec-WebSocket-Protocol: v10.stomp ---- +<1> Protocol switch ==== After a successful handshake, the TCP socket underlying the HTTP upgrade request remains