Enum HttpExceptionHandling

java.lang.Object
java.lang.Enum<HttpExceptionHandling>
org.refcodes.rest.HttpExceptionHandling
All Implemented Interfaces:
Serializable, Comparable<HttpExceptionHandling>, java.lang.constant.Constable

public enum HttpExceptionHandling extends Enum<HttpExceptionHandling>
Defines how errors affect the HTTP-Body whilst processing a HttpRequest or a HttpResponse along with the according sub-classes. Usually the following fields are written into the HTTP-Body (if possible): "timestamp", "status", "error": "Bad Request", "exception" and "message". Usually the causing exception's message is used for the "message" attribute: Make sure you do not reveal any sensible information in the exception's message.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Create a new HTTP-Response with the according HTTP-Status-Code and and an empty body.
    Do not modify the so far processed HTTP-Response except update the actual HTTP-Status-Code.
    Keep the so far processed HTTP-Response as is except update the actual HTTP-Status-Code, add only non-existing fields if possible with the error description fields.
    Create a new HTTP-Response with the according HTTP-Status-Code and the error description fields.
    Keep the so far processed HTTP-Response as is except the HTTP-Status-Code and also update all error description fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • KEEP

      public static final HttpExceptionHandling KEEP
      Do not modify the so far processed HTTP-Response except update the actual HTTP-Status-Code. Useful when you manually prepared the HTTP-Response yourself.
    • MERGE

      public static final HttpExceptionHandling MERGE
      Keep the so far processed HTTP-Response as is except update the actual HTTP-Status-Code, add only non-existing fields if possible with the error description fields. Useful when you manually prepared the HTTP-Response yourself.
    • UPDATE

      public static final HttpExceptionHandling UPDATE
      Keep the so far processed HTTP-Response as is except the HTTP-Status-Code and also update all error description fields. Useful when you want to preserve already set fields.
    • REPLACE

      public static final HttpExceptionHandling REPLACE
      Create a new HTTP-Response with the according HTTP-Status-Code and the error description fields.
    • EMPTY

      public static final HttpExceptionHandling EMPTY
      Create a new HTTP-Response with the according HTTP-Status-Code and and an empty body.
  • Method Details

    • values

      public static HttpExceptionHandling[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static HttpExceptionHandling valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null