org.baswell.routes
Class ReturnHttpResponseStatus

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.baswell.routes.ReturnHttpResponseStatus
All Implemented Interfaces:
java.io.Serializable

public class ReturnHttpResponseStatus
extends java.lang.RuntimeException

When thrown from BeforeRoute or Route methods will be set with the status of this exception and no further processing will continue.

See Also:
Serialized Form

Field Summary
static ReturnHttpResponseStatus BAD_REQUEST
           Shortcut for returning 400.
static ReturnHttpResponseStatus FORBIDDEN
           Shortcut for returning 403.
static ReturnHttpResponseStatus INTERNAL_SERVER_ERROR
           Shortcut for returning 500.
static ReturnHttpResponseStatus NOT_FOUND
           Shortcut for returning 404.
 int status
          The HTTP status to return.
static ReturnHttpResponseStatus UNAUTHORIZED
           Shortcut for returning 401.
 
Constructor Summary
ReturnHttpResponseStatus(int status)
           
 
Method Summary
 
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
 

Field Detail

BAD_REQUEST

public static ReturnHttpResponseStatus BAD_REQUEST

Shortcut for returning 400.

 throw ReturnHttpResponseStatus.BAD_REQUEST;
 


UNAUTHORIZED

public static ReturnHttpResponseStatus UNAUTHORIZED

Shortcut for returning 401.

 throw ReturnHttpResponseStatus.UNAUTHORIZED;
 


FORBIDDEN

public static ReturnHttpResponseStatus FORBIDDEN

Shortcut for returning 403.

 throw ReturnHttpResponseStatus.FORBIDDEN;
 


NOT_FOUND

public static ReturnHttpResponseStatus NOT_FOUND

Shortcut for returning 404.

 throw ReturnHttpResponseStatus.NOT_FOUND;
 


INTERNAL_SERVER_ERROR

public static ReturnHttpResponseStatus INTERNAL_SERVER_ERROR

Shortcut for returning 500.

 throw ReturnHttpResponseStatus.INTERNAL_SERVER_ERROR;
 


status

public final int status
The HTTP status to return.

Constructor Detail

ReturnHttpResponseStatus

public ReturnHttpResponseStatus(int status)
Parameters:
status - The HTTP status to return.