public class WebComponentBootstrapHandler extends BootstrapHandler
BootstrapHandler.BootstrapContext, BootstrapHandler.BootstrapPageBuilder, BootstrapHandler.BootstrapUriResolver, BootstrapHandler.PageBuilder
POLYFILLS_JS
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)
Returns the service url needed for initialising the UI.
|
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. |
getPageBuilder, getServiceUrl, getUIClass, readResource, resolvePageTitle, setupPushConnectionFactory
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 SynchronizedRequestHandler
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 getServiceUrl(VaadinRequest request)
request
- Request.Copyright © 2019. All rights reserved.