Class WebComponentProvider
java.lang.Object
com.vaadin.flow.server.SynchronizedRequestHandler
com.vaadin.flow.server.communication.WebComponentProvider
- All Implemented Interfaces:
RequestHandler
,Serializable
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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
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 toSynchronizedRequestHandler.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
handleRequest
-
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 returnstrue
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 handle- Returns:
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 toSynchronizedRequestHandler.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 occurred- See 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 VaadinResponse- Returns:
- npm response script
-
bootstrapNpm
-