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:
  • Constructor Details

    • ODataErrorContext

      public ODataErrorContext()
      create a new context object
  • Method Details

    • 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
    • getSeverity

      public String getSeverity()
      Return OData severity that is returned in error response.
      Returns:
      an application defined severity
    • setSeverity

      public void setSeverity(String severity)
      Set OData severity that should be returned in error response.
      Parameters:
      severity - an application defined severity
    • 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 name
      value - 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
    • getErrorDetails

      public Collection<ODataErrorContext> getErrorDetails()
      Get a collection of detailed errors for a OData inner error to be returned in error response.
      Returns:
      a inner error message
    • getTarget

      public String getTarget()
      Get a target of detailed error for a OData inner error to be returned in error response.
      Returns:
      a target
    • setTarget

      public void setTarget(String target)
      Set a target for a OData detailed error to be returned in error response.
      Parameters:
      target - a target
    • setErrorDetails

      public void setErrorDetails(Collection<ODataErrorContext> errorDetails)
      Set a collection of detailed errors for a OData inner error to be returned in error response. If set, will overwrite the innerError element.
      Parameters:
      errorDetails - a inner error message
    • getPathInfo

      public PathInfo getPathInfo()
      Get PathInfo object. May be NULL if no path info was created/set till error occurred (but may be over written by application).
      Returns:
      PathInfo or NULL.
    • setPathInfo

      public void setPathInfo(PathInfo pathInfo)
      Set PathInfo object.
      Parameters:
      pathInfo - path info