com.vaadin.flow.server.
Class BootstrapHandler.BootstrapContext
- java.lang.Object
-
- com.vaadin.flow.server.BootstrapHandler.BootstrapContext
-
Direct Known Subclasses:
Enclosing class:
protected static class BootstrapHandler.BootstrapContext extends Object
Provides context information for the bootstrap process.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BootstrapContext(VaadinRequest request, VaadinResponse response, VaadinSession session, UI ui, Function<VaadinRequest,String> contextCallback)
Creates a new context instance using the given parameters.
protected
BootstrapContext(VaadinRequest request, VaadinResponse response, VaadinSession session, UI ui, Function<VaadinRequest,String> contextCallback, Function<VaadinRequest,Location> routeCallback)
Creates a new context instance using the given parameters.
-
Method Summary
All Methods Modifier and Type Method Description String
getAppId()
Gets the application id.
elemental.json.JsonObject
getApplicationParameters()
Gets the application parameters specified by the BootstrapHandler.
<T extends Annotation>
Optional<T>getPageConfigurationAnnotation(Class<T> annotationType)
Gets an annotation from the topmost class in the current navigation target hierarchy.
<T extends Annotation>
List<T>getPageConfigurationAnnotations(Class<T> annotationType)
Gets a a list of annotations from the topmost class in the current navigation target hierarchy.
PushMode
getPushMode()
Gets the push mode to use.
protected Optional<PwaRegistry>
getPwaRegistry()
Gets a pwa registry instance.
VaadinRequest
getRequest()
Gets the Vaadin/HTTP request.
VaadinResponse
getResponse()
Gets the Vaadin/HTTP response.
Location
getRoute()
Gets the location of the route that should be activated for this bootstrap request.
VaadinService
getService()
Gets the Vaadin service.
VaadinSession
getSession()
Gets the Vaadin session.
UI
getUI()
Gets the UI.
BootstrapHandler.BootstrapUriResolver
getUriResolver()
Gets the URI resolver to use for bootstrap resources.
boolean
isInitTheme()
Should custom theme be initialized.
boolean
isProductionMode()
Checks if the application is running in production mode.
void
setInitTheme(boolean initTheme)
Set if custom theme should be initialized.
-
-
-
Constructor Detail
-
BootstrapContext
protected BootstrapContext(VaadinRequest request, VaadinResponse response, VaadinSession session, UI ui, Function<VaadinRequest,String> contextCallback)
Creates a new context instance using the given parameters.
Parameters:
request
- the request objectresponse
- the response objectsession
- the current sessionui
- the UI objectcontextCallback
- a callback that is invoked to resolve the context root from the request
-
BootstrapContext
protected BootstrapContext(VaadinRequest request, VaadinResponse response, VaadinSession session, UI ui, Function<VaadinRequest,String> contextCallback, Function<VaadinRequest,Location> routeCallback)
Creates a new context instance using the given parameters.
Parameters:
request
- the request objectresponse
- the response objectsession
- the current sessionui
- the UI objectcontextCallback
- a callback that is invoked to resolve the context root from the requestrouteCallback
- a callback that is invoked to resolve the route from the request
-
-
Method Detail
-
getResponse
public VaadinResponse getResponse()
Gets the Vaadin/HTTP response.
Returns:
the Vaadin/HTTP response
-
getRequest
public VaadinRequest getRequest()
Gets the Vaadin/HTTP request.
Returns:
the Vaadin/HTTP request
-
getService
public VaadinService getService()
Gets the Vaadin service.
Returns:
the Vaadin/HTTP service
-
getSession
public VaadinSession getSession()
Gets the Vaadin session.
Returns:
the Vaadin session
-
isInitTheme
public boolean isInitTheme()
Should custom theme be initialized.
Returns:
true if theme should be initialized
-
setInitTheme
public void setInitTheme(boolean initTheme)
Set if custom theme should be initialized.
Parameters:
initTheme
- enable or disable theme initialisation
-
getUI
public UI getUI()
Gets the UI.
Returns:
the UI
-
getPushMode
public PushMode getPushMode()
Gets the push mode to use.
Returns:
the desired push mode
-
getAppId
public String getAppId()
Gets the application id. The application id is defined by
VaadinService.getMainDivId(VaadinSession, VaadinRequest)
Returns:
the application id
-
getApplicationParameters
public elemental.json.JsonObject getApplicationParameters()
Gets the application parameters specified by the BootstrapHandler.
Returns:
the application parameters that will be written on the page
-
getUriResolver
public BootstrapHandler.BootstrapUriResolver getUriResolver()
Gets the URI resolver to use for bootstrap resources.
Returns:
the URI resolver
-
isProductionMode
public boolean isProductionMode()
Checks if the application is running in production mode.
Returns:
true
if in production mode,false
otherwise.
-
getPageConfigurationAnnotation
public <T extends Annotation> Optional<T> getPageConfigurationAnnotation(Class<T> annotationType)
Gets an annotation from the topmost class in the current navigation target hierarchy.
Type Parameters:
T
- the type of the annotationParameters:
annotationType
- the type of the annotation to getReturns:
an annotation, or an empty optional if there is no current navigation target or if it doesn't have the annotation
-
getPageConfigurationAnnotations
public <T extends Annotation> List<T> getPageConfigurationAnnotations(Class<T> annotationType)
Gets a a list of annotations from the topmost class in the current navigation target hierarchy.
Type Parameters:
T
- the type of the annotationsParameters:
annotationType
- the type of the annotation to getReturns:
a list of annotation, or an empty list if there is no current navigation target or if it doesn't have the annotation
-
getPwaRegistry
protected Optional<PwaRegistry> getPwaRegistry()
Gets a pwa registry instance.
Returns:
an optional pwa registry instance, or an empty optional if no pwa registry available for the context
-
getRoute
public Location getRoute()
Gets the location of the route that should be activated for this bootstrap request.
Returns:
the route to activate
-
-