Top Description Fields Constructors Methods
javax.ws.rs

public Class NotAuthorizedException

extends ClientErrorException
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .Collections, .List, javax.ws.rs.core.Response

A runtime exception indicating request authorization failure caused by one of the following scenarios:
Author
Marek Potociar
Since
2.0

Field Summary

Modifier and TypeField and Description
private transient List<Object>
private static final long

Constructor Summary

AccessConstructor and Description
public
NotAuthorizedException(Object
authorization challenge applicable to the resource requested by the client.
challenge
,
Object...
additional authorization challenge applicable to the requested resource.
moreChallenges
)

Construct a new "not authorized" exception.

public
NotAuthorizedException(String
the detail message (which is saved for later retrieval by the getMessage() method).
message
,
Object
authorization challenge applicable to the resource requested by the client.
challenge
,
Object...
additional authorization challenge applicable to the requested resource.
moreChallenges
)

Construct a new "not authorized" exception.

public
NotAuthorizedException(Response
error response.
response
)

Construct a new "not authorized" exception.

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

Construct a new "not authorized" exception.

public
NotAuthorizedException(Throwable
the underlying cause of the exception.
cause
,
Object
authorization challenge applicable to the requested resource.
challenge
,
Object...
additional authorization challenge applicable to the requested resource.
moreChallenges
)

Construct a new "not authorized" exception.

public
NotAuthorizedException(String
the detail message (which is saved for later retrieval by the getMessage() method).
message
,
Throwable
the underlying cause of the exception.
cause
,
Object
authorization challenge applicable to the requested resource.
challenge
,
Object...
additional authorization challenge applicable to the requested resource.
moreChallenges
)

Construct a new "not authorized" exception.

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

Construct a new "not authorized" exception.

public
NotAuthorizedException(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 "not authorized" exception.

Method Summary

Modifier and TypeMethod and Description
private static List<Object>
cacheChallenges(Object challenge, Object[] moreChallenges)

private static Response
createUnauthorizedResponse(Object challenge, Object[] otherChallenges)

public List<Object>

Returns:

list of authorization challenges applicable to the resource requested by the client.
getChallenges
()

Get the list of authorization challenges associated with the exception and applicable to the resource requested by the client.

Field Detail

challengesback to summary
private transient List<Object> challenges
serialVersionUIDback to summary
private static final long serialVersionUID

Hides javax.ws.rs.ClientErrorException.serialVersionUID.

Constructor Detail

NotAuthorizedExceptionback to summary
public NotAuthorizedException(Object challenge, Object... moreChallenges)

Construct a new "not authorized" exception.

Parameters
challenge:Object

authorization challenge applicable to the resource requested by the client.

moreChallenges:Object[]

additional authorization challenge applicable to the requested resource.

Exceptions
NullPointerException:
in case the challenge parameter is null.
NotAuthorizedExceptionback to summary
public NotAuthorizedException(String message, Object challenge, Object... moreChallenges)

Construct a new "not authorized" exception.

Parameters
message:String

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

challenge:Object

authorization challenge applicable to the resource requested by the client.

moreChallenges:Object[]

additional authorization challenge applicable to the requested resource.

Exceptions
NullPointerException:
in case the challenge parameter is null.
NotAuthorizedExceptionback to summary
public NotAuthorizedException(Response response)

Construct a new "not authorized" exception.

Parameters
response:Response

error response.

Exceptions
IllegalArgumentException:
in case the status code set in the response is not HTTP 401.
NotAuthorizedExceptionback to summary
public NotAuthorizedException(String message, Response response)

Construct a new "not authorized" exception.

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 401.
NotAuthorizedExceptionback to summary
public NotAuthorizedException(Throwable cause, Object challenge, Object... moreChallenges)

Construct a new "not authorized" exception.

Parameters
cause:Throwable

the underlying cause of the exception.

challenge:Object

authorization challenge applicable to the requested resource.

moreChallenges:Object[]

additional authorization challenge applicable to the requested resource.

NotAuthorizedExceptionback to summary
public NotAuthorizedException(String message, Throwable cause, Object challenge, Object... moreChallenges)

Construct a new "not authorized" 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.

challenge:Object

authorization challenge applicable to the requested resource.

moreChallenges:Object[]

additional authorization challenge applicable to the requested resource.

NotAuthorizedExceptionback to summary
public NotAuthorizedException(Response response, Throwable cause)

Construct a new "not authorized" 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 401.
NotAuthorizedExceptionback to summary
public NotAuthorizedException(String message, Response response, Throwable cause)

Construct a new "not authorized" 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 401.

Method Detail

cacheChallengesback to summary
private static List<Object> cacheChallenges(Object challenge, Object[] moreChallenges)
createUnauthorizedResponseback to summary
private static Response createUnauthorizedResponse(Object challenge, Object[] otherChallenges)
getChallengesback to summary
public List<Object> getChallenges()

Get the list of authorization challenges associated with the exception and applicable to the resource requested by the client.

Returns:List<Object>

list of authorization challenges applicable to the resource requested by the client.