Class ODataErrorContext
- java.lang.Object
-
- org.apache.olingo.odata2.api.processor.ODataErrorContext
-
public class ODataErrorContext extends Object
Error context information bean. Usually created and in error situations.- See Also:
EntityProvider,ODataErrorCallback
-
-
Constructor Summary
Constructors Constructor Description ODataErrorContext()create a new context object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContentType()Get the content type which should be used to serialize an error response.StringgetErrorCode()Return OData error code that is returned in error response.ExceptiongetException()Returns the causing exception.HttpStatusCodesgetHttpStatus()Get the status code which will be returned in error response.StringgetInnerError()Get a string for a OData inner error to be returned in error response.LocalegetLocale()Return the locale of the translated message.StringgetMessage()Return a translated error message.PathInfogetPathInfo()GetPathInfoobject.List<String>getRequestHeader(String name)Get the list of values for a request header.Map<String,List<String>>getRequestHeaders()Return a map of http headers to be returned in error response.URIgetRequestUri()Get the request uri to be used in an error response.voidputRequestHeader(String key, List<String> value)Put http headers to be returned in error response.voidsetContentType(String contentType)Set content type which should be used to serialize an error response.voidsetErrorCode(String errorCode)Set OData error code that should be returned in error response.voidsetException(Exception exception)Set the causing exception.voidsetHttpStatus(HttpStatusCodes status)Set http status code that should be returned in error response.voidsetInnerError(String innerError)Set a string for a OData inner error to be returned in error response.voidsetLocale(Locale locale)Set the locale for a translated message.voidsetMessage(String message)Set a translated message.voidsetPathInfo(PathInfo pathInfo)SetPathInfoobject.voidsetRequestUri(URI requestUri)Set the request uri to be used in a error response.
-
-
-
Method Detail
-
getException
public Exception getException()
Returns the causing exception.- Returns:
- exception object
-
setException
public void setException(Exception exception)
Set the causing exception.- Parameters:
exception- exception object
-
getContentType
public String getContentType()
Get the content type which should be used to serialize an error response.- Returns:
- a content type
-
setContentType
public void setContentType(String contentType)
Set content type which should be used to serialize an error response.- Parameters:
contentType- a content type
-
getHttpStatus
public HttpStatusCodes getHttpStatus()
Get the status code which will be returned in error response.- Returns:
- http status code
-
setHttpStatus
public void setHttpStatus(HttpStatusCodes status)
Set http status code that should be returned in error response.- Parameters:
status- http status code
-
getErrorCode
public String getErrorCode()
Return OData error code that is returned in error response.- Returns:
- an application defined error code
-
setErrorCode
public void setErrorCode(String errorCode)
Set OData error code that should be returned in error response.- Parameters:
errorCode- an application defined error code
-
getMessage
public String getMessage()
Return a translated error message.- Returns:
- translated message
-
setMessage
public void setMessage(String message)
Set a translated message.- Parameters:
message- translated message
-
getLocale
public Locale getLocale()
Return the locale of the translated message.- Returns:
- a locale
-
setLocale
public void setLocale(Locale locale)
Set the locale for a translated message.- Parameters:
locale- a locale
-
putRequestHeader
public void putRequestHeader(String key, List<String> value)
Put http headers to be returned in error response.- Parameters:
key- header namevalue- list of header values
-
getRequestHeaders
public Map<String,List<String>> getRequestHeaders()
Return a map of http headers to be returned in error response.- Returns:
- a map of http headers
-
getRequestHeader
public List<String> getRequestHeader(String name)
Get the list of values for a request header.- Parameters:
name- header name- Returns:
- list of values
-
setRequestUri
public void setRequestUri(URI requestUri)
Set the request uri to be used in a error response.- Parameters:
requestUri- a uri object
-
getRequestUri
public URI getRequestUri()
Get the request uri to be used in an error response. Might be null in case the URI was the cause of the exception.- Returns:
- a uri object
-
getInnerError
public String getInnerError()
Get a string for a OData inner error to be returned in error response.- Returns:
- a inner error message
-
setInnerError
public void setInnerError(String innerError)
Set a string for a OData inner error to be returned in error response.- Parameters:
innerError- a inner error message
-
getPathInfo
public PathInfo getPathInfo()
GetPathInfoobject. May beNULLif no path info was created/set till error occurred (but may be over written by application).- Returns:
PathInfoorNULL.
-
-