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:
-
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 StringbootstrapNpm(boolean productionMode) protected booleancanHandleRequest(VaadinRequest request) Check whether a request may be handled by this handler.protected StringgenerateNPMResponse(String tagName, VaadinRequest request, VaadinResponse response) Generate the npm response for the web component.booleanWhether bootstrap HTML fragment are cached based on component tag.voidsetCacheEnabled(boolean cacheEnabled) Enable / disable bootstrap HTML fragment caching based on component tag.booleansynchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) Identical toSynchronizedRequestHandler.handleRequest(VaadinSession, VaadinRequest, VaadinResponse)except theVaadinSessionis 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:SynchronizedRequestHandlerCheck 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 returnstruewhich means that all requests will be handled by callingSynchronizedRequestHandler.synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse)with the session locked.- Overrides:
canHandleRequestin classSynchronizedRequestHandler- Parameters:
request- the request to handle- Returns:
trueif the request handling should continue once the session has been locked;falseif 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:SynchronizedRequestHandlerIdentical toSynchronizedRequestHandler.handleRequest(VaadinSession, VaadinRequest, VaadinResponse)except theVaadinSessionis locked before this is called and unlocked after this has completed.- Specified by:
synchronizedHandleRequestin 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
-