Browse Source

Update default SockJS CDN location

This commit updates the default location of the SockJS' client library.
The previous location is being retired by the project maintainers.

The new default location is backed by several CDN providers:
* https://cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js

See sockjs/sockjs-client#198

Issue: SPR-12254
pull/639/merge
Brian Clozel 11 years ago
parent
commit
a6e1c53f23
  1. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/SockJsServiceRegistration.java
  2. 2
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java
  3. 6
      spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java

2
spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/SockJsServiceRegistration.java

@ -83,7 +83,7 @@ public class SockJsServiceRegistration {
* this property allows specifying where to load it from. * this property allows specifying where to load it from.
* *
* <p>By default this is set to point to * <p>By default this is set to point to
* "https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.4.min.js". However it can * "https://cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js". However it can
* also be set to point to a URL served by the application. * also be set to point to a URL served by the application.
* *
* <p>Note that it's possible to specify a relative URL in which case the URL * <p>Note that it's possible to specify a relative URL in which case the URL

2
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java

@ -68,7 +68,7 @@ public abstract class AbstractSockJsService implements SockJsService {
private String name = "SockJSService@" + ObjectUtils.getIdentityHexString(this); private String name = "SockJSService@" + ObjectUtils.getIdentityHexString(this);
private String clientLibraryUrl = "https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.4.min.js"; private String clientLibraryUrl = "https://cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js";
private int streamBytesLimit = 128 * 1024; private int streamBytesLimit = 128 * 1024;

6
spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java

@ -148,15 +148,15 @@ public class SockJsServiceTests extends AbstractHttpRequestTests {
assertEquals("text/html;charset=UTF-8", this.servletResponse.getContentType()); assertEquals("text/html;charset=UTF-8", this.servletResponse.getContentType());
assertTrue(this.servletResponse.getContentAsString().startsWith("<!DOCTYPE html>\n")); assertTrue(this.servletResponse.getContentAsString().startsWith("<!DOCTYPE html>\n"));
assertEquals(496, this.servletResponse.getContentLength()); assertEquals(490, this.servletResponse.getContentLength());
assertEquals("public, max-age=31536000", this.response.getHeaders().getCacheControl()); assertEquals("public, max-age=31536000", this.response.getHeaders().getCacheControl());
assertEquals("\"0da1ed070012f304e47b83c81c48ad620\"", this.response.getHeaders().getETag()); assertEquals("\"06b486b3208b085d9e3220f456a6caca4\"", this.response.getHeaders().getETag());
} }
@Test @Test
public void handleIframeRequestNotModified() throws Exception { public void handleIframeRequestNotModified() throws Exception {
this.servletRequest.addHeader("If-None-Match", "\"0da1ed070012f304e47b83c81c48ad620\""); this.servletRequest.addHeader("If-None-Match", "\"06b486b3208b085d9e3220f456a6caca4\"");
resetResponseAndHandleRequest("GET", "/echo/iframe.html", HttpStatus.NOT_MODIFIED); resetResponseAndHandleRequest("GET", "/echo/iframe.html", HttpStatus.NOT_MODIFIED);
} }

Loading…
Cancel
Save