org.springframework.web.server

## Class MethodNotAllowedException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - org.springframework.core.NestedRuntimeException
        - - org.springframework.web.server.ResponseStatusException
          - - org.springframework.web.server.MethodNotAllowedException

- All Implemented Interfaces:
    Serializable

      public class MethodNotAllowedException
      extends ResponseStatusException

  Exception for errors that fit response status 405 (method not allowed).
  Since:
    5.0
  Author:
    Rossen Stoyanchev
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodNotAllowedException(HttpMethod method, Collection<HttpMethod> supportedMethods)`
    `MethodNotAllowedException(String method, Collection<HttpMethod> supportedMethods)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Map<String,String>` | `getHeaders()` Return a Map with an "Allow" header.
    `String` | `getHttpMethod()` Return the HTTP method for the failed request.
    `HttpHeaders` | `getResponseHeaders()` Return HttpHeaders with an "Allow" header.
    `Set<HttpMethod>` | `getSupportedMethods()` Return the list of supported HTTP methods.

    - ### Methods inherited from class org.springframework.web.server.ResponseStatusException

      `getMessage, getRawStatusCode, getReason, getStatus`

    - ### Methods inherited from class org.springframework.core.NestedRuntimeException

      `contains, getMostSpecificCause, getRootCause`

    - ### 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

    - #### MethodNotAllowedException

          public MethodNotAllowedException(HttpMethod method,
                                           Collection<HttpMethod> supportedMethods)

    - #### MethodNotAllowedException

          public MethodNotAllowedException(String method,
                                           @Nullable
                                           Collection<HttpMethod> supportedMethods)

  - ### Method Detail

    - #### getHeaders

          public Map<String,String> getHeaders()

      Return a Map with an "Allow" header.
      Overrides:
        `getHeaders` in class `ResponseStatusException`
      Since:
        5.1.11

    - #### getResponseHeaders

          public HttpHeaders getResponseHeaders()

      Return HttpHeaders with an "Allow" header.
      Overrides:
        `getResponseHeaders` in class `ResponseStatusException`
      Since:
        5.1.13

    - #### getHttpMethod

          public String getHttpMethod()

      Return the HTTP method for the failed request.

    - #### getSupportedMethods

          public Set<HttpMethod> getSupportedMethods()

      Return the list of supported HTTP methods.