Top Description Fields Constructors Methods
jakarta.ws.rs

public Class NotAllowedException

extends ClientErrorException
Class Inheritance
Imports
java.util.Collections, .HashSet, .Set, jakarta.ws.rs.core.HttpHeaders, .Response

A runtime exception indicating a client requesting a resource method that is not allowed.
Author
Marek Potociar
Since
2.0

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public
NotAllowedException(final String
allowed request method.
allowed
,
final String...
more allowed request methods.
moreAllowed
)

Construct a new method not allowed exception.

public
NotAllowedException(final String
the detail message (which is saved for later retrieval by the getMessage() method).
message
,
final String
allowed request method.
allowed
,
final String...
more allowed request methods.
moreAllowed
)

Construct a new method not allowed exception.

public
NotAllowedException(final Response
error response.
response
)

Construct a new method not allowed exception.

public
NotAllowedException(final String
the detail message (which is saved for later retrieval by the getMessage() method).
message
,
final Response
error response.
response
)

Construct a new method not allowed exception.

public
NotAllowedException(final Throwable
the underlying cause of the exception.
cause
,
final String...
allowed request methods.
allowedMethods
)

Construct a new method not allowed exception.

public
NotAllowedException(final String
the detail message (which is saved for later retrieval by the getMessage() method).
message
,
final Throwable
the underlying cause of the exception.
cause
,
final String...
allowed request methods.
allowedMethods
)

Construct a new method not allowed exception.

public
NotAllowedException(final Response
error response.
response
,
final Throwable
the underlying cause of the exception.
cause
)

Construct a new method not allowed exception.

public
NotAllowedException(final String
the detail message (which is saved for later retrieval by the getMessage() method).
message
,
final Response
error response.
response
,
final Throwable
the underlying cause of the exception.
cause
)

Construct a new method not allowed exception.

Method Summary

Modifier and TypeMethod and Description
private static Response
createNotAllowedResponse(final String allowed, final String... moreAllowed)

private static Response
validateAllow(final Response response)

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides jakarta.ws.rs.ClientErrorException.serialVersionUID.

Constructor Detail

NotAllowedExceptionback to summary
public NotAllowedException(final String allowed, final String... moreAllowed)

Construct a new method not allowed exception.

Parameters
allowed:String

allowed request method.

moreAllowed:String[]

more allowed request methods.

Exceptions
NullPointerException:
in case the allowed method is null.
NotAllowedExceptionback to summary
public NotAllowedException(final String message, final String allowed, final String... moreAllowed)

Construct a new method not allowed exception.

Parameters
message:String

the detail message (which is saved for later retrieval by the getMessage() method).

allowed:String

allowed request method.

moreAllowed:String[]

more allowed request methods.

Exceptions
NullPointerException:
in case the allowed method is null.
NotAllowedExceptionback to summary
public NotAllowedException(final Response response)

Construct a new method not allowed exception.

Note that this constructor does not validate the presence of HTTP Allow header. I.e. it is possible to use the constructor to create a client-side exception instance even for an invalid HTTP 405 response content returned from a server.

Parameters
response:Response

error response.

Exceptions
IllegalArgumentException:
in case the status code set in the response is not HTTP 405.
NotAllowedExceptionback to summary
public NotAllowedException(final String message, final Response response)

Construct a new method not allowed exception.

Note that this constructor does not validate the presence of HTTP Allow header. I.e. it is possible to use the constructor to create a client-side exception instance even for an invalid HTTP 405 response content returned from a server.

Parameters
message:String

the detail message (which is saved for later retrieval by the getMessage() method).

response:Response

error response.

Exceptions
IllegalArgumentException:
in case the status code set in the response is not HTTP 405.
NotAllowedExceptionback to summary
public NotAllowedException(final Throwable cause, final String... allowedMethods)

Construct a new method not allowed exception.

Parameters
cause:Throwable

the underlying cause of the exception.

allowedMethods:String[]

allowed request methods.

Exceptions
IllegalArgumentException:
in case the allowed methods varargs are null.
NotAllowedExceptionback to summary
public NotAllowedException(final String message, final Throwable cause, final String... allowedMethods)

Construct a new method not allowed exception.

Parameters
message:String

the detail message (which is saved for later retrieval by the getMessage() method).

cause:Throwable

the underlying cause of the exception.

allowedMethods:String[]

allowed request methods.

Exceptions
IllegalArgumentException:
in case the allowed methods varargs are null.
NotAllowedExceptionback to summary
public NotAllowedException(final Response response, final Throwable cause)

Construct a new method not allowed exception.

Parameters
response:Response

error response.

cause:Throwable

the underlying cause of the exception.

Exceptions
IllegalArgumentException:
in case the status code set in the response is not HTTP 405 or does not contain an HTTP Allow header.
NotAllowedExceptionback to summary
public NotAllowedException(final String message, final Response response, final Throwable cause)

Construct a new method not allowed exception.

Parameters
message:String

the detail message (which is saved for later retrieval by the getMessage() method).

response:Response

error response.

cause:Throwable

the underlying cause of the exception.

Exceptions
IllegalArgumentException:
in case the status code set in the response is not HTTP 405 or does not contain an HTTP Allow header.

Method Detail

createNotAllowedResponseback to summary
private static Response createNotAllowedResponse(final String allowed, final String... moreAllowed)
validateAllowback to summary
private static Response validateAllow(final Response response)