Top Description Fields Constructors Methods
javax.ws.rs

public Class NotAllowedException

extends ClientErrorException
Class Inheritance
Imports
java.util.Collections, .HashSet, .Set, javax.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(String
allowed request method.
allowed
,
String...
more allowed request methods.
moreAllowed
)

Construct a new method not allowed exception.

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

Construct a new method not allowed exception.

public
NotAllowedException(Response
error response.
response
)

Construct a new method not allowed exception.

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

Construct a new method not allowed exception.

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

Construct a new method not allowed exception.

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

Construct a new method not allowed exception.

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

Construct a new method not allowed exception.

public
NotAllowedException(String
the detail message (which is saved for later retrieval by the getMessage() method).
message
,
Response
error response.
response
,
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(String allowed, String... moreAllowed)

private static Response
validateAllow(final Response response)

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javax.ws.rs.ClientErrorException.serialVersionUID.

Constructor Detail

NotAllowedExceptionback to summary
public NotAllowedException(String allowed, 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(String message, String allowed, 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(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(String message, 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(Throwable cause, 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(String message, Throwable cause, 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(Response response, 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(String message, Response response, 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(String allowed, String... moreAllowed)
validateAllowback to summary
private static Response validateAllow(final Response response)