com.vaadin.base.devserver.
Class DevBundleBuildingHandler
All Implemented Interfaces:
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.
int
getPort()
Gets always -1, as this handler does not start a server.
Gets the project root folder.
boolean
handleRequest
(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.
boolean
serveDevModeRequest
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Serve a file by proxying to the dev server.
void
stop()
Stop the dev-server.
void
Waits for the dev bundle to be built.
-
Constructor Details
-
DevBundleBuildingHandler
-
-
Method Details
-
getFailedOutput
Description copied from interface:
DevModeHandler
Return the dev server console output when a compilation error happened.
Specified by:
getFailedOutput
in interfaceDevModeHandler
Returns:
console output if error or null otherwise.
-
prepareConnection
Description copied from interface:
DevModeHandler
Prepare a HTTP connection against the dev server.
Specified by:
prepareConnection
in interfaceDevModeHandler
Parameters:
path
- the file to request, needs to be safemethod
- the http method to useReturns:
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 interfaceDevModeHandler
Parameters:
request
- the servlet requestresponse
- the servlet responseReturns:
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 interfaceDevModeHandler
-
getProjectRoot
Description copied from interface:
DevModeHandler
Gets the project root folder.
Specified by:
getProjectRoot
in interfaceDevModeHandler
Returns:
the project root folder
-
getPort
public int getPort()Gets always -1, as this handler does not start a server.
Specified by:
getPort
in interfaceDevModeHandler
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 usingVaadinSession.accessSynchronously(Command)
orUI.accessSynchronously(Command)
.Specified by:
handleRequest
in 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).
-