org.apache.olingo.odata2.api.processor
Interface ODataContext


public interface ODataContext

Compilation of generic context objects.

Do not implement this interface or derive from class.

Nested Class Summary
static interface ODataContext.RuntimeMeasurement
          Runtime measurements.
 
Field Summary
static String HTTP_SERVLET_REQUEST_OBJECT
           
 
Method Summary
 List<Locale> getAcceptableLanguages()
          Gets a list of languages that are acceptable for the response.
 ODataContext getBatchParentContext()
          If a request execution is part of batch processing then this method returns the context of the outer batch request.
 String getHttpMethod()
          Gets the HTTP method of the request.
 Object getParameter(String name)
          Gets a named parameter value.
 PathInfo getPathInfo()
          Gets information about the request path.
 String getRequestHeader(String name)
          Returns the first found header value of the HTTP request.
 Map<String,List<String>> getRequestHeaders()
          Returns all header values of the HTTP request but never null.
 List<ODataContext.RuntimeMeasurement> getRuntimeMeasurements()
          Gets the list of all runtime measurements.
 ODataService getService()
          Gets the OData service.
 ODataServiceFactory getServiceFactory()
           
 boolean isInBatchMode()
           
 boolean isInDebugMode()
          Gets information about enabled debug mode.
 void removeParameter(String name)
          Removes parameter.
 void setDebugMode(boolean debugMode)
          Enables debug mode.
 void setParameter(String name, Object value)
          Sets a parameter.
 int startRuntimeMeasurement(String className, String methodName)
          Starts runtime measurement.
 void stopRuntimeMeasurement(int handle)
          Stops runtime measurement.
 

Field Detail

HTTP_SERVLET_REQUEST_OBJECT

static final String HTTP_SERVLET_REQUEST_OBJECT
See Also:
Constant Field Values
Method Detail

getService

ODataService getService()
                        throws ODataException
Gets the OData service.

Returns:
ODataService related for this context
Throws:
ODataException

getServiceFactory

ODataServiceFactory getServiceFactory()
Returns:
the service factory instance

getPathInfo

PathInfo getPathInfo()
                     throws ODataException
Gets information about the request path.

Returns:
an OData path info object
Throws:
ODataException

getBatchParentContext

ODataContext getBatchParentContext()
If a request execution is part of batch processing then this method returns the context of the outer batch request.

Returns:
a batch parent context or null

isInBatchMode

boolean isInBatchMode()
Returns:
true in case of this request is part of a batch processing queue

startRuntimeMeasurement

int startRuntimeMeasurement(String className,
                            String methodName)
Starts runtime measurement.

Parameters:
className - class name where the runtime measurement starts
methodName - method name where the runtime measurement starts
Returns:
handle for the started runtime measurement which can be used for stopping

stopRuntimeMeasurement

void stopRuntimeMeasurement(int handle)
Stops runtime measurement.

Parameters:
handle - of runtime measurement to be stopped

getRuntimeMeasurements

List<ODataContext.RuntimeMeasurement> getRuntimeMeasurements()
Gets the list of all runtime measurements.

Returns:
list of all runtime measurements of type ODataContext.RuntimeMeasurement

getHttpMethod

String getHttpMethod()
Gets the HTTP method of the request.

Returns:
HTTP method as String

setParameter

void setParameter(String name,
                  Object value)
Sets a parameter.

Parameters:
name - of parameter (name is used as key, existing values are overwritten)
value - of parameter as object

removeParameter

void removeParameter(String name)
Removes parameter.

Parameters:
name - of parameter to be removed

getParameter

Object getParameter(String name)
Gets a named parameter value.

Parameters:
name - of parameter
Returns:
parameter value as Object for the given name

getRequestHeader

String getRequestHeader(String name)
Returns the first found header value of the HTTP request.

Parameters:
name - name of the first found request header element (e.g. "Content-Type")
Returns:
null or a request header value if found

getRequestHeaders

Map<String,List<String>> getRequestHeaders()
Returns all header values of the HTTP request but never null.

Returns:
immutable map of request header values

isInDebugMode

boolean isInDebugMode()
Gets information about enabled debug mode.

Returns:
debugMode as boolean

setDebugMode

void setDebugMode(boolean debugMode)
Enables debug mode.

Parameters:
debugMode - as boolean

getAcceptableLanguages

List<Locale> getAcceptableLanguages()
Gets a list of languages that are acceptable for the response. If no acceptable languages are specified, a read-only list containing a single wildcard java.util.Locale instance (with language field set to "*") is returned.

Returns:
a read-only list of acceptable languages sorted according to their q-value, with highest preference first.


Copyright © 2013-2015 The Apache Software Foundation. All Rights Reserved.