javax.ws.rs
Class NotAuthorizedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by javax.ws.rs.WebApplicationException
                  extended by javax.ws.rs.ClientErrorException
                      extended by javax.ws.rs.NotAuthorizedException
All Implemented Interfaces:
Serializable

public class NotAuthorizedException
extends ClientErrorException

A runtime exception indicating request authorization failure caused by one of the following scenarios:

Since:
2.0
Author:
Marek Potociar
See Also:
Serialized Form

Constructor Summary
NotAuthorizedException(Object challenge, Object... moreChallenges)
          Construct a new "not authorized" exception.
NotAuthorizedException(Response response)
          Construct a new "not authorized" exception.
NotAuthorizedException(Response response, Throwable cause)
          Construct a new "not authorized" exception.
NotAuthorizedException(Throwable cause, Object challenge, Object... moreChallenges)
          Construct a new "not authorized" exception.
 
Method Summary
 List<Object> getChallenges()
          Get the list of authorization challenges associated with the exception and applicable to the resource requested by the client.
 
Methods inherited from class javax.ws.rs.WebApplicationException
getResponse
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NotAuthorizedException

public NotAuthorizedException(Object challenge,
                              Object... moreChallenges)
Construct a new "not authorized" exception.

Parameters:
challenge - authorization challenge applicable to the resource requested by the client.
moreChallenges - additional authorization challenge applicable to the requested resource.
Throws:
NullPointerException - in case the challenge parameter is null.

NotAuthorizedException

public NotAuthorizedException(Response response)
Construct a new "not authorized" exception.

Parameters:
response - error response.
Throws:
IllegalArgumentException - in case the status code set in the response is not HTTP 401.

NotAuthorizedException

public NotAuthorizedException(Throwable cause,
                              Object challenge,
                              Object... moreChallenges)
Construct a new "not authorized" exception.

Parameters:
cause - the underlying cause of the exception.
challenge - authorization challenge applicable to the requested resource.
moreChallenges - additional authorization challenge applicable to the requested resource.

NotAuthorizedException

public NotAuthorizedException(Response response,
                              Throwable cause)
Construct a new "not authorized" exception.

Parameters:
response - error response.
cause - the underlying cause of the exception.
Throws:
IllegalArgumentException - in case the status code set in the response is not HTTP 401.
Method Detail

getChallenges

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 of authorization challenges applicable to the resource requested by the client.


Copyright © 2013. All Rights Reserved.