com.prolifics.servlet
Class AuthorizationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.prolifics.servlet.AuthorizationException
All Implemented Interfaces:
java.io.Serializable

public class AuthorizationException
extends java.lang.Exception

AuthorizationException is thrown by classes implementing the Authorization and AuthorizationFactory interfaces in order to indicate a failure of some sort. The failure may be a failure to interpret the Authorization header, for example, or an explicit rejection to authorize an authentic user to be given the requested access to a particular resource, or even a communications failure in reaching the authorization provider. Whatever the reason, an appropriate status code should be given to the AuthorizationException, as this code will be set in the HTTP Status header of the response from ProlificsHttpServlet. A String message and Throwable cause may be explicitly provided, which may be logged by ProlificsHttpServlet. In the case where a client may accept a text/html response, the message will be provided to the client. A resource, method, and user may be set, or they may remain null, as initialized by the constructors.

Since:
Panther 5.52
See Also:
Serialized Form

Constructor Summary
AuthorizationException()
          Constructs a new AuthorizationException with null as its detail message.
AuthorizationException(int statusCode, java.lang.String message)
          Constructs a new AuthorizationException with the specified detail message and status code.
AuthorizationException(int statusCode, java.lang.String message, java.lang.Throwable cause)
          Constructs a new AuthorizationException with the specified status code, detail message, and cause.
AuthorizationException(java.lang.String message)
          Constructs a new AuthorizationException with the specified detail message.
AuthorizationException(java.lang.Throwable cause)
          Constructs a new AuthorizationException with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).
 
Method Summary
 java.lang.String getMethod()
          Gets the method for this AuthorizationException.
 java.lang.String getResource()
          Gets the resource for this AuthorizationException.
 int getStatusCode()
          Returns the status code for this AuthorizationException.
 java.lang.String getUser()
          Gets the user for this AuthorizationException.
 void setMethod(java.lang.String method)
          Sets the method for this AuthorizationException.
 void setResource(java.lang.String resource)
          Sets the resource for this AuthorizationException.
 void setStatusCode(int statusCode)
          Sets the status code for this AuthorizationException.
 void setUser(java.lang.String user)
          Sets the user for this AuthorizationException.
 
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

AuthorizationException

public AuthorizationException()
Constructs a new AuthorizationException with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to initCause(java.lang.Throwable). The statusCode member is initialized to 401 (Unauthorized).


AuthorizationException

public AuthorizationException(java.lang.String message)
Constructs a new AuthorizationException with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to initCause(java.lang.Throwable). The statusCode member is initialized to 401 (Unauthorized).

Parameters:
message - the detail message. The detail message is saved for later retrieval by the getMessage() method.

AuthorizationException

public AuthorizationException(int statusCode,
                              java.lang.String message)
Constructs a new AuthorizationException with the specified detail message and status code. The cause is not initialized, and may subsequently be initialized by a call to initCause(java.lang.Throwable).

Parameters:
statusCode - an HTTP status code
message - the detail message. The detail message is saved for later retrieval by the getMessage() method.

AuthorizationException

public AuthorizationException(java.lang.Throwable cause)
Constructs a new AuthorizationException with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for exceptions that are little more than wrappers for other throwables (for example, PrivilegedActionException). The statusCode member is initialized to 401 (Unauthorized).

Parameters:
cause - the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

AuthorizationException

public AuthorizationException(int statusCode,
                              java.lang.String message,
                              java.lang.Throwable cause)
Constructs a new AuthorizationException with the specified status code, detail message, and cause.

Parameters:
statusCode - an HTTP status code
message - the detail message.
cause - the cause. (A null value is permitted, and indicates that the cause is nonexistent or unknown.))
Method Detail

getStatusCode

public int getStatusCode()
Returns the status code for this AuthorizationException.


setStatusCode

public void setStatusCode(int statusCode)
Sets the status code for this AuthorizationException.

Parameters:
statusCode - an HTTP status code

getMethod

public java.lang.String getMethod()
Gets the method for this AuthorizationException.


setMethod

public void setMethod(java.lang.String method)
Sets the method for this AuthorizationException.

Parameters:
method - an HTTP method name (GET, PUT, POST, DELETE)

getResource

public java.lang.String getResource()
Gets the resource for this AuthorizationException.


setResource

public void setResource(java.lang.String resource)
Sets the resource for this AuthorizationException.

Parameters:
resource - a resource

getUser

public java.lang.String getUser()
Gets the user for this AuthorizationException.


setUser

public void setUser(java.lang.String user)
Sets the user for this AuthorizationException.

Parameters:
user - a user