com.taursys.servlet.respond
Class ErrorResponder

java.lang.Object
  extended bycom.taursys.servlet.respond.AbstractResponder
      extended bycom.taursys.servlet.respond.ErrorResponder
All Implemented Interfaces:
Responder

public class ErrorResponder
extends AbstractResponder

ErrorResponder sends status code and optional message as response.

Version:
1.0
Author:
Marty Phelan

Constructor Summary
ErrorResponder()
          Constructs a new ErrorResponder
ErrorResponder(int statusCode)
          Constructs a new ErrorResponder with status code
ErrorResponder(int statusCode, java.lang.String message)
          Constructs a new ErrorResponder with status code and message
 
Method Summary
 java.lang.String getMessage()
          Get the optional message to be used for the reponse.
 int getStatusCode()
          Get the status code to be used for the response.
 void respond()
          Responds by sending status code and optional message.
 void setMessage(java.lang.String newMessage)
          Set the optional message to be used for the reponse.
 void setStatusCode(int newStatusCode)
          Set the status code to be used for the response.
 
Methods inherited from class com.taursys.servlet.respond.AbstractResponder
getServletForm, setServletForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorResponder

public ErrorResponder()
Constructs a new ErrorResponder


ErrorResponder

public ErrorResponder(int statusCode)
Constructs a new ErrorResponder with status code


ErrorResponder

public ErrorResponder(int statusCode,
                      java.lang.String message)
Constructs a new ErrorResponder with status code and message

Method Detail

respond

public void respond()
             throws java.lang.Exception
Responds by sending status code and optional message.

Specified by:
respond in interface Responder
Specified by:
respond in class AbstractResponder
Throws:
java.lang.Exception - if problem responding

setStatusCode

public void setStatusCode(int newStatusCode)
Set the status code to be used for the response.

Parameters:
newStatusCode - the status code to be used for the response.

getStatusCode

public int getStatusCode()
Get the status code to be used for the response.

Returns:
the status code to be used for the response.

setMessage

public void setMessage(java.lang.String newMessage)
Set the optional message to be used for the reponse. If the message is null, only the status code will be sent.

Parameters:
newMessage - the optional message to be used for the reponse.

getMessage

public java.lang.String getMessage()
Get the optional message to be used for the reponse. If the message is null, only the status code will be sent.

Returns:
the optional message to be used for the reponse.


Copyright © 2007 Martin T Phelan. All Rights Reserved.