ServerSide Push Config in web.xml

Hi all,

I’d like to set up ServerSide Push. As we need to install it in different environments I’d like to specify the Transportation Mode in the web.xml or does the Athmosphere Framework of Vaadin try every transportation mode until one works?
If it is auto detected whats the order?

How can I specify the Transportation mode in the web.xml?

<servlet> ... <init-param> <init-param> <param-name>pushmode</param-name> <param-value>automatice</param-value> </init-param> <async-supported>true</async-supported> </servlet> I know that it is possible to specify it in the @Push(value = PushMode.AUTOMATIC, transport = Transport.WEBSOCKET) but then I need to recompile it for every environment.

I was also thinking about on Making 3 different UIs and then switch the UI in the web.xml, but that is not a nice solution.

To change it by runtime for every UI would require the User to set it everytime he opens a new UI so not an option eather.

What you have above is good except for misspelling automatic. To force a transport, I believe you can add (using either of the 3 values shown):

      <!-- disabled, automatic, manual -->
      <init-param>
        <param-name>pushmode</param-name>
        <param-value>automatic</param-value>
     </init-param>

     <!-- websocket, streaming, long-polling -->
     <init-param>
        <param-name>transport</param-name>
        <param-value>long-polling</param-value>
     </init-param>

     <async-supported>true</async-supported>

I’ve ran into similar issue but seems that above solution doesn’t work at least in Vaadin 7.6.1. Here are possible param values, found in com.vaadin.server.Constants:

 static final String SERVLET_PARAMETER_PRODUCTION_MODE = "productionMode";
    // Javadocs for VaadinService should be updated if this value is changed
    static final String SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION = "disable-xsrf-protection";
    static final String SERVLET_PARAMETER_RESOURCE_CACHE_TIME = "resourceCacheTime";
    static final String SERVLET_PARAMETER_HEARTBEAT_INTERVAL = "heartbeatInterval";
    static final String SERVLET_PARAMETER_CLOSE_IDLE_SESSIONS = "closeIdleSessions";
    static final String SERVLET_PARAMETER_PUSH_MODE = "pushMode";
    static final String SERVLET_PARAMETER_UI_PROVIDER = "UIProvider";
    static final String SERVLET_PARAMETER_LEGACY_PROPERTY_TOSTRING = "legacyPropertyToString";
    static final String SERVLET_PARAMETER_SYNC_ID_CHECK = "syncIdCheck";
    static final String SERVLET_PARAMETER_SENDURLSASPARAMETERS = "sendUrlsAsParameters";
    static final String SERVLET_PARAMETER_PUSH_SUSPEND_TIMEOUT_LONGPOLLING = "pushLongPollingSuspendTimeout";

So there is no ‘transport’ value, workaround is to set this value while session startup in UI.init() method and read value from properties file

UI.getCurrent().getPushConfiguration().setTransport(...)

or pass it in URL. Here is example code how to do it using URL param(Example 3):

http://www.programcreek.com/java-api-examples/index.php?api=com.vaadin.shared.communication.PushMode