Class Utils
- java.lang.Object
-
- org.glassfish.jersey.servlet.internal.Utils
-
public final class Utils extends java.lang.Object
Utility class.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
RESOURCE_CONFIG
Internalservlet context
attribute name under which an instance ofresource config
can be stored.
-
Constructor Summary
Constructors Modifier Constructor Description private
Utils()
Prevents instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.Object>
getContextParams(javax.servlet.ServletContext servletContext)
Extract context params fromServletContext
.static ResourceConfig
retrieve(javax.servlet.ServletContext context, java.lang.String configName)
Loadresource config
from givenservlet context
.static void
store(ResourceConfig config, javax.servlet.ServletContext context, java.lang.String configName)
Storeresource config
as an attribute of givenservlet context
.
-
-
-
Field Detail
-
RESOURCE_CONFIG
private static final java.lang.String 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:
- Constant Field Values
-
-
Method Detail
-
store
public static void store(ResourceConfig config, javax.servlet.ServletContext context, java.lang.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
public static ResourceConfig retrieve(javax.servlet.ServletContext context, java.lang.String configName)
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
public static java.util.Map<java.lang.String,java.lang.Object> getContextParams(javax.servlet.ServletContext servletContext)
Extract context params fromServletContext
.- Parameters:
servletContext
- actual servlet context.- Returns:
- map representing current context parameters.
-
-