com.vaadin.flow.server.communication.
Class WebComponentProvider
All Implemented Interfaces:
Request handler that supplies the script/html of the web component matching the given tag.
For internal use only. May be renamed or removed in a future release.
Since:
2.0
Author:
Vaadin Ltd.
See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.server.SynchronizedRequestHandler
SynchronizedRequestHandler.ResponseWriter
-
Field Summary
Fields inherited from class com.vaadin.flow.server.SynchronizedRequestHandler
MAX_BUFFER_SIZE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
bootstrapNpm
(boolean productionMode) protected boolean
canHandleRequest
(VaadinRequest request) Check whether a request may be handled by this handler.
protected String
generateNPMResponse
(String tagName, VaadinRequest request, VaadinResponse response) Generate the npm response for the web component.
boolean
Whether bootstrap HTML fragment are cached based on component tag.
void
setCacheEnabled
(boolean cacheEnabled) Enable / disable bootstrap HTML fragment caching based on component tag.
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
getRequestBody, handleRequest, isReadAndWriteOutsideSessionLock, synchronizedHandleRequest
-
Constructor Details
-
WebComponentProvider
public WebComponentProvider()
-
-
Method Details
-
canHandleRequest
Description copied from class:
SynchronizedRequestHandler
Check whether a request may be handled by this handler. This can be used as an optimization to avoid locking the session just to investigate some method property. The default implementation just returns
true
which means that all requests will be handled by callingSynchronizedRequestHandler.synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse)
with the session locked.Overrides:
canHandleRequest
in classSynchronizedRequestHandler
Parameters:
request
- the request to handleReturns:
true
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. -
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:
-
isCacheEnabled
public boolean isCacheEnabled()Whether bootstrap HTML fragment are cached based on component tag. Enabled by default.
Returns:
true iff bootstrap fragment caching is enabled
-
setCacheEnabled
public void setCacheEnabled(boolean cacheEnabled) Enable / disable bootstrap HTML fragment caching based on component tag. Calling this method has the side effect of always clearing the cache.
Parameters:
cacheEnabled
- whether bootstrap fragments should be cached per tag -
generateNPMResponse
protected String generateNPMResponse(String tagName, VaadinRequest request, VaadinResponse response) Generate the npm response for the web component.
Parameters:
tagName
- tag name of componentrequest
- current VaadinRequestresponse
- current VaadinResponseReturns:
npm response script
-
bootstrapNpm
-