Package com.vaadin.base.devserver
Class DevBundleBuildingHandler
java.lang.Object
com.vaadin.base.devserver.DevBundleBuildingHandler
- All Implemented Interfaces:
DevModeHandler,RequestHandler,Serializable
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the dev server console output when a compilation error happened.intgetPort()Gets always -1, as this handler does not start a server.Gets the project root folder.booleanhandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) Called when a request needs to be handled.prepareConnection(String path, String method) Prepare a HTTP connection against the dev server.booleanserveDevModeRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Serve a file by proxying to the dev server.voidstop()Stop the dev-server.voidWaits for the dev bundle to be built.
-
Constructor Details
-
DevBundleBuildingHandler
-
-
Method Details
-
getFailedOutput
Description copied from interface:DevModeHandlerReturn the dev server console output when a compilation error happened.- Specified by:
getFailedOutputin interfaceDevModeHandler- Returns:
- console output if error or null otherwise.
-
prepareConnection
Description copied from interface:DevModeHandlerPrepare a HTTP connection against the dev server.- Specified by:
prepareConnectionin interfaceDevModeHandler- Parameters:
path- the file to request, needs to be safemethod- 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:DevModeHandlerServe a file by proxying to the dev server.- Specified by:
serveDevModeRequestin interfaceDevModeHandler- Parameters:
request- the servlet requestresponse- the servlet response- Returns:
- false if the dev server returned a not found, true otherwise
-
stop
public void stop()Description copied from interface:DevModeHandlerStop the dev-server.- Specified by:
stopin interfaceDevModeHandler
-
getProjectRoot
Description copied from interface:DevModeHandlerGets the project root folder.- Specified by:
getProjectRootin interfaceDevModeHandler- Returns:
- the project root folder
-
getPort
public int getPort()Gets always -1, as this handler does not start a server.- Specified by:
getPortin interfaceDevModeHandler- Returns:
- -1
-
handleRequest
public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException Description copied from interface:RequestHandlerCalled when a request needs to be handled. If a response is written, this method should returntrueto 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
SynchronizedRequestHandleror by usingVaadinSession.accessSynchronously(Command)orUI.accessSynchronously(Command).- Specified by:
handleRequestin interfaceRequestHandler- Parameters:
session- The session for the requestrequest- The request to handleresponse- 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).
-