Top Description Fields Constructors Methods
jakarta.ws.rs

public Class NotAuthorizedException

extends ClientErrorException
Class Inheritance
Static Imports
jakarta.ws.rs.core.HttpHeaders.WWW_AUTHENTICATE, .Response.Status.UNAUTHORIZED

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(final Object
authorization challenge applicable to the resource requested by the client.
challenge
,
final Object...
additional authorization challenge applicable to the requested resource.
moreChallenges
)

Construct a new "not authorized" exception.

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

Construct a new "not authorized" exception.

public
NotAuthorizedException(final Response
error response.
response
)

Construct a new "not authorized" exception.

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

Construct a new "not authorized" exception.

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

Construct a new "not authorized" exception.

public
NotAuthorizedException(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 Object
authorization challenge applicable to the requested resource.
challenge
,
final Object...
additional authorization challenge applicable to the requested resource.
moreChallenges
)

Construct a new "not authorized" exception.

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

Construct a new "not authorized" exception.

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

Method Summary

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

private static Response
createUnauthorizedResponse(final Object challenge, final 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 jakarta.ws.rs.ClientErrorException.serialVersionUID.

Constructor Detail

NotAuthorizedExceptionback to summary
public NotAuthorizedException(final Object challenge, final 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(final String message, final Object challenge, final 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(final 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(final String message, final 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(final Throwable cause, final Object challenge, final 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(final String message, final Throwable cause, final Object challenge, final 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(final Response response, final 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(final String message, final Response response, final 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(final Object challenge, final Object[] moreChallenges)
createUnauthorizedResponseback to summary
private static Response createUnauthorizedResponse(final Object challenge, final 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.