the Push annotation defines the PushMode and the Transport to be used for server push configuration. An alternative approach for specifying the push mode is to define the servlet init parameter pushMode, pushMode = automatic for example. Is there a similar alternative approach for specifying the transport, transport = long-polling or transport = websocket-xhr for example ?
What you can do of course is to set the push mode via command line parameter. I think mvn jetty:run -Dpushmode=automatic should work.
Referring to your title - it might technically be possible to change the mode during runtime but as this something the container and not the application controls you’d need something like JMX/MBeans or a server-specific API to achieve that. Also, pretty sure your application would need a complete refresh after that.
After reading your response I have realized an error in my actual question. It should really be to specify the transport at container start time not after the container has been started. I want to avoid using the Push annotation as this hard-codes the choices.
I will review the Apache Tomcat documentation (I am using the embedded version) to see if I can determine how to specify it.