Top Description Fields Constructors Methods
org.springframework.web.server

public Class MethodNotAllowedException

extends ResponseStatusException
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
java.util.Collection, .Collections, .LinkedHashSet, .Set, org.springframework.http.HttpHeaders, .HttpMethod, .HttpStatus, org.springframework.lang.Nullable, org.springframework.util.Assert, .CollectionUtils

Exception for errors that fit response status 405 (method not allowed).
Author
Rossen Stoyanchev
Since
5.0

Field Summary

Modifier and TypeField and Description
private final Set<HttpMethod>
private final String

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public HttpHeaders
getHeaders()

Overrides org.springframework.web.server.ResponseStatusException.getHeaders.

Overrides default org.springframework.web.ErrorResponse.getHeaders.

Return HttpHeaders with an "Allow" header that documents the allowed HTTP methods for this URL, if available, or an empty instance otherwise.
public String
getHttpMethod()

Return the HTTP method for the failed request.

public HttpHeaders
public Set<HttpMethod>
getSupportedMethods()

Return the list of supported HTTP methods.

Inherited from org.springframework.web.server.ResponseStatusException:
getMessagegetReasonupdateAndGetBody

Field Detail

httpMethodsback to summary
private final Set<HttpMethod> httpMethods
methodback to summary
private final String method

Constructor Detail

MethodNotAllowedExceptionback to summary
public MethodNotAllowedException(HttpMethod method, Collection<HttpMethod> supportedMethods)
MethodNotAllowedExceptionback to summary
public MethodNotAllowedException(String method, Collection<HttpMethod> supportedMethods)

Method Detail

getHeadersback to summary
public HttpHeaders getHeaders()

Overrides org.springframework.web.server.ResponseStatusException.getHeaders.

Overrides default org.springframework.web.ErrorResponse.getHeaders.

Return HttpHeaders with an "Allow" header that documents the allowed HTTP methods for this URL, if available, or an empty instance otherwise.

Annotations
@Override
getHttpMethodback to summary
public String getHttpMethod()

Return the HTTP method for the failed request.

getResponseHeadersback to summary
public HttpHeaders getResponseHeaders()

Overrides org.springframework.web.server.ResponseStatusException.getResponseHeaders.

Deprecated

since 6.0.

as of 6.0 in favor of getHeaders()

Delegates to getHeaders().

Annotations
@Deprecated
since:6.0
@Override
Since
5.1.13
getSupportedMethodsback to summary
public Set<HttpMethod> getSupportedMethods()

Return the list of supported HTTP methods.