Class HttpRequestMethodNotSupportedException

java.lang.Object
java.lang.Throwable
java.lang.Exception
jakarta.servlet.ServletException
org.springframework.web.HttpRequestMethodNotSupportedException
All Implemented Interfaces:
Serializable

public class HttpRequestMethodNotSupportedException extends ServletException
Exception thrown when a request handler does not support a specific request method.
Since:
2.0
Author:
Juergen Hoeller
See Also:
  • Constructor Details

    • HttpRequestMethodNotSupportedException

      public HttpRequestMethodNotSupportedException(String method)
      Create a new HttpRequestMethodNotSupportedException.
      Parameters:
      method - the unsupported HTTP request method
    • HttpRequestMethodNotSupportedException

      public HttpRequestMethodNotSupportedException(String method, String msg)
      Create a new HttpRequestMethodNotSupportedException.
      Parameters:
      method - the unsupported HTTP request method
      msg - the detail message
    • HttpRequestMethodNotSupportedException

      public HttpRequestMethodNotSupportedException(String method, @Nullable Collection<String> supportedMethods)
      Create a new HttpRequestMethodNotSupportedException.
      Parameters:
      method - the unsupported HTTP request method
      supportedMethods - the actually supported HTTP methods (may be null)
    • HttpRequestMethodNotSupportedException

      public HttpRequestMethodNotSupportedException(String method, @Nullable String[] supportedMethods)
      Create a new HttpRequestMethodNotSupportedException.
      Parameters:
      method - the unsupported HTTP request method
      supportedMethods - the actually supported HTTP methods (may be null)
    • HttpRequestMethodNotSupportedException

      public HttpRequestMethodNotSupportedException(String method, @Nullable String[] supportedMethods, String msg)
      Create a new HttpRequestMethodNotSupportedException.
      Parameters:
      method - the unsupported HTTP request method
      supportedMethods - the actually supported HTTP methods
      msg - the detail message
  • Method Details

    • getMethod

      public String getMethod()
      Return the HTTP request method that caused the failure.
    • getSupportedMethods

      @Nullable public String[] getSupportedMethods()
      Return the actually supported HTTP methods, or null if not known.
    • getSupportedHttpMethods

      @Nullable public Set<HttpMethod> getSupportedHttpMethods()
      Return the actually supported HTTP methods as HttpMethod instances, or null if not known.
      Since:
      3.2