org.exoplatform.services.rest
Class ResourceDispatcher

java.lang.Object
  extended by org.exoplatform.services.rest.ResourceDispatcher
All Implemented Interfaces:
Connector

public class ResourceDispatcher
extends Object
implements Connector

Created by The eXo Platform SAS.
ResourceDispatcher finds ResourceContainer with can serve the Request and calls method it.

Version:
$Id: $
Author:
Gennady Azarenkov

Nested Class Summary
 class ResourceDispatcher.Context
          Keep runtime context and later it can be used for getting some runtime information in ResourceContainer.
 
Field Summary
static String CONTEXT_PARAM_ABSLOCATION
          Context parameter 'absLocation'.
static String CONTEXT_PARAM_BASE_URI
          Context parameter 'baseURI'.
static String CONTEXT_PARAM_HOST
          Context parameter 'host'.
static String CONTEXT_PARAM_REL_URI
          Context parameter 'relURI'.
 
Constructor Summary
ResourceDispatcher(org.exoplatform.container.xml.InitParams params, ResourceBinder binder, EntityTransformerFactory factory)
          Constructor gets all binded ResourceContainers from ResourceBinder.
 
Method Summary
 void addContextParameter(String key, String value)
          Add new Context parameter.
 Response dispatch(Request request)
          Dispatches Request to method of ResourceContainer.
 ResourceDispatcher.Context getRuntimeContext()
          Deprecated. Instead of directly use Context should be user @ContextParam.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_PARAM_HOST

public static final String CONTEXT_PARAM_HOST
Context parameter 'host'.

See Also:
Constant Field Values

CONTEXT_PARAM_BASE_URI

public static final String CONTEXT_PARAM_BASE_URI
Context parameter 'baseURI'.

See Also:
Constant Field Values

CONTEXT_PARAM_REL_URI

public static final String CONTEXT_PARAM_REL_URI
Context parameter 'relURI'.

See Also:
Constant Field Values

CONTEXT_PARAM_ABSLOCATION

public static final String CONTEXT_PARAM_ABSLOCATION
Context parameter 'absLocation'.

See Also:
Constant Field Values
Constructor Detail

ResourceDispatcher

public ResourceDispatcher(org.exoplatform.container.xml.InitParams params,
                          ResourceBinder binder,
                          EntityTransformerFactory factory)
                   throws Exception
Constructor gets all binded ResourceContainers from ResourceBinder.

Parameters:
params - the initialized parameters for ResourceDispatcher.
binder - the ResourceBinder component.
factory - the EntityTransformerFactory component.
Throws:
Exception - any Exception.
Method Detail

dispatch

public Response dispatch(Request request)
                  throws Exception
Dispatches Request to method of ResourceContainer.

Parameters:
request - REST request.
Returns:
REST response from ResourceContainer.
Throws:
Exception - any Exception.

getRuntimeContext

@Deprecated
public ResourceDispatcher.Context getRuntimeContext()
Deprecated. Instead of directly use Context should be user @ContextParam.

Get runtime context.

Returns:
the runtimeContext.

addContextParameter

public void addContextParameter(String key,
                                String value)
Add new Context parameter. This method can be used to set some context parameter. Any Resources can get access to ResourceDispatcher through ExoContainer in runtime (Filter for example). Then this parameter can be used in end point service.

Parameters:
key - the key.
value - the value.


Copyright © 2009 eXo Platform SAS. All Rights Reserved.