public class WebComponentBootstrapHandler extends BootstrapHandler
For internal use only. May be renamed or removed in a future release.
BootstrapHandler.BootstrapContext, BootstrapHandler.BootstrapPageBuilder, BootstrapHandler.BootstrapUriResolver, BootstrapHandler.PageBuilder
SERVICE_WORKER_HEADER
Modifier | Constructor and Description |
---|---|
|
WebComponentBootstrapHandler()
Creates a new bootstrap handler with default page builder.
|
protected |
WebComponentBootstrapHandler(BootstrapHandler.PageBuilder pageBuilder)
Creates a new bootstrap handler, allowing to use custom page builder.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canHandleRequest(VaadinRequest request)
Check whether a request may be handled by this handler.
|
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> callback)
|
protected String |
getRequestUrl(VaadinRequest request)
Returns the request's base url to use in constructing and initialising
ui.
|
protected String |
getServiceUrl(VaadinRequest request,
VaadinResponse response)
Returns the service url needed for initialising the UI.
|
protected boolean |
handleWebComponentResyncRequest(BootstrapHandler.BootstrapContext context,
VaadinRequest request,
VaadinResponse response)
Handles WebComponents resynchronization request
|
protected String |
modifyPath(String basePath,
String path)
Create a new address for a resource which is calculated based on the
request base path (servlet path) and the original path for the Vaadin
resource.
|
boolean |
synchronizedHandleRequest(VaadinSession session,
VaadinRequest request,
VaadinResponse response)
Identical to
SynchronizedRequestHandler.handleRequest(VaadinSession, VaadinRequest, VaadinResponse)
except the VaadinSession is locked before this is called and
unlocked after this has completed. |
protected void |
writeBootstrapPage(String contentType,
VaadinResponse response,
org.jsoup.nodes.Element head,
String serviceUrl)
Copies the
Elements found in the given
head elements into the head of the embedding website using
JavaScript. |
addLicenseChecker, getInitialUidl, getPageBuilder, getServiceUrl, getUIClass, initializeUIWithRouter, readResource, resolvePageTitle, setupPushConnectionFactory, writeErrorCodeIfRequestLocationIsInvalid
handleRequest
public WebComponentBootstrapHandler()
protected WebComponentBootstrapHandler(BootstrapHandler.PageBuilder pageBuilder)
pageBuilder
- Page builder to use.protected boolean canHandleRequest(VaadinRequest request)
SynchronizedRequestHandler
true
which means that all requests will be handled by
calling
SynchronizedRequestHandler.synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse)
with the session locked.canHandleRequest
in class BootstrapHandler
request
- the request to handletrue
if the request handling should continue once
the session has been locked; false
if there's no
need to lock the session since the request would still not be
handled.protected String getRequestUrl(VaadinRequest request)
request
- Request to the url for.protected BootstrapHandler.BootstrapContext createAndInitUI(Class<? extends UI> uiClass, VaadinRequest request, VaadinResponse response, VaadinSession session)
createAndInitUI
in class BootstrapHandler
protected BootstrapHandler.BootstrapContext createBootstrapContext(VaadinRequest request, VaadinResponse response, UI ui, Function<VaadinRequest,String> callback)
BootstrapHandler
createBootstrapContext
in class BootstrapHandler
request
- the request objectresponse
- the response objectui
- the UI objectpublic boolean synchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException
SynchronizedRequestHandler
SynchronizedRequestHandler.handleRequest(VaadinSession, VaadinRequest, VaadinResponse)
except the VaadinSession
is locked before this is called and
unlocked after this has completed.synchronizedHandleRequest
in class BootstrapHandler
session
- The session for the requestrequest
- The request to handleresponse
- The response object to which a response can be written.IOException
- If an IO error occurredSynchronizedRequestHandler.handleRequest(VaadinSession, VaadinRequest, VaadinResponse)
protected void writeBootstrapPage(String contentType, VaadinResponse response, org.jsoup.nodes.Element head, String serviceUrl) throws IOException
Elements
found in the given
head
elements into the head of the embedding website using
JavaScript. Drops <base>
element.contentType
- Content type of the response.response
- VaadinResponse
into which the
script is writtenhead
- head element of Vaadin Bootstrap page. The child elements are
copied into the embedding page's head using JavaScript.serviceUrl
- base path to use for the head elements' URLsIOException
- if writing failsprotected String modifyPath(String basePath, String path) throws UnsupportedEncodingException
If the resource is targeted to context root with VAADIN prefix, the path part before the VAADIN is chopped of since that has been calculated to be relative to our context and would target context root instead of the serving servlet.
basePath
- full servlet path, received as part of the bootstrap request.
Needs to be the client-side path used, to get around proxies.path
- original resource pathUnsupportedEncodingException
protected String getServiceUrl(VaadinRequest request, VaadinResponse response)
request
- the request objectresponse
- the response objectprotected boolean handleWebComponentResyncRequest(BootstrapHandler.BootstrapContext context, VaadinRequest request, VaadinResponse response)
context
- the bootstrap context objectrequest
- the request objectresponse
- the response objectCopyright © 2025. All rights reserved.