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 a default value if 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, wait
getAttribute, setAttribute
public VaadinServletContext(ServletContext context)
ServletContext
.context
- the servlet context to usepublic ServletContext getContext()
ServletContext
.public <T> T getAttribute(Class<T> type, Supplier<T> defaultValueSupplier)
VaadinContext
getAttribute
in interface VaadinContext
type
- 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)
VaadinContext
setAttribute
in interface VaadinContext
clazz
- the type to associate the value with, not null
value
- the attribute value to set, or null
to remove the
current valuepublic void removeAttribute(Class<?> clazz)
VaadinContext
removeAttribute
in interface VaadinContext
clazz
- Attribute type.for setting attributes.
public Enumeration<String> getContextParameterNames()
VaadinContext
Enumeration
, or an empty Enumeration
if there
are o initialization parameters.getContextParameterNames
in interface VaadinContext
Enumeration
public String getContextParameter(String name)
VaadinContext
null
if
the parameter does not exist.getContextParameter
in interface VaadinContext
name
- name of the parameter whose value is requestedString
or null
for
no parameterCopyright © 2020. All rights reserved.