org.apache.oozie.servlet
Class XServletException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by javax.servlet.ServletException
              extended by org.apache.oozie.servlet.XServletException
All Implemented Interfaces:
Serializable

public class XServletException
extends javax.servlet.ServletException

Specialized Oozie servlet exception that uses Oozie error codes.

It extends ServletException so it can be handled in the Servlet.service method of the JsonRestServlet.

See Also:
Serialized Form

Constructor Summary
XServletException(int httpStatusCode, ErrorCode errorCode, Object... params)
          Create a XServletException that triggers a specified HTTP error code.
XServletException(int httpStatusCode, XException ex)
          Create a DagXServletException that triggers a HTTP BAD_REQUEST (400).
 
Method Summary
 ErrorCode getErrorCode()
          Return the Oozie error code for the exception.
 int getHttpStatusCode()
          Return the HTTP error code to return to the client.
 
Methods inherited from class javax.servlet.ServletException
getRootCause
 
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

XServletException

public XServletException(int httpStatusCode,
                         XException ex)
Create a DagXServletException that triggers a HTTP BAD_REQUEST (400).

Parameters:
httpStatusCode - HTTP error code to return.
ex - cause

XServletException

public XServletException(int httpStatusCode,
                         ErrorCode errorCode,
                         Object... params)
Create a XServletException that triggers a specified HTTP error code.

Parameters:
httpStatusCode - HTTP error code to return.
errorCode - Oozie error code.
params - paramaters to use in the error code template. If the last parameter is an Exception,
Method Detail

getErrorCode

public ErrorCode getErrorCode()
Return the Oozie error code for the exception.

Returns:
error code for the exception.

getHttpStatusCode

public int getHttpStatusCode()
Return the HTTP error code to return to the client.

Returns:
HTTP error code.


Copyright © 2013 Apache Software Foundation. All Rights Reserved.