public class VaadinServletContext extends Object implements VaadinContext
VaadinContext that goes with VaadinServletService.| Constructor and Description |
|---|
VaadinServletContext(ServletContext context)
Creates an instance of this context with given
ServletContext. |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getAttribute(Class<T> type,
Supplier<T> defaultValueSupplier)
Returns value of the specified attribute, creating and storing a default
value if attribute not present.
|
ServletContext |
getContext()
Returns the underlying context.
|
String |
getContextParameter(String name)
Returns the value for the requested parameter, or
null if
the parameter does not exist. |
Enumeration<String> |
getContextParameterNames()
Returns the names of the initialization parameters as an
Enumeration, or an empty Enumeration if there
are o initialization parameters. |
void |
removeAttribute(Class<?> clazz)
Removes an attribute identified by the given type.
|
<T> void |
setAttribute(Class<T> clazz,
T value)
Sets the attribute value for the give type, overriding previously
existing one.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAttribute, setAttributepublic VaadinServletContext(ServletContext context)
ServletContext.context - the servlet context to usepublic ServletContext getContext()
ServletContext.public <T> T getAttribute(Class<T> type, Supplier<T> defaultValueSupplier)
VaadinContext
If attribute is not yet available the defaultValueSupplier is
used to get the default value which is set as the attribute value and the
value is returned. The operation is executed atomically.
getAttribute in interface VaadinContexttype - Type of the attribute.defaultValueSupplier - Supplier of the default value, called when there is no
value already present. May be null.public <T> void setAttribute(Class<T> clazz, T value)
VaadinContextsetAttribute in interface VaadinContextclazz - the type to associate the value with, not nullvalue - the attribute value to set, or null to remove the
current valuepublic void removeAttribute(Class<?> clazz)
VaadinContextremoveAttribute in interface VaadinContextclazz - Attribute type.for setting attributes.public Enumeration<String> getContextParameterNames()
VaadinContextEnumeration, or an empty Enumeration if there
are o initialization parameters.getContextParameterNames in interface VaadinContextEnumerationpublic String getContextParameter(String name)
VaadinContextnull if
the parameter does not exist.getContextParameter in interface VaadinContextname - name of the parameter whose value is requestedString or null for
no parameterCopyright © 2025. All rights reserved.