@Path(value="/") public class DefaultRootResource extends Object
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.
Modifier and Type | Field and Description |
---|---|
protected RestConfig |
m_config
REST configuration.
|
protected org.glassfish.hk2.api.ServiceLocator |
m_serviceLocator |
protected Session |
m_session
Coherence session.
|
Constructor and Description |
---|
DefaultRootResource() |
Modifier and Type | Method and 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 of
CacheResource . |
protected CacheResource |
instantiateCacheResourceInternal(ResourceConfig configResource)
Create an instance of
CacheResource for the specified resource configuration. |
@Inject protected Session m_session
@Inject protected RestConfig m_config
@Inject protected org.glassfish.hk2.api.ServiceLocator m_serviceLocator
@Path(value="{name}") public CacheResource getCacheResource(@PathParam(value="name") String sName)
sName
- resource nameprotected CacheResource instantiateCacheResourceInternal(ResourceConfig configResource)
CacheResource
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.
configResource
- the resource configurationprotected CacheResource instantiateCacheResource(NamedCache cache, Class clzKey, Class clzValue, KeyConverter keyConverter, QueryConfig queryConfig, int cMaxResults)
CacheResource
.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