Class ResourceException

All Implemented Interfaces:
Serializable

public class ResourceException extends RuntimeException
Encapsulates a response status and the optional cause as a checked exception.
Author:
Jerome Louvel
See Also:
  • Constructor Details

    • ResourceException

      public ResourceException(int code)
      Constructor.
      Parameters:
      code - The specification code of the encapsulated status.
    • ResourceException

      public ResourceException(int code, String reasonPhrase)
      Constructor.
      Parameters:
      code - The specification code of the encapsulated status.
      reasonPhrase - The short reason phrase displayed next to the status code in a HTTP response.
    • ResourceException

      public ResourceException(int code, String reasonPhrase, String description)
      Constructor.
      Parameters:
      code - The specification code of the encapsulated status.
      reasonPhrase - The short reason phrase displayed next to the status code in a HTTP response.
      description - The description of the encapsulated status.
    • ResourceException

      public ResourceException(int code, String name, String description, String uri)
      Constructor.
      Parameters:
      code - The specification code of the encapsulated status.
      name - The name of the encapsulated status.
      description - The description of the encapsulated status.
      uri - The URI of the specification describing the method.
    • ResourceException

      public ResourceException(int code, String reasonPhrase, String description, String uri, Throwable cause)
      Constructor.
      Parameters:
      code - The specification code of the encapsulated status.
      reasonPhrase - The short reason phrase displayed next to the status code in a HTTP response.
      description - The description of the encapsulated status.
      uri - The URI of the specification describing the method.
      cause - The wrapped cause error or exception.
    • ResourceException

      public ResourceException(int code, Throwable cause)
      Constructor.
      Parameters:
      code - The specification code of the encapsulated status.
      cause - The wrapped cause error or exception.
    • ResourceException

      public ResourceException(int code, Throwable throwable, String reasonPhrase)
      Constructor.
      Parameters:
      code - The specification code.
      throwable - The related error or exception.
      reasonPhrase - The short reason phrase displayed next to the status code in a HTTP response.
    • ResourceException

      public ResourceException(int code, Throwable throwable, String reasonPhrase, String description)
      Constructor.
      Parameters:
      code - The specification code.
      throwable - The related error or exception.
      reasonPhrase - The short reason phrase displayed next to the status code in a HTTP response.
      description - The longer description.
    • ResourceException

      public ResourceException(int code, Throwable throwable, String reasonPhrase, String description, String uri)
      Constructor.
      Parameters:
      code - The specification code.
      throwable - The related error or exception.
      reasonPhrase - The short reason phrase displayed next to the status code in a HTTP response.
      description - The longer description.
      uri - The URI of the specification describing the method.
    • ResourceException

      public ResourceException(Status status)
      Constructor.
      Parameters:
      status - The status to associate.
    • ResourceException

      public ResourceException(Status status, Request request, Response response)
      Constructor.
      Parameters:
      status - The status to associate.
    • ResourceException

      public ResourceException(Status status, String description)
      Constructor.
      Parameters:
      status - The status to copy.
      description - The description of the encapsulated status.
    • ResourceException

      public ResourceException(Status status, String description, Throwable cause)
      Constructor.
      Parameters:
      status - The status to copy.
      description - The description of the encapsulated status.
      cause - The wrapped cause error or exception.
    • ResourceException

      public ResourceException(Status status, Throwable cause)
      Constructor.
      Parameters:
      status - The status to associate.
      cause - The wrapped cause error or exception.
    • ResourceException

      public ResourceException(Status status, Throwable cause, Request request, Response response)
      Constructor.
      Parameters:
      status - The status to associate.
      cause - The wrapped cause error or exception.
    • ResourceException

      public ResourceException(Throwable cause)
      Constructor that set the status to Status.SERVER_ERROR_INTERNAL including the related error or exception.
      Parameters:
      cause - The wrapped cause error or exception.
  • Method Details

    • getRequest

      public Request getRequest()
      Returns the request associated to this exception.
      Returns:
      The request associated to this exception.
    • getResponse

      public Response getResponse()
      Returns the response associated to this exception.
      Returns:
      The response associated to this exception.
    • getStatus

      public Status getStatus()
      Returns the status associated to this exception.
      Returns:
      The status associated to this exception.