Class EntityException

  • All Implemented Interfaces:
    Serializable

    public class EntityException
    extends EntityBrokerException
    This exception is used to indicate that a problem occurred attempting to get an entity, the reference to the failed entity should be returned in the exception along with the response code which is indicative of the failure (if possible) HTTP Response Codes (http://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
    Client Error
    400 Bad Request The request could not be understood by the server due to malformed syntax.
    401 Unauthorized The request requires user authentication. This will cause a SecurityException to be thrown in the direct servlet.
    404 Not Found The requested resource could not be found. Typically indicates the entity as identified cannot be located.
    405 Method Not Allowed The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource.
    422 Unprocessable Entity The server understands the media type of the request entity, but was unable to process the contained instructions.
    501 Not Implemented The prefix indicated is not handled by the entity system

    Redirection
    303 See Other The response to the request can be found under a different URI and SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource.

    Successful
    200 OK The request has succeeded.
    201 Created The request has been fulfilled and resulted in a new resource being created. The newly created resource can be referenced by the URI(s) returned in the entity of the response, with the most specific URI for the resource given by a Location header field.
    204 No Content The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation.
    Author:
    Aaron Zeckoski (aaron@caret.cam.ac.uk)
    See Also:
    Serialized Form
    • Field Detail

      • responseCode

        public int responseCode
        This is the response code related to the failure that occurred, should match with constants in HttpServletResponse
    • Constructor Detail

      • EntityException

        public EntityException​(String message,
                               String entityReference)
        Create an exception to indicate that this entity could not found, this will trigger an HTTP NOT FOUND error if not caught before reaching the direct servlet, defaults to not found response
        Parameters:
        message -
        entityReference - the unique reference to an entity
      • EntityException

        public EntityException​(String message,
                               String entityReference,
                               int responseCode)
        Create an exception to indicate that this entity could not found, this will trigger an HTTP NOT FOUND error if not caught before reaching the direct servlet
        Parameters:
        message -
        entityReference - the unique reference to an entity
        responseCode - the response code related to the failure that occurred, should match with the SC constants in HttpServletResponse