Fix source code callouts in Reference Manual
This commit is contained in:
@@ -37,16 +37,19 @@ are available to you:
|
|||||||
----
|
----
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||||
xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" <1>
|
xmlns:tx="http://www.springframework.org/schema/tx" <1>
|
||||||
|
xsi:schemaLocation="
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
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/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"> <!-- bean definitions here -->
|
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
|
||||||
|
|
||||||
|
<!-- bean definitions here -->
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
----
|
----
|
||||||
<1> Specify the namespace.
|
<1> Declare usage of the `tx` namespace.
|
||||||
<2> Specify the location (with other schema locations).
|
<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
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xsi:schemaLocation=" <2>
|
xmlns:jdbc="http://www.springframework.org/schema/jdbc" <1>
|
||||||
|
xsi:schemaLocation="
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
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"> <!-- bean definitions here --> <2>
|
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> <2>
|
||||||
|
|
||||||
|
<!-- bean definitions here -->
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
----
|
----
|
||||||
<1> Specify the namespace.
|
<1> Declare usage of the `jdbc` namespace.
|
||||||
<2> Specify the location (with other schema locations).
|
<2> Specify the location (with other schema locations).
|
||||||
====
|
====
|
||||||
|
|||||||
@@ -758,7 +758,7 @@ configuration scenarios:
|
|||||||
[source,java,indent=0]
|
[source,java,indent=0]
|
||||||
[subs="verbatim,quotes"]
|
[subs="verbatim,quotes"]
|
||||||
----
|
----
|
||||||
@DirtiesContext
|
@DirtiesContext <1>
|
||||||
public class ContextDirtyingTests {
|
public class ContextDirtyingTests {
|
||||||
// some tests that result in the Spring container being dirtied
|
// some tests that result in the Spring container being dirtied
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,16 +208,17 @@ The following example shows how to customize Jetty `HttpClient` settings:
|
|||||||
By default, `HttpClient` creates its own resources (`Executor`, `ByteBufferPool`, `Scheduler`),
|
By default, `HttpClient` creates its own resources (`Executor`, `ByteBufferPool`, `Scheduler`),
|
||||||
which remain active until the process exits or `stop()` is called.
|
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
|
You can share resources between multiple instances of the Jetty client (and server) and
|
||||||
resources are shut down when the Spring `ApplicationContext` is closed by declaring a
|
ensure that the resources are shut down when the Spring `ApplicationContext` is closed by
|
||||||
Spring-managed bean of type `JettyResourceFactory`, as the following example shows:
|
declaring a Spring-managed bean of type `JettyResourceFactory`, as the following example
|
||||||
|
shows:
|
||||||
|
|
||||||
====
|
====
|
||||||
[source,java,intent=0]
|
[source,java,intent=0]
|
||||||
[subs="verbatim,quotes"]
|
[subs="verbatim,quotes"]
|
||||||
----
|
----
|
||||||
@Bean
|
@Bean
|
||||||
public JettyResourceFactory resourceFactory() {
|
public JettyResourceFactory resourceFactory() { <1>
|
||||||
return new JettyResourceFactory();
|
return new JettyResourceFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,13 +230,13 @@ Spring-managed bean of type `JettyResourceFactory`, as the following example sho
|
|||||||
};
|
};
|
||||||
|
|
||||||
ClientHttpConnector connector =
|
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.
|
<2> Use the `JettyClientHttpConnector` constructor with resource factory.
|
||||||
<3> Plug the connector into the `WebClient.Builder`.
|
<3> Plug the connector into the `WebClient.Builder`.
|
||||||
====
|
====
|
||||||
|
|||||||
@@ -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
|
model attributes that should be transparently stored in the session for subsequent
|
||||||
requests to access.
|
requests to access.
|
||||||
|
|
||||||
The following example uses a `@SessionAttributes` annotation:
|
The following example uses the `@SessionAttributes` annotation:
|
||||||
|
|
||||||
====
|
====
|
||||||
[source,java,indent=0]
|
[source,java,indent=0]
|
||||||
[subs="verbatim,quotes"]
|
[subs="verbatim,quotes"]
|
||||||
----
|
----
|
||||||
@Controller
|
@Controller
|
||||||
@SessionAttributes("pet")
|
@SessionAttributes("pet") <1>
|
||||||
public class EditPetForm {
|
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,
|
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) {
|
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"]
|
[subs="verbatim,quotes"]
|
||||||
----
|
----
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
public String handle(@RequestAttribute Client client) {
|
public String handle(@RequestAttribute Client client) { <1>
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
<1> Using a `@RequestAttribute` annotation.
|
<1> Using the `@RequestAttribute` annotation.
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,16 +11,17 @@ to upgrade or, in this case, to switch to the WebSocket protocol. The following
|
|||||||
shows such an interaction:
|
shows such an interaction:
|
||||||
|
|
||||||
====
|
====
|
||||||
[subs="quotes"]
|
[source,yaml,indent=0]
|
||||||
|
[subs="verbatim,quotes"]
|
||||||
----
|
----
|
||||||
GET /spring-websocket-portfolio/portfolio HTTP/1.1
|
GET /spring-websocket-portfolio/portfolio HTTP/1.1
|
||||||
Host: localhost:8080
|
Host: localhost:8080
|
||||||
Upgrade: websocket <1>
|
Upgrade: websocket <1>
|
||||||
Connection: Upgrade <2>
|
Connection: Upgrade <2>
|
||||||
Sec-WebSocket-Key: Uc9l9TMkWGbHFD2qnFHltg==
|
Sec-WebSocket-Key: Uc9l9TMkWGbHFD2qnFHltg==
|
||||||
Sec-WebSocket-Protocol: v10.stomp, v11.stomp
|
Sec-WebSocket-Protocol: v10.stomp, v11.stomp
|
||||||
Sec-WebSocket-Version: 13
|
Sec-WebSocket-Version: 13
|
||||||
Origin: http://localhost:8080
|
Origin: http://localhost:8080
|
||||||
----
|
----
|
||||||
<1> The `Upgrade` header.
|
<1> The `Upgrade` header.
|
||||||
<2> Using the `Upgrade` connection.
|
<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:
|
similar to the following:
|
||||||
|
|
||||||
====
|
====
|
||||||
[subs="quotes"]
|
[source,yaml,indent=0]
|
||||||
|
[subs="verbatim,quotes"]
|
||||||
----
|
----
|
||||||
**HTTP/1.1 101 Switching Protocols**
|
HTTP/1.1 101 Switching Protocols <1>
|
||||||
Upgrade: websocket
|
Upgrade: websocket
|
||||||
Connection: Upgrade
|
Connection: Upgrade
|
||||||
Sec-WebSocket-Accept: 1qVdfYHU9hPOl4JYYNXF623Gzn0=
|
Sec-WebSocket-Accept: 1qVdfYHU9hPOl4JYYNXF623Gzn0=
|
||||||
Sec-WebSocket-Protocol: v10.stomp
|
Sec-WebSocket-Protocol: v10.stomp
|
||||||
----
|
----
|
||||||
|
<1> Protocol switch
|
||||||
====
|
====
|
||||||
|
|
||||||
After a successful handshake, the TCP socket underlying the HTTP upgrade request remains
|
After a successful handshake, the TCP socket underlying the HTTP upgrade request remains
|
||||||
|
|||||||
Reference in New Issue
Block a user