Update Javadoc on SockJS client library URL

Issue: SPR-11766
This commit is contained in:
Rossen Stoyanchev 2014-06-06 10:30:40 -04:00
parent 5cb3f8eada
commit 9706e5cc99
3 changed files with 44 additions and 17 deletions

View File

@ -73,16 +73,22 @@ public class SockJsServiceRegistration {
} }
/** /**
* Transports which don't support cross-domain communication natively (e.g. * Transports with no native cross-domain communication (e.g. "eventsource",
* "eventsource", "htmlfile") rely on serving a simple page (using the * "htmlfile") must get a simple page from the "foreign" domain in an invisible
* "foreign" domain) from an invisible iframe. Code run from this iframe * iframe so that code in the iframe can run from a domain local to the SockJS
* doesn't need to worry about cross-domain issues since it is running from * server. Since the iframe needs to load the SockJS javascript client library,
* a domain local to the SockJS server. The iframe does need to load the * this property allows specifying where to load it from.
* SockJS javascript client library and this option allows configuring its url.
* See the reference documentation for more details on this.
* *
* <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". * "https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.4.min.js". However it can
* 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
* must be relative to the iframe URL. For example assuming a SockJS endpoint
* mapped to "/sockjs", and resulting iframe URL "/sockjs/iframe.html", then the
* the relative URL must start with "../../" to traverse up to the location
* above the SockJS mapping. In case of a prefix-based Servlet mapping one more
* traversal may be needed.
*/ */
public SockJsServiceRegistration setClientLibraryUrl(String clientLibraryUrl) { public SockJsServiceRegistration setClientLibraryUrl(String clientLibraryUrl) {
this.clientLibraryUrl = clientLibraryUrl; this.clientLibraryUrl = clientLibraryUrl;

View File

@ -101,16 +101,22 @@ public abstract class AbstractSockJsService implements SockJsService {
} }
/** /**
* Transports which don't support cross-domain communication natively (e.g. * Transports with no native cross-domain communication (e.g. "eventsource",
* "eventsource", "htmlfile") rely on serving a simple page (using the * "htmlfile") must get a simple page from the "foreign" domain in an invisible
* "foreign" domain) from an invisible iframe. Code run from this iframe * iframe so that code in the iframe can run from a domain local to the SockJS
* doesn't need to worry about cross-domain issues since it is running from * server. Since the iframe needs to load the SockJS javascript client library,
* a domain local to the SockJS server. The iframe does need to load the * this property allows specifying where to load it from.
* SockJS javascript client library and this option allows configuring that url.
* For more details see the reference documentation.
* *
* <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". * "https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.4.min.js". However it can
* 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
* must be relative to the iframe URL. For example assuming a SockJS endpoint
* mapped to "/sockjs", and resulting iframe URL "/sockjs/iframe.html", then the
* the relative URL must start with "../../" to traverse up to the location
* above the SockJS mapping. In case of a prefix-based Servlet mapping one more
* traversal may be needed.
*/ */
public void setSockJsClientLibraryUrl(String clientLibraryUrl) { public void setSockJsClientLibraryUrl(String clientLibraryUrl) {
this.clientLibraryUrl = clientLibraryUrl; this.clientLibraryUrl = clientLibraryUrl;

View File

@ -144,7 +144,22 @@
<xsd:attribute name="client-library-url" type="xsd:string"> <xsd:attribute name="client-library-url" type="xsd:string">
<xsd:annotation> <xsd:annotation>
<xsd:documentation source="java:org.springframework.web.socket.sockjs.support.AbstractSockJsService"><![CDATA[ <xsd:documentation source="java:org.springframework.web.socket.sockjs.support.AbstractSockJsService"><![CDATA[
URL of the JavaScript client library. Defaults to "https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.4.min.js". Transports with no native cross-domain communication (e.g. "eventsource",
"htmlfile") must get a simple page from the "foreign" domain in an invisible
iframe so that code in the iframe can run from a domain local to the SockJS
server. Since the iframe needs to load the SockJS javascript client library,
this property allows specifying where to load it from.
By default this is set to point to
"https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.4.min.js". However it can
also be set to point to a URL served by the application.
Note that it's possible to specify a relative URL in which case the URL
must be relative to the iframe URL. For example assuming a SockJS endpoint
mapped to "/sockjs", and resulting iframe URL "/sockjs/iframe.html", then the
The relative URL must start with "../../" to traverse up to the location
above the SockJS mapping. In case of a prefix-based Servlet mapping one more
traversal may be needed.
]]></xsd:documentation> ]]></xsd:documentation>
</xsd:annotation> </xsd:annotation>
</xsd:attribute> </xsd:attribute>