本文整理汇总了Java中com.googlecode.jsonrpc4j.HttpException类的典型用法代码示例。如果您正苦于以下问题:Java HttpException类的具体用法?Java HttpException怎么用?Java HttpException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpException类属于com.googlecode.jsonrpc4j包,在下文中一共展示了HttpException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performBlockingRpcAction
import com.googlecode.jsonrpc4j.HttpException; //导入依赖的package包/类
/**
* Blocking execute of rpc action. Wraps errors into a tetherj response.
*
* @param rpcAction to execute
* @return response
*/
private <T> TetherjResponse<T> performBlockingRpcAction(RpcAction<T> rpcAction) {
ErrorType err = null;
Exception ex = null;
T rpcResponse = null;
try {
rpcResponse = rpcAction.call();
} catch (JsonRpcClientException rpcException) {
err = ErrorType.BLOCKCHAIN_CLIENT_OPERATION_ERROR;
ex = rpcException;
} catch (UndeclaredThrowableException | HttpException httpException) {
err = ErrorType.BLOCKCHAIN_CLIENT_BAD_CONNECTION;
ex = httpException;
} catch (Exception generalException) {
err = ErrorType.UNKNOWN_ERROR;
ex = generalException;
}
return new TetherjResponse<>(err, ex, rpcResponse);
}
示例2: JsonRpcProtocol
import com.googlecode.jsonrpc4j.HttpException; //导入依赖的package包/类
public JsonRpcProtocol() {
super(HttpException.class, JsonRpcClientException.class);
}