diff options
author | Artur Signell <artur@vaadin.com> | 2015-04-27 12:03:47 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-07-13 17:32:45 +0300 |
commit | 6fe79a8f65f96c08946c36607428c8c5790c1f33 (patch) | |
tree | 344a7b59fcbada2f14975796a41c128ab759b317 /server | |
parent | b38dc12c24ca5eb0cc597309e0317e4364585433 (diff) | |
download | vaadin-framework-6fe79a8f65f96c08946c36607428c8c5790c1f33.tar.gz vaadin-framework-6fe79a8f65f96c08946c36607428c8c5790c1f33.zip |
Allow using XHR for client to server requests and websockets for push (#12518)
Change-Id: I6a9cc8f97d7e3578bf7aa9ce512d042ab637494e
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/PushConfiguration.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/PushConfiguration.java b/server/src/com/vaadin/ui/PushConfiguration.java index 90ad28542c..22941ea5ae 100644 --- a/server/src/com/vaadin/ui/PushConfiguration.java +++ b/server/src/com/vaadin/ui/PushConfiguration.java @@ -139,6 +139,33 @@ public interface PushConfiguration extends Serializable { */ public void setParameter(String parameter, String value); + /** + * Sets whether to force the use of XHR when sending data from the client to + * the server. + * + * This settings currently only has effect when using websockets, which by + * default send client to server requests through the websockets channel. If + * you need to support cookies, HTTP auth or similar features not available + * in websockets communication you can set this to true. + * + * @since 7.6 + * @param alwaysUseXhrForServerRequests + * true to always use XHR for server requests, false otherwise + */ + public void setAlwaysUseXhrForServerRequests( + boolean alwaysUseXhrForServerRequests); + + /** + * Checks whether to force the use of XHR when sending data from the client + * to the server. + * + * @see #setAlwaysUseXhrForServerRequests(boolean) + * + * @since 7.6 + * @return true to always use XHR for server requests, false otherwise + */ + public boolean isAlwaysUseXhrForServerRequests(); + } class PushConfigurationImpl implements PushConfiguration { @@ -291,4 +318,14 @@ class PushConfigurationImpl implements PushConfiguration { .keySet()); } + @Override + public void setAlwaysUseXhrForServerRequests( + boolean alwaysUseXhrForServerRequests) { + getState().alwaysUseXhrForServerRequests = alwaysUseXhrForServerRequests; + } + + @Override + public boolean isAlwaysUseXhrForServerRequests() { + return getState(false).alwaysUseXhrForServerRequests; + } } |