Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3799

simplify spring boot integration for websockets

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.5.1
    • 8.5.0
    • ZK Update Engine
    • Security Level: Jimmy
    • None
    • ZK 8.5.1 R1
    • None

      due to a different startup sequence between a classic webserver and a spring boot app the configuration of servlets/filters currently fails during startup
      This happens for CometAsyncServlet and WebSocketFilter.

      With CometAsyncServlet it is possible to prevent ZK from initializing by setting a context attribute during ServletContextInitializer#onStartup:

      @SpringBootApplication
      public class Application implements ServletContextInitializer {
          @Override
          public void onStartup(ServletContext servletContext) throws ServletException {
              //required to avoid duplicate installing of the CometAsyncServlet
              //startup sequence in spring boot is different to a normal servlet webapp
              servletContext.setAttribute("org.zkoss.zkmax.ui.comet.async.installed", true);
              //servletContext.setAttribute("org.zkoss.zkmax.websocket.filter.installed", true);
          }
      

      If something similar was awailable for the WebSocketFilter it would greatly simplify the current Spring boot integration prototype.

      In the long run it would be nice if there was no such problem at all and servlets/filters are configured with standard config files, e.g. web-fragment or in web.xml

            DevChu DevChu
            cor3000 cor3000
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h