Class Utils
java.lang.Object
org.glassfish.jersey.servlet.internal.Utils
Utility class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
Internalservlet context
attribute name under which an instance ofresource config
can be stored. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetContextParams
(javax.servlet.ServletContext servletContext) Extract context params fromServletContext
.static ResourceConfig
Loadresource config
from givenservlet context
.static void
store
(ResourceConfig config, javax.servlet.ServletContext context, String configName) Storeresource config
as an attribute of givenservlet context
.
-
Field Details
-
RESOURCE_CONFIG
Internalservlet context
attribute name under which an instance ofresource config
can be stored. The instance is later used to initialize servlet inWebConfig
instead of creating a new one.- See Also:
-
-
Constructor Details
-
Utils
private Utils()Prevents instantiation.
-
-
Method Details
-
store
public static void store(ResourceConfig config, javax.servlet.ServletContext context, String configName) Storeresource config
as an attribute of givenservlet context
. Ifconfig
isnull
then the previously stored value (if any) is removed. TheconfigName
is used as an attribute name suffix.- Parameters:
config
- resource config to be stored.context
- servlet context to store the config in.configName
- name or id of the resource config.
-
retrieve
Loadresource config
from givenservlet context
. If found then the resource config is also removed from servlet context. TheconfigName
is used as an attribute name suffix.- Parameters:
context
- servlet context to load resource config from.configName
- name or id of the resource config.- Returns:
- previously stored resource config or
null
if no resource config has been stored.
-
getContextParams
Extract context params fromServletContext
.- Parameters:
servletContext
- actual servlet context.- Returns:
- map representing current context parameters.
-