Class DevBundleBuildingHandler

java.lang.Object
com.vaadin.base.devserver.DevBundleBuildingHandler
All Implemented Interfaces:
DevModeHandler, RequestHandler, Serializable

public final class DevBundleBuildingHandler extends Object implements DevModeHandler
A fake DevModeHandler whose only purpose is to eagerly show a "build in progress" HTML page to the user, during the creation of the development bundle.

The getPort() method returns a fixed value of -1, meaning that this handler will not start a server listening for incoming requests.

Most of the other methods should not be invoked, and they may throw an exception if called.
See Also:
  • Constructor Details

    • DevBundleBuildingHandler

      public DevBundleBuildingHandler(CompletableFuture<Void> buildCompletedFuture)
  • Method Details

    • getFailedOutput

      public String getFailedOutput()
      Description copied from interface: DevModeHandler
      Return the dev server console output when a compilation error happened.
      Specified by:
      getFailedOutput in interface DevModeHandler
      Returns:
      console output if error or null otherwise.
    • prepareConnection

      public HttpURLConnection prepareConnection(String path, String method)
      Description copied from interface: DevModeHandler
      Prepare a HTTP connection against the dev server.
      Specified by:
      prepareConnection in interface DevModeHandler
      Parameters:
      path - the file to request, needs to be safe
      method - the http method to use
      Returns:
      the connection
    • serveDevModeRequest

      public boolean serveDevModeRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Description copied from interface: DevModeHandler
      Serve a file by proxying to the dev server.
      Specified by:
      serveDevModeRequest in interface DevModeHandler
      Parameters:
      request - the servlet request
      response - the servlet response
      Returns:
      false if the dev server returned a not found, true otherwise
    • stop

      public void stop()
      Description copied from interface: DevModeHandler
      Stop the dev-server.
      Specified by:
      stop in interface DevModeHandler
    • getProjectRoot

      public File getProjectRoot()
      Description copied from interface: DevModeHandler
      Gets the project root folder.
      Specified by:
      getProjectRoot in interface DevModeHandler
      Returns:
      the project root folder
    • getPort

      public int getPort()
      Gets always -1, as this handler does not start a server.
      Specified by:
      getPort in interface DevModeHandler
      Returns:
      -1
    • handleRequest

      public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException
      Description copied from interface: RequestHandler
      Called when a request needs to be handled. If a response is written, this method should return true to indicate that no more request handlers should be invoked for the request.

      Note that request handlers by default do not lock the session. If you are using VaadinSession or anything inside the VaadinSession you must ensure the session is locked. This can be done by extending SynchronizedRequestHandler or by using VaadinSession.accessSynchronously(Command) or UI.accessSynchronously(Command).

      Specified by:
      handleRequest in interface RequestHandler
      Parameters:
      session - The session for the request
      request - The request to handle
      response - The response object to which a response can be written.
      Returns:
      true if a response has been written and no further request handlers should be called, otherwise false
      Throws:
      IOException - If an IO error occurred
    • waitForDevBundle

      public void waitForDevBundle()
      Waits for the dev bundle to be built.

      Suspends the caller's thread until the dev bundle is created (or failed to create).