org.directwebremoting.jsonrpc.io
Class JsonRpcCallException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.directwebremoting.jsonrpc.io.JsonRpcCallException
All Implemented Interfaces:
java.io.Serializable

public class JsonRpcCallException
extends java.lang.RuntimeException

Thrown when a JSON-RPC request is not valid

Author:
Joe Walker [joe at getahead dot ltd dot uk]
See Also:
Serialized Form

Constructor Summary
JsonRpcCallException(JsonRpcCalls calls, java.lang.String reason, int jsonRpcErrorCode, int httpStatusCode)
          Setup using values from JsonRpcCalls
JsonRpcCallException(java.lang.String id, java.lang.String version, java.lang.String reason, int jsonRpcErrorCode, int httpStatusCode)
          All exceptions need these values to aid response generation
JsonRpcCallException(java.lang.String id, java.lang.String version, java.lang.String reason, int jsonRpcErrorCode, int httpStatusCode, java.lang.String data)
          Constructor will all possible fields setup
 
Method Summary
 java.lang.Object getData()
          Additional information, may be omitted.
 int getHttpStatusCode()
           
 java.lang.String getId()
          A Request identifier that SHOULD be a JSON scalar (String, Number, True, False), but SHOULD normally not be Null [1].
 int getJsonRpcErrorCode()
           
 java.lang.String getVersion()
           
 
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JsonRpcCallException

public JsonRpcCallException(java.lang.String id,
                            java.lang.String version,
                            java.lang.String reason,
                            int jsonRpcErrorCode,
                            int httpStatusCode,
                            java.lang.String data)
Constructor will all possible fields setup


JsonRpcCallException

public JsonRpcCallException(java.lang.String id,
                            java.lang.String version,
                            java.lang.String reason,
                            int jsonRpcErrorCode,
                            int httpStatusCode)
All exceptions need these values to aid response generation


JsonRpcCallException

public JsonRpcCallException(JsonRpcCalls calls,
                            java.lang.String reason,
                            int jsonRpcErrorCode,
                            int httpStatusCode)
Setup using values from JsonRpcCalls

Method Detail

getJsonRpcErrorCode

public int getJsonRpcErrorCode()
Returns:
the JSON-RPC error code that we should send in the error body. Should be one of the constants from JsonRpcConstants, like JsonRpcConstants.ERROR_CODE_NO_METHOD.

getHttpStatusCode

public int getHttpStatusCode()
Returns:
the HTTP status code that we should send to the client. Should be one of the constants from HttpServletResponse, like HttpServletResponse.SC_NOT_FOUND.

getId

public java.lang.String getId()
A Request identifier that SHOULD be a JSON scalar (String, Number, True, False), but SHOULD normally not be Null [1]. If omitted, the Request is a Notification.


getData

public java.lang.Object getData()
Additional information, may be omitted. Its contents is entirely defined by the application (e.g. detailed error information, nested errors etc.).


getVersion

public java.lang.String getVersion()
Returns:
the version number as passed in by the JSON-RPC request. Should default to 2.0 if no information is available

Copyright 2008