Package com.tangosol.coherence.rest
Class DefaultRootResource
java.lang.Object
com.tangosol.coherence.rest.DefaultRootResource
- Direct Known Subclasses:
PassThroughRootResource
Default root resource implementation.
This class can be replaced by a custom implementation if the user wants to have more control over the mapping of URLs to caches.
This implementation simply maps the first path element of the URL to a
resource with the same name (as defined in coherence-rest-config.xml)
and returns a CacheResource
wrapper around it.
If the cache with a specified name does not exist, a 404 (Not Found) status code will be returned in the response.
- Author:
- as 2011.06.03
-
Field Summary
Modifier and TypeFieldDescriptionprotected RestConfig
REST configuration.protected org.glassfish.hk2.api.ServiceLocator
protected Session
Coherence session. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetCacheResource
(String sName) Returns a resource representing single named cache.protected CacheResource
instantiateCacheResource
(NamedCache cache, Class clzKey, Class clzValue, KeyConverter keyConverter, QueryConfig queryConfig, int cMaxResults) Create an instance ofCacheResource
.protected CacheResource
instantiateCacheResourceInternal
(ResourceConfig configResource) Create an instance ofCacheResource
for the specified resource configuration.
-
Field Details
-
m_session
Coherence session. -
m_config
REST configuration. -
m_serviceLocator
@Inject protected org.glassfish.hk2.api.ServiceLocator m_serviceLocator
-
-
Constructor Details
-
DefaultRootResource
public DefaultRootResource()
-
-
Method Details
-
getCacheResource
Returns a resource representing single named cache.- Parameters:
sName
- resource name- Returns:
- resource representing single named cache
-
instantiateCacheResourceInternal
Create an instance ofCacheResource
for the specified resource configuration.This is an internal method and is not intended to be overridden by the users. The users should override
instantiateCacheResource(com.tangosol.net.NamedCache, java.lang.Class, java.lang.Class, com.tangosol.coherence.rest.KeyConverter, com.tangosol.coherence.rest.config.QueryConfig, int)
method instead.- Parameters:
configResource
- the resource configuration- Returns:
- a fully configured cache resource
-
instantiateCacheResource
protected CacheResource instantiateCacheResource(NamedCache cache, Class clzKey, Class clzValue, KeyConverter keyConverter, QueryConfig queryConfig, int cMaxResults) Create an instance ofCacheResource
.- Parameters:
cache
- cache to create a resource forclzKey
- key class of the cached entriesclzValue
- value class of the cached entrieskeyConverter
- key converter to usequeryConfig
- query configuration for this resourcecMaxResults
- max size of result set for this resource- Returns:
- a cache resource
-