com.ibm.portal.struts.portlet
Class ErrorResponseInfo

java.lang.Object
  extended by com.ibm.portal.struts.portlet.ErrorResponseInfo

public class ErrorResponseInfo
extends java.lang.Object

The ErrorResponseInfo class is used to support sendError in the Struts Portlet Framework. Instances of this class will store the error code and error text from the call to send error.

If an error is detected when creating or executing IViewCommands, then a StrutsViewErrorCommand is created to display the error. A class that extends IErrorResponseFormatter is used to format the display of the error.

Since:
5.1

Constructor Summary
ErrorResponseInfo(int errorCode)
          Construct an ErrorResponseInfo object with error code only and no text
ErrorResponseInfo(int errorCode, java.lang.String errorText)
          Construct an ErrorResponseInfo object with error code and text
 
Method Summary
static void clearErrorResponse(PortletRequest request)
          Remove error information.
 int getErrorCode()
          Return the error code
static ErrorResponseInfo getErrorResponse(PortletRequest request)
          This method will return the ErrorResponseInfo object from session if one can be found.
 java.lang.String getErrorText()
          Return the error text
static void setErrorResponse(PortletRequest request, int errorCode)
          This method is used to set an error code.
static void setErrorResponse(PortletRequest request, int errorCode, java.lang.String errorText)
          This method is used to set an error code and error text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorResponseInfo

public ErrorResponseInfo(int errorCode)
Construct an ErrorResponseInfo object with error code only and no text

Parameters:
errorCode - the int error code

ErrorResponseInfo

public ErrorResponseInfo(int errorCode,
                         java.lang.String errorText)
Construct an ErrorResponseInfo object with error code and text

Parameters:
errorCode - the int error code
errorText - the error text
Method Detail

getErrorCode

public int getErrorCode()
Return the error code

Returns:
returns the error code

getErrorText

public java.lang.String getErrorText()
Return the error text

Returns:
returns the error text, can be null

getErrorResponse

public static ErrorResponseInfo getErrorResponse(PortletRequest request)
This method will return the ErrorResponseInfo object from session if one can be found. If null is returned then the processing did not result in a call to sendError.

Parameters:
request - the request object
Returns:
returns the ErrorResponseInfo object if present or null otherwise

setErrorResponse

public static void setErrorResponse(PortletRequest request,
                                    int errorCode)
This method is used to set an error code. The error code can then be retrieved when the IViewCommands are created. If an error has been detected then an StrutsViewErrorCommand will be created.

Parameters:
request - the request object
errorCode - the error status code

setErrorResponse

public static void setErrorResponse(PortletRequest request,
                                    int errorCode,
                                    java.lang.String errorText)
This method is used to set an error code and error text. The error code can then be retrieved when the IViewCommands are created. If an error has been detected then an StrutsViewErrorCommand will be created.

Parameters:
request - the request object
errorCode - the error status code
errorText - the error status text

clearErrorResponse

public static void clearErrorResponse(PortletRequest request)
Remove error information. Once the appropriate StrutsViewCommand has been created for this error, the error information should be removed.

Parameters:
request - the request object