URL Cleanup
This merges the URL Cleanup PRs along with fixes. Closes gh-22617 gh-22622 gh-22635
This commit is contained in:
@@ -164,7 +164,7 @@ The following example shows how to use `FacesContextUtils`:
|
||||
[[struts]]
|
||||
== Apache Struts 2.x
|
||||
|
||||
Invented by Craig McClanahan, http://struts.apache.org[Struts] is an open-source project
|
||||
Invented by Craig McClanahan, https://struts.apache.org[Struts] is an open-source project
|
||||
hosted by the Apache Software Foundation. At the time, it greatly simplified the
|
||||
JSP/Servlet programming paradigm and won over many developers who were using proprietary
|
||||
frameworks. It simplified the programming model, it was open source (and thus free as in
|
||||
@@ -181,7 +181,7 @@ built-in Spring integration.
|
||||
[[tapestry]]
|
||||
== Apache Tapestry 5.x
|
||||
|
||||
http://tapestry.apache.org/[Tapestry] is a ""Component oriented framework for creating
|
||||
https://tapestry.apache.org/[Tapestry] is a ""Component oriented framework for creating
|
||||
dynamic, robust, highly scalable web applications in Java.""
|
||||
|
||||
While Spring has its own <<mvc, powerful web layer>>, there are a number of unique
|
||||
@@ -200,6 +200,6 @@ https://tapestry.apache.org/integrating-with-spring-framework.html[integration m
|
||||
The following links go to further resources about the various web frameworks described in
|
||||
this chapter.
|
||||
|
||||
* The http://www.oracle.com/technetwork/java/javaee/javaserverfaces-139869.html[JSF] homepage
|
||||
* The http://struts.apache.org/[Struts] homepage
|
||||
* The http://tapestry.apache.org/[Tapestry] homepage
|
||||
* The https://www.oracle.com/technetwork/java/javaee/javaserverfaces-139869.html[JSF] homepage
|
||||
* The https://struts.apache.org/[Struts] homepage
|
||||
* The https://tapestry.apache.org/[Tapestry] homepage
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromUriString("http://example.com/hotels/{hotel}") // <1>
|
||||
.fromUriString("https://example.com/hotels/{hotel}") // <1>
|
||||
.queryParam("q", "{q}") // <2>
|
||||
.encode() // <3>
|
||||
.build(); // <4>
|
||||
@@ -29,7 +29,7 @@ as the following example shows:
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
URI uri = UriComponentsBuilder
|
||||
.fromUriString("http://example.com/hotels/{hotel}")
|
||||
.fromUriString("https://example.com/hotels/{hotel}")
|
||||
.queryParam("q", "{q}")
|
||||
.encode()
|
||||
.buildAndExpand("Westin", "123")
|
||||
@@ -43,7 +43,7 @@ as the following example shows:
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
URI uri = UriComponentsBuilder
|
||||
.fromUriString("http://example.com/hotels/{hotel}")
|
||||
.fromUriString("https://example.com/hotels/{hotel}")
|
||||
.queryParam("q", "{q}")
|
||||
.build("Westin", "123");
|
||||
----
|
||||
@@ -54,7 +54,7 @@ You shorter it further still with a full URI template, as the following example
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
URI uri = UriComponentsBuilder
|
||||
.fromUriString("http://example.com/hotels/{hotel}?q={q}")
|
||||
.fromUriString("https://example.com/hotels/{hotel}?q={q}")
|
||||
.build("Westin", "123");
|
||||
----
|
||||
|
||||
@@ -81,7 +81,7 @@ The following example shows how to configure a `RestTemplate`:
|
||||
----
|
||||
// import org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode;
|
||||
|
||||
String baseUrl = "http://example.org";
|
||||
String baseUrl = "https://example.org";
|
||||
DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory(baseUrl);
|
||||
factory.setEncodingMode(EncodingMode.TEMPLATE_AND_VARIABLES);
|
||||
|
||||
@@ -96,7 +96,7 @@ The following example configures a `WebClient`:
|
||||
----
|
||||
// import org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode;
|
||||
|
||||
String baseUrl = "http://example.org";
|
||||
String baseUrl = "https://example.org";
|
||||
DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory(baseUrl);
|
||||
factory.setEncodingMode(EncodingMode.TEMPLATE_AND_VARIABLES);
|
||||
|
||||
@@ -110,7 +110,7 @@ that holds configuration and preferences, as the following example shows:
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
String baseUrl = "http://example.com";
|
||||
String baseUrl = "https://example.com";
|
||||
DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory(baseUrl);
|
||||
|
||||
URI uri = uriBuilderFactory.uriString("/hotels/{hotel}")
|
||||
@@ -183,7 +183,7 @@ as the following example shows:
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
String baseUrl = "http://example.com";
|
||||
String baseUrl = "https://example.com";
|
||||
DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory(baseUrl)
|
||||
factory.setEncodingMode(EncodingMode.TEMPLATE_AND_VALUES);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ from evil.com should not be able to make AJAX requests to your bank API with you
|
||||
credentials -- for example, withdrawing money from your account!
|
||||
|
||||
Cross-Origin Resource Sharing (CORS) is a http://www.w3.org/TR/cors/[W3C specification]
|
||||
implemented by http://caniuse.com/#feat=cors[most browsers] that lets you specify
|
||||
implemented by https://caniuse.com/#feat=cors[most browsers] that lets you specify
|
||||
what kind of cross-domain requests are authorized, rather than using less secure and less
|
||||
powerful workarounds based on IFRAME or JSONP.
|
||||
|
||||
@@ -122,7 +122,7 @@ The following example specifies a certain domain and sets `maxAge` to an hour:
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
@CrossOrigin(origins = "http://domain2.com", maxAge = 3600)
|
||||
@CrossOrigin(origins = "https://domain2.com", maxAge = 3600)
|
||||
@RestController
|
||||
@RequestMapping("/account")
|
||||
public class AccountController {
|
||||
@@ -150,7 +150,7 @@ as the following example shows:
|
||||
@RequestMapping("/account")
|
||||
public class AccountController {
|
||||
|
||||
@CrossOrigin("http://domain2.com") <2>
|
||||
@CrossOrigin("https://domain2.com") <2>
|
||||
@GetMapping("/{id}")
|
||||
public Mono<Account> retrieve(@PathVariable Long id) {
|
||||
// ...
|
||||
@@ -202,7 +202,7 @@ public class WebConfig implements WebFluxConfigurer {
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
|
||||
registry.addMapping("/api/**")
|
||||
.allowedOrigins("http://domain2.com")
|
||||
.allowedOrigins("https://domain2.com")
|
||||
.allowedMethods("PUT", "DELETE")
|
||||
.allowedHeaders("header1", "header2", "header3")
|
||||
.exposedHeaders("header1", "header2")
|
||||
@@ -244,7 +244,7 @@ CorsWebFilter corsFilter() {
|
||||
// config.applyPermitDefaultValues()
|
||||
|
||||
config.setAllowCredentials(true);
|
||||
config.addAllowedOrigin("http://domain1.com");
|
||||
config.addAllowedOrigin("https://domain1.com");
|
||||
config.addAllowedHeader("*");
|
||||
config.addAllowedMethod("*");
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ Most applications can run through the WebFlux Java configuration, see <<webflux-
|
||||
|
||||
`ServerRequest` and `ServerResponse` are immutable interfaces that offer JDK 8-friendly
|
||||
access to the HTTP request and response.
|
||||
Both request and response provide http://www.reactive-streams.org[Reactive Streams] back pressure
|
||||
Both request and response provide https://www.reactive-streams.org[Reactive Streams] back pressure
|
||||
against the body streams.
|
||||
The request body is represented with a Reactor `Flux` or `Mono`.
|
||||
The response body is represented with any Reactive Streams `Publisher`, including `Flux` and `Mono`.
|
||||
|
||||
@@ -19,13 +19,13 @@ templates that can be previewed in a browser by double-clicking, which is very
|
||||
helpful for independent work on UI templates (for example, by a designer) without the need for a
|
||||
running server. Thymeleaf offers an extensive set of features, and it is actively developed
|
||||
and maintained. For a more complete introduction, see the
|
||||
http://www.thymeleaf.org/[Thymeleaf] project home page.
|
||||
https://www.thymeleaf.org/[Thymeleaf] project home page.
|
||||
|
||||
The Thymeleaf integration with Spring WebFlux is managed by the Thymeleaf project. The
|
||||
configuration involves a few bean declarations, such as
|
||||
`SpringResourceTemplateResolver`, `SpringWebFluxTemplateEngine`, and
|
||||
`ThymeleafReactiveViewResolver`. For more details, see
|
||||
http://www.thymeleaf.org/documentation.html[Thymeleaf+Spring] and the WebFlux integration
|
||||
https://www.thymeleaf.org/documentation.html[Thymeleaf+Spring] and the WebFlux integration
|
||||
http://forum.thymeleaf.org/Thymeleaf-3-0-8-JUST-PUBLISHED-td4030687.html[announcement].
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ http://forum.thymeleaf.org/Thymeleaf-3-0-8-JUST-PUBLISHED-td4030687.html[announc
|
||||
== FreeMarker
|
||||
[.small]#<<web.adoc#mvc-view-freemarker, Same as in Spring MVC>>#
|
||||
|
||||
http://www.freemarker.org[Apache FreeMarker] is a template engine for generating any
|
||||
https://freemarker.apache.org/[Apache FreeMarker] is a template engine for generating any
|
||||
kind of text output from HTML to email and others. The Spring Framework has a built-in
|
||||
integration for using Spring WebFlux with FreeMarker templates.
|
||||
|
||||
@@ -127,13 +127,13 @@ The following table shows the templating libraries that we have tested on differ
|
||||
[%header]
|
||||
|===
|
||||
|Scripting Library |Scripting Engine
|
||||
|http://handlebarsjs.com/[Handlebars] |http://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://mustache.github.io/[Mustache] |http://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|http://facebook.github.io/react/[React] |http://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|http://www.embeddedjs.com/[EJS] |http://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|http://www.stuartellis.eu/articles/erb/[ERB] |http://jruby.org[JRuby]
|
||||
|https://docs.python.org/2/library/string.html#template-strings[String templates] |http://www.jython.org/[Jython]
|
||||
|https://github.com/sdeleuze/kotlin-script-templating[Kotlin Script templating] |http://kotlinlang.org/[Kotlin]
|
||||
|https://handlebarsjs.com/[Handlebars] |https://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://mustache.github.io/[Mustache] |https://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://facebook.github.io/react/[React] |https://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://www.embeddedjs.com/[EJS] |https://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://www.stuartellis.name/articles/erb/[ERB] |https://www.jruby.org[JRuby]
|
||||
|https://docs.python.org/2/library/string.html#template-strings[String templates] |https://www.jython.org/[Jython]
|
||||
|https://github.com/sdeleuze/kotlin-script-templating[Kotlin Script templating] |https://kotlinlang.org/[Kotlin]
|
||||
|===
|
||||
|
||||
TIP: The basic rule for integrating any other script engine is that it must implement the
|
||||
@@ -147,17 +147,17 @@ TIP: The basic rule for integrating any other script engine is that it must impl
|
||||
|
||||
You need to have the script engine on your classpath, the details of which vary by script engine:
|
||||
|
||||
* The http://openjdk.java.net/projects/nashorn/[Nashorn] JavaScript engine is provided with
|
||||
* The https://openjdk.java.net/projects/nashorn/[Nashorn] JavaScript engine is provided with
|
||||
Java 8+. Using the latest update release available is highly recommended.
|
||||
* http://jruby.org[JRuby] should be added as a dependency for Ruby support.
|
||||
* http://www.jython.org[Jython] should be added as a dependency for Python support.
|
||||
* https://www.jruby.org[JRuby] should be added as a dependency for Ruby support.
|
||||
* https://www.jython.org[Jython] should be added as a dependency for Python support.
|
||||
* `org.jetbrains.kotlin:kotlin-script-util` dependency and a `META-INF/services/javax.script.ScriptEngineFactory`
|
||||
file containing a `org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory`
|
||||
line should be added for Kotlin script support. See
|
||||
https://github.com/sdeleuze/kotlin-script-templating[this example] for more detail.
|
||||
|
||||
You need to have the script templating library. One way to do that for Javascript is
|
||||
through http://www.webjars.org/[WebJars].
|
||||
through https://www.webjars.org/[WebJars].
|
||||
|
||||
|
||||
|
||||
@@ -205,9 +205,9 @@ The `render` function is called with the following parameters:
|
||||
`Mustache.render()` is natively compatible with this signature, so you can call it directly.
|
||||
|
||||
If your templating technology requires some customization, you can provide a script that
|
||||
implements a custom render function. For example, http://handlebarsjs.com[Handlerbars]
|
||||
implements a custom render function. For example, https://handlebarsjs.com[Handlerbars]
|
||||
needs to compile templates before using them and requires a
|
||||
http://en.wikipedia.org/wiki/Polyfill[polyfill] in order to emulate some
|
||||
https://en.wikipedia.org/wiki/Polyfill[polyfill] in order to emulate some
|
||||
browser facilities not available in the server-side script engine.
|
||||
The following example shows how to set a custom render function:
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ The following example shows how to do so:
|
||||
[source,java,intent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
WebClient client = WebClient.create("http://example.org");
|
||||
WebClient client = WebClient.create("https://example.org");
|
||||
|
||||
Mono<Person> result = client.get()
|
||||
.uri("/persons/{id}", id).accept(MediaType.APPLICATION_JSON)
|
||||
@@ -513,7 +513,7 @@ WebClient client = WebClient.builder()
|
||||
})
|
||||
.build();
|
||||
|
||||
client.get().uri("http://example.org/")
|
||||
client.get().uri("https://example.org/")
|
||||
.attribute("myAttribute", "...")
|
||||
.retrieve()
|
||||
.bodyToMono(Void.class);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
The original web framework included in the Spring Framework, Spring Web MVC, was
|
||||
purpose-built for the Servlet API and Servlet containers. The reactive-stack web framework,
|
||||
Spring WebFlux, was added later in version 5.0. It is fully non-blocking, supports
|
||||
http://www.reactive-streams.org/[Reactive Streams] back pressure, and runs on such servers as
|
||||
https://www.reactive-streams.org/[Reactive Streams] back pressure, and runs on such servers as
|
||||
Netty, Undertow, and Servlet 3.1+ containers.
|
||||
|
||||
Both web frameworks mirror the names of their source modules
|
||||
@@ -62,9 +62,9 @@ https://github.com/reactive-streams/reactive-streams-jvm/blob/master/README.md#s
|
||||
(also https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.html[adopted] in Java 9)
|
||||
that defines the interaction between asynchronous components with back pressure.
|
||||
For example a data repository (acting as
|
||||
http://www.reactive-streams.org/reactive-streams-1.0.1-javadoc/org/reactivestreams/Publisher.html[Publisher])
|
||||
https://www.reactive-streams.org/reactive-streams-1.0.1-javadoc/org/reactivestreams/Publisher.html[Publisher])
|
||||
can produce data that an HTTP server (acting as
|
||||
http://www.reactive-streams.org/reactive-streams-1.0.1-javadoc/org/reactivestreams/Subscriber.html[Subscriber])
|
||||
https://www.reactive-streams.org/reactive-streams-1.0.1-javadoc/org/reactivestreams/Subscriber.html[Subscriber])
|
||||
can then write to the response. The main purpose of Reactive Streams is to let the
|
||||
subscriber to control how quickly or how slowly the publisher produces data.
|
||||
|
||||
@@ -1083,7 +1083,7 @@ The net effect is the same as if the controller had returned a `RedirectView` or
|
||||
`Rendering.redirectTo("abc").build()`, but now the controller itself can
|
||||
operate in terms of logical view names. A view name such as
|
||||
`redirect:/some/resource` is relative to the current application, while a view name such as
|
||||
`redirect:http://example.com/arbitrary/path` redirects to an absolute URL.
|
||||
`redirect:https://example.com/arbitrary/path` redirects to an absolute URL.
|
||||
|
||||
|
||||
[[webflux-multiple-representations]]
|
||||
@@ -1696,9 +1696,9 @@ can be customized through a `WebDataBinder` (see <<mvc-ann-initbinder>>) or by r
|
||||
==== Matrix Variables
|
||||
[.small]#<<web.adoc#mvc-ann-matrix-variables, Same as in Spring MVC>>#
|
||||
|
||||
http://tools.ietf.org/html/rfc3986#section-3.3[RFC 3986] discusses name-value pairs in
|
||||
https://tools.ietf.org/html/rfc3986#section-3.3[RFC 3986] discusses name-value pairs in
|
||||
path segments. In Spring WebFlux, we refer to those as "`matrix variables`" based on an
|
||||
http://www.w3.org/DesignIssues/MatrixURIs.html["`old post`"] by Tim Berners-Lee, but they
|
||||
https://www.w3.org/DesignIssues/MatrixURIs.html["`old post`"] by Tim Berners-Lee, but they
|
||||
can be also be referred to as URI path parameters.
|
||||
|
||||
Matrix variables can appear in any path segment, with each variable separated by a semicolon and
|
||||
@@ -2369,7 +2369,7 @@ Spring offers support for the Jackson JSON library.
|
||||
[.small]#<<web.adoc#mvc-ann-jackson, Same as in Spring MVC>>#
|
||||
|
||||
Spring WebFlux provides built-in support for
|
||||
http://wiki.fasterxml.com/JacksonJsonViews[Jackson's Serialization Views],
|
||||
https://wiki.fasterxml.com/JacksonJsonViews[Jackson's Serialization Views],
|
||||
which allows rendering only a subset of all fields in an `Object`. To use it with
|
||||
`@ResponseBody` or `ResponseEntity` controller methods, you can use Jackson's
|
||||
`@JsonView` annotation to activate a serialization view class, as the following example shows:
|
||||
@@ -2708,7 +2708,7 @@ include::webflux-cors.adoc[leveloffset=+1]
|
||||
== Web Security
|
||||
[.small]#<<web.adoc#mvc-web-security, Same as in Spring MVC>>#
|
||||
|
||||
The http://projects.spring.io/spring-security/[Spring Security] project provides support
|
||||
The https://projects.spring.io/spring-security/[Spring Security] project provides support
|
||||
for protecting web applications from malicious exploits. See the Spring Security
|
||||
reference documentation, including:
|
||||
|
||||
@@ -3033,8 +3033,8 @@ For Jackson JSON and XML, consider using
|
||||
{api-spring-framework}/http/converter/json/Jackson2ObjectMapperBuilder.html[`Jackson2ObjectMapperBuilder`],
|
||||
which customizes Jackson's default properties with the following ones:
|
||||
|
||||
* http://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/DeserializationFeature.html#FAIL_ON_UNKNOWN_PROPERTIES[`DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES`] is disabled.
|
||||
* http://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/MapperFeature.html#DEFAULT_VIEW_INCLUSION[`MapperFeature.DEFAULT_VIEW_INCLUSION`] is disabled.
|
||||
* https://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/DeserializationFeature.html#FAIL_ON_UNKNOWN_PROPERTIES[`DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES`] is disabled.
|
||||
* https://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/MapperFeature.html#DEFAULT_VIEW_INCLUSION[`MapperFeature.DEFAULT_VIEW_INCLUSION`] is disabled.
|
||||
|
||||
It also automatically registers the following well-known modules if they are detected on the classpath:
|
||||
|
||||
@@ -3216,7 +3216,7 @@ Note that, when using both `EncodedResourceResolver` (for example, Gzip, Brotli
|
||||
`VersionedResourceResolver`, they must be registered in that order, to ensure content-based
|
||||
versions are always computed reliably based on the unencoded file.
|
||||
|
||||
http://www.webjars.org/documentation[WebJars] are also supported through the
|
||||
https://www.webjars.org/documentation[WebJars] are also supported through the
|
||||
`WebJarsResourceResolver` which is automatically registered when the
|
||||
`org.webjars:webjars-locator-core` library is present on the classpath. The resolver can
|
||||
re-write URLs to include the version of the jar and can also match against incoming URLs
|
||||
|
||||
@@ -18,7 +18,7 @@ from evil.com should not be able to make AJAX requests to your bank API with you
|
||||
credentials -- for example withdrawing money from your account!
|
||||
|
||||
Cross-Origin Resource Sharing (CORS) is a http://www.w3.org/TR/cors/[W3C specification]
|
||||
implemented by http://caniuse.com/#feat=cors[most browsers] that lets you specify
|
||||
implemented by https://caniuse.com/#feat=cors[most browsers] that lets you specify
|
||||
what kind of cross-domain requests are authorized, rather than using less secure and less
|
||||
powerful workarounds based on IFRAME or JSONP.
|
||||
|
||||
@@ -121,7 +121,7 @@ as the following example shows:
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
@CrossOrigin(origins = "http://domain2.com", maxAge = 3600)
|
||||
@CrossOrigin(origins = "https://domain2.com", maxAge = 3600)
|
||||
@RestController
|
||||
@RequestMapping("/account")
|
||||
public class AccountController {
|
||||
@@ -149,7 +149,7 @@ as the following example shows:
|
||||
@RequestMapping("/account")
|
||||
public class AccountController {
|
||||
|
||||
@CrossOrigin("http://domain2.com")
|
||||
@CrossOrigin("https://domain2.com")
|
||||
@GetMapping("/{id}")
|
||||
public Account retrieve(@PathVariable Long id) {
|
||||
// ...
|
||||
@@ -207,7 +207,7 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
|
||||
registry.addMapping("/api/**")
|
||||
.allowedOrigins("http://domain2.com")
|
||||
.allowedOrigins("https://domain2.com")
|
||||
.allowedMethods("PUT", "DELETE")
|
||||
.allowedHeaders("header1", "header2", "header3")
|
||||
.exposedHeaders("header1", "header2")
|
||||
@@ -232,14 +232,14 @@ as the following example shows:
|
||||
<mvc:cors>
|
||||
|
||||
<mvc:mapping path="/api/**"
|
||||
allowed-origins="http://domain1.com, http://domain2.com"
|
||||
allowed-origins="https://domain1.com, https://domain2.com"
|
||||
allowed-methods="GET, PUT"
|
||||
allowed-headers="header1, header2, header3"
|
||||
exposed-headers="header1, header2" allow-credentials="true"
|
||||
max-age="123" />
|
||||
|
||||
<mvc:mapping path="/resources/**"
|
||||
allowed-origins="http://domain1.com" />
|
||||
allowed-origins="https://domain1.com" />
|
||||
|
||||
</mvc:cors>
|
||||
----
|
||||
@@ -271,7 +271,7 @@ CorsConfiguration config = new CorsConfiguration();
|
||||
// config.applyPermitDefaultValues()
|
||||
|
||||
config.setAllowCredentials(true);
|
||||
config.addAllowedOrigin("http://domain1.com");
|
||||
config.addAllowedOrigin("https://domain1.com");
|
||||
config.addAllowedHeader("*");
|
||||
config.addAllowedMethod("*");
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ for independent work on UI templates (for example, by a designer) without the ne
|
||||
a running server. If you want to replace JSPs, Thymeleaf offers one of the most
|
||||
extensive set of features to make such a transition easier. Thymeleaf is actively
|
||||
developed and maintained. For a more complete introduction, see the
|
||||
http://www.thymeleaf.org/[Thymeleaf] project home page.
|
||||
https://www.thymeleaf.org/[Thymeleaf] project home page.
|
||||
|
||||
The Thymeleaf integration with Spring MVC is managed by the Thymeleaf project.
|
||||
The configuration involves a few bean declarations, such as
|
||||
`ServletContextTemplateResolver`, `SpringTemplateEngine`, and `ThymeleafViewResolver`.
|
||||
See http://www.thymeleaf.org/documentation.html[Thymeleaf+Spring] for more details.
|
||||
See https://www.thymeleaf.org/documentation.html[Thymeleaf+Spring] for more details.
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ See http://www.thymeleaf.org/documentation.html[Thymeleaf+Spring] for more detai
|
||||
== FreeMarker
|
||||
[.small]#<<web-reactive.adoc#webflux-view-freemarker, Same as in Spring WebFlux>>#
|
||||
|
||||
http://www.freemarker.org[Apache FreeMarker] is a template engine for generating any
|
||||
https://freemarker.apache.org/[Apache FreeMarker] is a template engine for generating any
|
||||
kind of text output from HTML to email and others. The Spring Framework has a built-in
|
||||
integration for using Spring MVC with FreeMarker templates.
|
||||
|
||||
@@ -546,13 +546,13 @@ templating libraries on different script engines:
|
||||
[%header]
|
||||
|===
|
||||
|Scripting Library |Scripting Engine
|
||||
|http://handlebarsjs.com/[Handlebars] |http://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://mustache.github.io/[Mustache] |http://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|http://facebook.github.io/react/[React] |http://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|http://www.embeddedjs.com/[EJS] |http://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|http://www.stuartellis.eu/articles/erb/[ERB] |http://jruby.org[JRuby]
|
||||
|https://docs.python.org/2/library/string.html#template-strings[String templates] |http://www.jython.org/[Jython]
|
||||
|https://github.com/sdeleuze/kotlin-script-templating[Kotlin Script templating] |http://kotlinlang.org/[Kotlin]
|
||||
|https://handlebarsjs.com/[Handlebars] |https://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://mustache.github.io/[Mustache] |https://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://facebook.github.io/react/[React] |https://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://www.embeddedjs.com/[EJS] |https://openjdk.java.net/projects/nashorn/[Nashorn]
|
||||
|https://www.stuartellis.name/articles/erb/[ERB] |https://www.jruby.org[JRuby]
|
||||
|https://docs.python.org/2/library/string.html#template-strings[String templates] |https://www.jython.org/[Jython]
|
||||
|https://github.com/sdeleuze/kotlin-script-templating[Kotlin Script templating] |https://kotlinlang.org/[Kotlin]
|
||||
|===
|
||||
|
||||
TIP: The basic rule for integrating any other script engine is that it must implement the
|
||||
@@ -566,17 +566,17 @@ TIP: The basic rule for integrating any other script engine is that it must impl
|
||||
|
||||
You need to have the script engine on your classpath, the details of which vary by script engine:
|
||||
|
||||
* The http://openjdk.java.net/projects/nashorn/[Nashorn] JavaScript engine is provided with
|
||||
* The https://openjdk.java.net/projects/nashorn/[Nashorn] JavaScript engine is provided with
|
||||
Java 8+. Using the latest update release available is highly recommended.
|
||||
* http://jruby.org[JRuby] should be added as a dependency for Ruby support.
|
||||
* http://www.jython.org[Jython] should be added as a dependency for Python support.
|
||||
* https://www.jruby.org[JRuby] should be added as a dependency for Ruby support.
|
||||
* https://www.jython.org[Jython] should be added as a dependency for Python support.
|
||||
* `org.jetbrains.kotlin:kotlin-script-util` dependency and a `META-INF/services/javax.script.ScriptEngineFactory`
|
||||
file containing a `org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory`
|
||||
line should be added for Kotlin script support. See
|
||||
https://github.com/sdeleuze/kotlin-script-templating[this example] for more details.
|
||||
|
||||
You need to have the script templating library. One way to do that for Javascript is
|
||||
through http://www.webjars.org/[WebJars].
|
||||
through https://www.webjars.org/[WebJars].
|
||||
|
||||
|
||||
|
||||
@@ -672,9 +672,9 @@ The render function is called with the following parameters:
|
||||
`Mustache.render()` is natively compatible with this signature, so you can call it directly.
|
||||
|
||||
If your templating technology requires some customization, you can provide a script that
|
||||
implements a custom render function. For example, http://handlebarsjs.com[Handlerbars]
|
||||
implements a custom render function. For example, https://handlebarsjs.com[Handlerbars]
|
||||
needs to compile templates before using them and requires a
|
||||
http://en.wikipedia.org/wiki/Polyfill[polyfill] to emulate some
|
||||
https://en.wikipedia.org/wiki/Polyfill[polyfill] to emulate some
|
||||
browser facilities that are not available in the server-side script engine.
|
||||
|
||||
The following example shows how to do so:
|
||||
@@ -1597,7 +1597,7 @@ NOTE: This section focuses on Spring's support for Tiles version 3 in the
|
||||
=== Dependencies
|
||||
|
||||
To be able to use Tiles, you have to add a dependency on Tiles version 3.0.1 or higher
|
||||
and http://tiles.apache.org/framework/dependency-management.html[its transitive dependencies]
|
||||
and https://tiles.apache.org/framework/dependency-management.html[its transitive dependencies]
|
||||
to your project.
|
||||
|
||||
|
||||
@@ -1607,7 +1607,7 @@ to your project.
|
||||
|
||||
To be able to use Tiles, you have to configure it by using files that contain definitions
|
||||
(for basic information on definitions and other Tiles concepts, see
|
||||
http://tiles.apache.org[]). In Spring, this is done by using the `TilesConfigurer`.
|
||||
https://tiles.apache.org[]). In Spring, this is done by using the `TilesConfigurer`.
|
||||
The following example `ApplicationContext` configuration shows how to do so:
|
||||
|
||||
[source,xml,indent=0]
|
||||
|
||||
@@ -691,7 +691,7 @@ redirect is needed. The rest of the view name is the redirect URL.
|
||||
The net effect is the same as if the controller had returned a `RedirectView`, but now
|
||||
the controller itself can operate in terms of logical view names. A logical view
|
||||
name (such as `redirect:/myapp/some/resource`) redirects relative to the current
|
||||
Servlet context, while a name such as `redirect:http://myhost.com/some/arbitrary/path`
|
||||
Servlet context, while a name such as `redirect:https://myhost.com/some/arbitrary/path`
|
||||
redirects to an absolute URL.
|
||||
|
||||
Note that, if a controller method is annotated with the `@ResponseStatus`, the annotation
|
||||
@@ -853,7 +853,7 @@ You can enable changing of locales by adding the `LocaleChangeInterceptor` to on
|
||||
accordingly, calling the `setLocale` method on the `LocaleResolver` in the dispatcher's
|
||||
application context. The next example shows that calls to all `{asterisk}.view` resources
|
||||
that contain a parameter named `siteLanguage` now changes the locale. So, for example,
|
||||
a request for the URL, `http://www.sf.net/home.view?siteLanguage=nl`, changes the site
|
||||
a request for the URL, `https://www.sf.net/home.view?siteLanguage=nl`, changes the site
|
||||
language to Dutch. The following example shows how to intercept the locale:
|
||||
|
||||
[source,xml,indent=0]
|
||||
@@ -979,7 +979,7 @@ request with a simple request parameter.
|
||||
|
||||
`MultipartResolver` from the `org.springframework.web.multipart` package is a strategy
|
||||
for parsing multipart requests including file uploads. There is one implementation
|
||||
based on http://jakarta.apache.org/commons/fileupload[Commons FileUpload] and another
|
||||
based on https://jakarta.apache.org/commons/fileupload[Commons FileUpload] and another
|
||||
based on Servlet 3.0 multipart request parsing.
|
||||
|
||||
To enable multipart handling, you need to declare a `MultipartResolver` bean in your
|
||||
@@ -1239,9 +1239,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
https://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:component-scan base-package="org.example.web"/>
|
||||
|
||||
@@ -1462,7 +1462,7 @@ Many common path extensions are whitelisted by default. Applications with custom
|
||||
negotiation to avoid having a `Content-Disposition` header added for those extensions.
|
||||
See <<mvc-config-content-negotiation>>.
|
||||
|
||||
See http://pivotal.io/security/cve-2015-5211[CVE-2015-5211] for additional
|
||||
See https://pivotal.io/security/cve-2015-5211[CVE-2015-5211] for additional
|
||||
recommendations related to RFD.
|
||||
|
||||
|
||||
@@ -1914,9 +1914,9 @@ See <<core.adoc#format, Spring Field Formatting>>.
|
||||
==== Matrix Variables
|
||||
[.small]#<<web-reactive.adoc#webflux-ann-matrix-variables, Same as in Spring WebFlux>>#
|
||||
|
||||
http://tools.ietf.org/html/rfc3986#section-3.3[RFC 3986] discusses name-value pairs in
|
||||
https://tools.ietf.org/html/rfc3986#section-3.3[RFC 3986] discusses name-value pairs in
|
||||
path segments. In Spring MVC, we refer to those as "`matrix variables`" based on an
|
||||
http://www.w3.org/DesignIssues/MatrixURIs.html["`old post`"] by Tim Berners-Lee, but they
|
||||
https://www.w3.org/DesignIssues/MatrixURIs.html["`old post`"] by Tim Berners-Lee, but they
|
||||
can be also be referred to as URI path parameters.
|
||||
|
||||
Matrix variables can appear in any path segment, with each variable separated by a semicolon and
|
||||
@@ -2693,7 +2693,7 @@ Spring offers support for the Jackson JSON library.
|
||||
[.small]#<<web-reactive.adoc#webflux-ann-jsonview, Same as in Spring WebFlux>>#
|
||||
|
||||
Spring MVC provides built-in support for
|
||||
http://wiki.fasterxml.com/JacksonJsonViews[Jackson's Serialization Views],
|
||||
https://wiki.fasterxml.com/JacksonJsonViews[Jackson's Serialization Views],
|
||||
which allow rendering only a subset of all fields in an `Object`. To use it with
|
||||
`@ResponseBody` or `ResponseEntity` controller methods, you can use Jackson's
|
||||
`@JsonView` annotation to activate a serialization view class, as the following example shows:
|
||||
@@ -3609,7 +3609,7 @@ invokes the configured exception resolvers and completes the request.
|
||||
==== SSE
|
||||
|
||||
`SseEmitter` (a subclass of `ResponseBodyEmitter`) provides support for
|
||||
http://www.w3.org/TR/eventsource/[Server-Sent Events], where events sent from the server
|
||||
https://www.w3.org/TR/eventsource/[Server-Sent Events], where events sent from the server
|
||||
are formatted according to the W3C SSE specification. To produce an SSE
|
||||
stream from a controller, return `SseEmitter`, as the following example shows:
|
||||
|
||||
@@ -3775,7 +3775,7 @@ include::webmvc-cors.adoc[leveloffset=+1]
|
||||
== Web Security
|
||||
[.small]#<<web-reactive.adoc#webflux-web-security, Same as in Spring WebFlux>>#
|
||||
|
||||
The http://projects.spring.io/spring-security/[Spring Security] project provides support
|
||||
The https://projects.spring.io/spring-security/[Spring Security] project provides support
|
||||
for protecting web applications from malicious exploits. See the Spring Security
|
||||
reference documentation, including:
|
||||
|
||||
@@ -3784,7 +3784,7 @@ reference documentation, including:
|
||||
* {doc-spring-security}/html5/#csrf[CSRF protection]
|
||||
* {doc-spring-security}/html5/#headers[Security Response Headers]
|
||||
|
||||
http://hdiv.org/[HDIV] is another web security framework that integrates with Spring MVC.
|
||||
https://hdiv.org/[HDIV] is another web security framework that integrates with Spring MVC.
|
||||
|
||||
|
||||
|
||||
@@ -3973,9 +3973,9 @@ configuration, as the following example shows:
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
|
||||
https://www.springframework.org/schema/mvc/spring-mvc.xsd">
|
||||
|
||||
<mvc:annotation-driven/>
|
||||
|
||||
@@ -4007,7 +4007,7 @@ following example shows:
|
||||
----
|
||||
|
||||
In XML, you can check attributes and sub-elements of `<mvc:annotation-driven/>`. You can
|
||||
view the http://schema.spring.io/mvc/spring-mvc.xsd[Spring MVC XML schema] or use
|
||||
view the https://schema.spring.io/mvc/spring-mvc.xsd[Spring MVC XML schema] or use
|
||||
the code completion feature of your IDE to discover what attributes and
|
||||
sub-elements are available.
|
||||
|
||||
@@ -4049,9 +4049,9 @@ The following example shows how to achieve the same configuration in XML:
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
|
||||
https://www.springframework.org/schema/mvc/spring-mvc.xsd">
|
||||
|
||||
<mvc:annotation-driven conversion-service="conversionService"/>
|
||||
|
||||
@@ -4121,9 +4121,9 @@ The following example shows how to achieve the same configuration in XML:
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
|
||||
https://www.springframework.org/schema/mvc/spring-mvc.xsd">
|
||||
|
||||
<mvc:annotation-driven validator="globalValidator"/>
|
||||
|
||||
@@ -4290,8 +4290,8 @@ Which adds support for accessing parameter names (a feature added in Java 8).
|
||||
|
||||
This builder customizes Jackson's default properties as follows:
|
||||
|
||||
* http://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/DeserializationFeature.html#FAIL_ON_UNKNOWN_PROPERTIES[`DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES`] is disabled.
|
||||
* http://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/MapperFeature.html#DEFAULT_VIEW_INCLUSION[`MapperFeature.DEFAULT_VIEW_INCLUSION`] is disabled.
|
||||
* https://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/DeserializationFeature.html#FAIL_ON_UNKNOWN_PROPERTIES[`DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES`] is disabled.
|
||||
* https://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/MapperFeature.html#DEFAULT_VIEW_INCLUSION[`MapperFeature.DEFAULT_VIEW_INCLUSION`] is disabled.
|
||||
|
||||
It also automatically registers the following well-known modules if they are detected on the classpath:
|
||||
|
||||
@@ -4301,8 +4301,8 @@ It also automatically registers the following well-known modules if they are det
|
||||
* https://github.com/FasterXML/jackson-datatype-jdk8[jackson-datatype-jdk8]: Support for other Java 8 types, such as `Optional`.
|
||||
|
||||
NOTE: Enabling indentation with Jackson XML support requires
|
||||
http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.codehaus.woodstox%22%20AND%20a%3A%22woodstox-core-asl%22[`woodstox-core-asl`]
|
||||
dependency in addition to http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22jackson-dataformat-xml%22[`jackson-dataformat-xml`] one.
|
||||
https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.codehaus.woodstox%22%20AND%20a%3A%22woodstox-core-asl%22[`woodstox-core-asl`]
|
||||
dependency in addition to https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22jackson-dataformat-xml%22[`jackson-dataformat-xml`] one.
|
||||
|
||||
Other interesting Jackson modules are available:
|
||||
|
||||
@@ -4560,7 +4560,7 @@ Note that, when using both `EncodedResourceResolver` (for example, for serving g
|
||||
brotli-encoded resources) and `VersionedResourceResolver`, you must register them in this order.
|
||||
That ensures content-based versions are always computed reliably, based on the unencoded file.
|
||||
|
||||
http://www.webjars.org/documentation[WebJars] are also supported through the
|
||||
https://www.webjars.org/documentation[WebJars] are also supported through the
|
||||
`WebJarsResourceResolver` which is automatically registered when the
|
||||
`org.webjars:webjars-locator-core` library is present on the classpath. The resolver can
|
||||
re-write URLs to include the version of the jar and can also match against incoming URLs
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[websocket-intro]]
|
||||
= Introduction to WebSocket
|
||||
|
||||
The WebSocket protocol, http://tools.ietf.org/html/rfc6455[RFC 6455], provides a standardized
|
||||
The WebSocket protocol, https://tools.ietf.org/html/rfc6455[RFC 6455], provides a standardized
|
||||
way to establish a full-duplex, two-way communication channel between client and server
|
||||
over a single TCP connection. It is a different TCP protocol from HTTP but is designed to
|
||||
work over HTTP, using ports 80 and 443 and allowing re-use of existing firewall rules.
|
||||
|
||||
@@ -83,9 +83,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:handlers>
|
||||
<websocket:mapping path="/myHandler" handler="myHandler"/>
|
||||
@@ -146,9 +146,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:handlers>
|
||||
<websocket:mapping path="/myHandler" handler="myHandler"/>
|
||||
@@ -225,7 +225,7 @@ through the use of the `<absolute-ordering />` element in `web.xml`, as the foll
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
https://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<absolute-ordering/>
|
||||
@@ -244,7 +244,7 @@ Java initialization API. The following example shows how to do so:
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
https://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<absolute-ordering>
|
||||
@@ -295,9 +295,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<bean class="org.springframework...ServletServerContainerFactoryBean">
|
||||
<property name="maxTextMessageBufferSize" value="8192"/>
|
||||
@@ -351,9 +351,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:handlers>
|
||||
<websocket:mapping path="/echo" handler="echoHandler"/>
|
||||
@@ -421,7 +421,7 @@ You can configure WebSocket and SockJS allowed origins, as the following example
|
||||
|
||||
@Override
|
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
registry.addHandler(myHandler(), "/myHandler").setAllowedOrigins("http://mydomain.com");
|
||||
registry.addHandler(myHandler(), "/myHandler").setAllowedOrigins("https://mydomain.com");
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -442,11 +442,11 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:handlers allowed-origins="http://mydomain.com">
|
||||
<websocket:handlers allowed-origins="https://mydomain.com">
|
||||
<websocket:mapping path="/myHandler" handler="myHandler" />
|
||||
</websocket:handlers>
|
||||
|
||||
@@ -485,7 +485,7 @@ SockJS consists of:
|
||||
|
||||
* The https://github.com/sockjs/sockjs-protocol[SockJS protocol]
|
||||
defined in the form of executable
|
||||
http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html[narrated tests].
|
||||
https://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html[narrated tests].
|
||||
* The https://github.com/sockjs/sockjs-client/[SockJS JavaScript client] -- a client library for use in browsers.
|
||||
* SockJS server implementations, including one in the Spring Framework `spring-websocket` module.
|
||||
* A SockJS Java client in the `spring-websocket` module (since version 4.1).
|
||||
@@ -507,7 +507,7 @@ polling is used.
|
||||
All transport requests have the following URL structure:
|
||||
|
||||
----
|
||||
http://host:port/myApp/myEndpoint/{server-id}/{session-id}/{transport}
|
||||
https://host:port/myApp/myEndpoint/{server-id}/{session-id}/{transport}
|
||||
----
|
||||
|
||||
where:
|
||||
@@ -535,7 +535,7 @@ see each transport one at a time. The SockJS client also provides a debug flag,
|
||||
which enables helpful messages in the browser console. On the server side, you can enable
|
||||
`TRACE` logging for `org.springframework.web.socket`.
|
||||
For even more detail, see the SockJS protocol
|
||||
http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html[narrated test].
|
||||
https://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html[narrated test].
|
||||
|
||||
|
||||
|
||||
@@ -574,9 +574,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:handlers>
|
||||
<websocket:mapping path="/myHandler" handler="myHandler"/>
|
||||
@@ -612,7 +612,7 @@ a key reason for having SockJS. This section covers important
|
||||
considerations about running in those browsers.
|
||||
|
||||
The SockJS client supports Ajax/XHR streaming in IE 8 and 9 by using Microsoft's
|
||||
http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx[`XDomainRequest`].
|
||||
https://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx[`XDomainRequest`].
|
||||
That works across domains but does not support sending cookies.
|
||||
Cookies are often essential for Java applications.
|
||||
However, since the SockJS client can be used with many server
|
||||
@@ -693,7 +693,7 @@ from concluding that a connection is hung. The Spring SockJS configuration has a
|
||||
called `heartbeatTime` that you can use to customize the frequency. By default, a
|
||||
heartbeat is sent after 25 seconds, assuming no other messages were sent on that
|
||||
connection. This 25-second value is in line with the following
|
||||
http://tools.ietf.org/html/rfc6202[IETF recommendation] for public Internet applications.
|
||||
https://tools.ietf.org/html/rfc6202[IETF recommendation] for public Internet applications.
|
||||
|
||||
NOTE: When using STOMP over WebSocket and SockJS, if the STOMP client and server negotiate
|
||||
heartbeats to be exchanged, the SockJS heartbeats are disabled.
|
||||
@@ -857,7 +857,7 @@ the server need to agree on some protocol that defines message content.
|
||||
[[websocket-stomp-overview]]
|
||||
=== Overview
|
||||
|
||||
http://stomp.github.io/stomp-specification-1.2.html#Abstract[STOMP] (Simple
|
||||
https://stomp.github.io/stomp-specification-1.2.html#Abstract[STOMP] (Simple
|
||||
Text Oriented Messaging Protocol) was originally created for scripting languages
|
||||
(such as Ruby, Python, and Perl) to connect to enterprise message brokers. It is
|
||||
designed to address a minimal subset of commonly used messaging patterns. STOMP can be
|
||||
@@ -947,7 +947,7 @@ client subscription.
|
||||
|
||||
The preceding overview is intended to provide the most basic understanding of the
|
||||
STOMP protocol. We recommended reviewing the protocol
|
||||
http://stomp.github.io/stomp-specification-1.2.html[specification] in full.
|
||||
https://stomp.github.io/stomp-specification-1.2.html[specification] in full.
|
||||
|
||||
|
||||
|
||||
@@ -1019,9 +1019,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:message-broker application-destination-prefix="/app">
|
||||
<websocket:stomp-endpoint path="/portfolio">
|
||||
@@ -1508,8 +1508,8 @@ As an alternative, you can upgrade your applications to use a full-featured
|
||||
message broker.
|
||||
|
||||
See the STOMP documentation for your message broker of choice (such as
|
||||
http://www.rabbitmq.com/stomp.html[RabbitMQ],
|
||||
http://activemq.apache.org/stomp.html[ActiveMQ], and others), install the broker,
|
||||
https://www.rabbitmq.com/stomp.html[RabbitMQ],
|
||||
https://activemq.apache.org/stomp.html[ActiveMQ], and others), install the broker,
|
||||
and run it with STOMP support enabled. Then you can enable the STOMP broker relay
|
||||
(instead of the simple broker) in the Spring configuration.
|
||||
|
||||
@@ -1546,9 +1546,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:message-broker application-destination-prefix="/app">
|
||||
<websocket:stomp-endpoint path="/portfolio" />
|
||||
@@ -1686,9 +1686,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:message-broker application-destination-prefix="/app" path-matcher="pathMatcher">
|
||||
<websocket:stomp-endpoint path="/stomp"/>
|
||||
@@ -1768,7 +1768,7 @@ NOTE: Spring Security provides
|
||||
https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#websocket[WebSocket sub-protocol authorization]
|
||||
that uses a `ChannelInterceptor` to authorize messages based on the user header in them.
|
||||
Also, Spring Session provides a
|
||||
http://docs.spring.io/spring-session/docs/current/reference/html5/#websocket[WebSocket integration]
|
||||
https://docs.spring.io/spring-session/docs/current/reference/html5/#websocket[WebSocket integration]
|
||||
that ensures the user HTTP session does not expire when the WebSocket session is still active.
|
||||
|
||||
|
||||
@@ -1952,7 +1952,7 @@ over, all unique user queues are removed. For example, RabbitMQ creates auto-del
|
||||
queues when you use destinations such as `/exchange/amq.direct/position-updates`.
|
||||
So, in that case, the client could subscribe to `/user/exchange/amq.direct/position-updates`.
|
||||
Similarly, ActiveMQ has
|
||||
http://activemq.apache.org/delete-inactive-destinations.html[configuration options]
|
||||
https://activemq.apache.org/delete-inactive-destinations.html[configuration options]
|
||||
for purging inactive destinations.
|
||||
|
||||
In a multi-application server scenario, a user destination may remain unresolved because
|
||||
@@ -2000,9 +2000,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:message-broker preserve-publish-order="true">
|
||||
<!-- ... -->
|
||||
@@ -2379,9 +2379,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:message-broker>
|
||||
<websocket:transport send-timeout="15000" send-buffer-size="524288" />
|
||||
@@ -2434,9 +2434,9 @@ The following example shows the XML configuration equivalent of the preceding ex
|
||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/websocket
|
||||
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
https://www.springframework.org/schema/websocket/spring-websocket.xsd">
|
||||
|
||||
<websocket:message-broker>
|
||||
<websocket:transport message-size="131072" />
|
||||
|
||||
Reference in New Issue
Block a user