Package com.tangosol.coherence.rest
Class DefaultRootResource
- java.lang.Object
-
- com.tangosol.coherence.rest.DefaultRootResource
-
- Direct Known Subclasses:
PassThroughRootResource
@Path("/") public class DefaultRootResource extends Object
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
Fields Modifier and Type Field Description protected RestConfig
m_config
REST configuration.protected org.glassfish.hk2.api.ServiceLocator
m_serviceLocator
protected Session
m_session
Coherence session.
-
Constructor Summary
Constructors Constructor Description DefaultRootResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CacheResource
getCacheResource(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 Detail
-
m_session
@Inject protected Session m_session
Coherence session.
-
m_config
@Inject protected RestConfig m_config
REST configuration.
-
m_serviceLocator
@Inject protected org.glassfish.hk2.api.ServiceLocator m_serviceLocator
-
-
Method Detail
-
getCacheResource
@Path("{name}") public CacheResource getCacheResource(@PathParam("name") String sName)
Returns a resource representing single named cache.- Parameters:
sName
- resource name- Returns:
- resource representing single named cache
-
instantiateCacheResourceInternal
protected CacheResource instantiateCacheResourceInternal(ResourceConfig configResource)
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
-
-