Class Utils
- java.lang.Object
-
- org.glassfish.jersey.servlet.internal.Utils
-
public final class Utils extends java.lang.ObjectUtility class.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringRESOURCE_CONFIGInternalservlet contextattribute name under which an instance ofresource configcan be stored.
-
Constructor Summary
Constructors Modifier Constructor Description privateUtils()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 ResourceConfigretrieve(javax.servlet.ServletContext context, java.lang.String configName)Loadresource configfrom givenservlet context.static voidstore(ResourceConfig config, javax.servlet.ServletContext context, java.lang.String configName)Storeresource configas an attribute of givenservlet context.
-
-
-
Field Detail
-
RESOURCE_CONFIG
private static final java.lang.String RESOURCE_CONFIG
Internalservlet contextattribute name under which an instance ofresource configcan be stored. The instance is later used to initialize servlet inWebConfiginstead 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 configas an attribute of givenservlet context. Ifconfigisnullthen the previously stored value (if any) is removed. TheconfigNameis 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 configfrom givenservlet context. If found then the resource config is also removed from servlet context. TheconfigNameis 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
nullif 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.
-
-