Version 4.10.0

hirondelle.web4j.model
Class BadRequestException

Object
  extended by Throwable
      extended by Exception
          extended by hirondelle.web4j.model.BadRequestException
All Implemented Interfaces:
Serializable

public final class BadRequestException
extends Exception

Thrown by ApplicationFirewall when a problem with an incoming HTTP request is detected.

This class is intended only for bugs and malicious attacks. It is not intended for normal business logic. If a BadRequestException is thrown by ApplicationFirewall, then the Controller will reply with a short, unpolished response (often a default page defined by the server). Under normal operating conditions, the end user should not see such a response.

See ApplicationFirewall for more information.

Design Note
This class is not an AppException, since it is meant to encapsulate only a single item at a time.

See Also:
Serialized Form

Constructor Summary
BadRequestException(int aHTTPStatusCode)
          Construct using a standard HTTP status code.
BadRequestException(int aHTTPStatusCode, String aErrorMessage)
          Construct using a standard HTTP status code and an error message to be presented to the user.
 
Method Summary
 String getErrorMessage()
          Return the error message passed to the constructor.
 int getStatusCode()
          Return the status code passed to the constructor.
 String toString()
          Intended for debugging only.
 
Methods inherited from class Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BadRequestException

public BadRequestException(int aHTTPStatusCode)
Construct using a standard HTTP status code.

The caller is highly encouraged to pass a field defined in HttpServletResponse to this constructor (HttpServletResponse.SC_NOT_IMPLEMENTED, and so on).

See W3C HTTP Specification for more information on status codes.


BadRequestException

public BadRequestException(int aHTTPStatusCode,
                           String aErrorMessage)
Construct using a standard HTTP status code and an error message to be presented to the user. See BadRequestException(int) for more information.

Method Detail

getStatusCode

public int getStatusCode()
Return the status code passed to the constructor.


getErrorMessage

public String getErrorMessage()
Return the error message passed to the constructor. If constructed without a message, then return null.


toString

public String toString()
Intended for debugging only.

Overrides:
toString in class Throwable

Version 4.10.0

Copyright Hirondelle Systems. Published October 19, 2013 - User Guide - All Docs.