com.vaadin.flow.server.
Class BootstrapHandler
- java.lang.Object
-
- com.vaadin.flow.server.SynchronizedRequestHandler
-
- com.vaadin.flow.server.BootstrapHandler
-
All Implemented Interfaces:
Direct Known Subclasses:
public class BootstrapHandler extends SynchronizedRequestHandler
Request handler which handles bootstrapping of the application, i.e. the initial GET request.
Since:
1.0
Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description protected static class
BootstrapHandler.BootstrapContext
Provides context information for the bootstrap process.
protected static class
BootstrapHandler.BootstrapPageBuilder
Builds bootstrap pages.
static class
BootstrapHandler.BootstrapUriResolver
The URI resolver used in the bootstrap process.
static interface
BootstrapHandler.PageBuilder
Interface for objects capable of building the bootstrap page.
-
Field Summary
Fields Modifier and Type Field and Description static String
POLYFILLS_JS
-
Constructor Summary
Constructors Modifier Constructor and Description BootstrapHandler()
Creates an instance of the handler with default
BootstrapHandler.PageBuilder
.protected
BootstrapHandler(BootstrapHandler.PageBuilder pageBuilder)
Creates an instance of the handler using provided page builder.
-
Method Summary
All Methods Modifier and Type Method and Description protected BootstrapHandler.BootstrapContext
createAndInitUI(Class<? extends UI> uiClass, VaadinRequest request, VaadinResponse response, VaadinSession session)
protected BootstrapHandler.BootstrapContext
createBootstrapContext(VaadinRequest request, VaadinResponse response, UI ui, Function<VaadinRequest,String> contextPathCallback)
Creates a new instance of
BootstrapHandler.BootstrapContext
for givenrequest
,response
andui
.protected BootstrapHandler.PageBuilder
getPageBuilder()
Returns the current page builder object.
protected static String
getServiceUrl(BootstrapHandler.BootstrapContext context)
Gets the service URL as a URL relative to the request URI.
protected static Class<? extends UI>
getUIClass(VaadinRequest request)
Returns the UI class mapped for servlet that handles the given request.
protected static String
readResource(String fileName)
protected static Optional<String>
resolvePageTitle(BootstrapHandler.BootstrapContext context)
Resolves the initial page title for the given bootstrap context and cancels any pending JS execution for it.
protected void
setupPushConnectionFactory(PushConfiguration pushConfiguration, BootstrapHandler.BootstrapContext context)
boolean
synchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response)
Identical to
SynchronizedRequestHandler.handleRequest(VaadinSession, VaadinRequest, VaadinResponse)
except theVaadinSession
is locked before this is called and unlocked after this has completed.-
Methods inherited from class com.vaadin.flow.server.SynchronizedRequestHandler
canHandleRequest, handleRequest
-
-
-
-
Field Detail
-
POLYFILLS_JS
public static final String POLYFILLS_JS
See Also:
-
-
Constructor Detail
-
BootstrapHandler
public BootstrapHandler()
Creates an instance of the handler with default
BootstrapHandler.PageBuilder
.
-
BootstrapHandler
protected BootstrapHandler(BootstrapHandler.PageBuilder pageBuilder)
Creates an instance of the handler using provided page builder.
Parameters:
pageBuilder
- Page builder to use.
-
-
Method Detail
-
getPageBuilder
protected BootstrapHandler.PageBuilder getPageBuilder()
Returns the current page builder object.
Returns:
Page builder in charge of constructing the resulting page.
-
synchronizedHandleRequest
public boolean synchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException
Description copied from class:
SynchronizedRequestHandler
Identical to
SynchronizedRequestHandler.handleRequest(VaadinSession, VaadinRequest, VaadinResponse)
except theVaadinSession
is locked before this is called and unlocked after this has completed.Specified by:
synchronizedHandleRequest
in classSynchronizedRequestHandler
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 occurredSee Also:
SynchronizedRequestHandler.handleRequest(VaadinSession, VaadinRequest, VaadinResponse)
-
getServiceUrl
protected static String getServiceUrl(BootstrapHandler.BootstrapContext context)
Gets the service URL as a URL relative to the request URI.
Parameters:
context
- the bootstrap contextReturns:
the relative service URL
-
resolvePageTitle
protected static Optional<String> resolvePageTitle(BootstrapHandler.BootstrapContext context)
Resolves the initial page title for the given bootstrap context and cancels any pending JS execution for it.
Parameters:
context
- the bootstrap contextReturns:
the optional initial page title
-
createAndInitUI
protected BootstrapHandler.BootstrapContext createAndInitUI(Class<? extends UI> uiClass, VaadinRequest request, VaadinResponse response, VaadinSession session)
-
createBootstrapContext
protected BootstrapHandler.BootstrapContext createBootstrapContext(VaadinRequest request, VaadinResponse response, UI ui, Function<VaadinRequest,String> contextPathCallback)
Creates a new instance of
BootstrapHandler.BootstrapContext
for givenrequest
,response
andui
.Parameters:
request
- the request objectresponse
- the response objectui
- the UI objectReturns:
a new bootstrap context instance
-
setupPushConnectionFactory
protected void setupPushConnectionFactory(PushConfiguration pushConfiguration, BootstrapHandler.BootstrapContext context)
-
getUIClass
protected static Class<? extends UI> getUIClass(VaadinRequest request)
Returns the UI class mapped for servlet that handles the given request.
This method is protected for testing purposes.
Parameters:
request
- the request for the UIReturns:
the UI class for the request
-
-