类 ResponseStatusException

    • 构造器详细资料

      • ResponseStatusException

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

        public ResponseStatusException​(HttpStatus status,
                                       @Nullable
                                       String reason,
                                       @Nullable
                                       Throwable cause)
        Constructor with a response status and a reason to add to the exception message as explanation, as well as a nested exception.
        参数:
        status - the HTTP status (required)
        reason - the associated reason (optional)
        cause - a nested exception (optional)
    • 方法详细资料

      • getHeaders

        @Deprecated
        public Map<String,​StringgetHeaders()
        已过时。
        as of 5.1.13 in favor of getResponseHeaders()
        Return headers associated with the exception that should be added to the error response, e.g. "Allow", "Accept", etc.

        The default implementation in this class returns an empty map.

        从以下版本开始:
        5.1.11
      • getResponseHeaders

        public HttpHeaders getResponseHeaders()
        Return headers associated with the exception that should be added to the error response, e.g. "Allow", "Accept", etc.

        The default implementation in this class returns empty headers.

        从以下版本开始:
        5.1.13