org.springframework.web.server

Class ResponseStatusException

    • Constructor Summary

      Constructors 
      Constructor and Description
      ResponseStatusException(HttpStatus status)
      Constructor with a response status.
      ResponseStatusException(HttpStatus status, java.lang.String reason)
      Constructor with a response status and a reason to add to the exception message as explanation.
      ResponseStatusException(HttpStatus status, java.lang.String reason, java.lang.Throwable cause)
      Constructor with a response status and a reason to add to the exception message as explanation, as well as a nested exception.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String getMessage()
      Return the detail message, including the message from the nested exception if there is one.
      java.lang.String getReason()
      The reason explaining the exception (potentially null or empty).
      HttpStatus getStatus()
      The HTTP status that fits the exception (never null).
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ResponseStatusException

        public ResponseStatusException(HttpStatus status)
        Constructor with a response status.
        Parameters:
        status - the HTTP status (required)
      • ResponseStatusException

        public ResponseStatusException(HttpStatus status,
                                       @Nullable
                                       java.lang.String reason)
        Constructor with a response status and a reason to add to the exception message as explanation.
        Parameters:
        status - the HTTP status (required)
        reason - the associated reason (optional)
      • ResponseStatusException

        public ResponseStatusException(HttpStatus status,
                                       @Nullable
                                       java.lang.String reason,
                                       @Nullable
                                       java.lang.Throwable cause)
        Constructor with a response status and a reason to add to the exception message as explanation, as well as a nested exception.
        Parameters:
        status - the HTTP status (required)
        reason - the associated reason (optional)
        cause - a nested exception (optional)
    • Method Detail

      • getStatus

        public HttpStatus getStatus()
        The HTTP status that fits the exception (never null).
      • getReason

        @Nullable
        public java.lang.String getReason()
        The reason explaining the exception (potentially null or empty).