本文整理汇总了Java中javax.servlet.AsyncEvent.getThrowable方法的典型用法代码示例。如果您正苦于以下问题:Java AsyncEvent.getThrowable方法的具体用法?Java AsyncEvent.getThrowable怎么用?Java AsyncEvent.getThrowable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.servlet.AsyncEvent
的用法示例。
在下文中一共展示了AsyncEvent.getThrowable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processEvent
import javax.servlet.AsyncEvent; //导入方法依赖的package包/类
private void processEvent(AsyncEvent event) throws IOException {
Entity prior = recorder.getTraceEntity();
try {
Entity entity = (Entity) event.getSuppliedRequest().getAttribute(ENTITY_ATTRIBUTE_KEY);
recorder.setTraceEntity(entity);
if (null != event.getThrowable()) {
entity.addException(event.getThrowable());
}
filter.postFilter(event.getSuppliedRequest(), event.getSuppliedResponse());
} finally {
recorder.setTraceEntity(prior);
}
}
示例2: onError
import javax.servlet.AsyncEvent; //导入方法依赖的package包/类
@Override
public void onError(AsyncEvent arg0) throws IOException {
// 也要返回合理的错误信息
try {
OutputStream os = ac.getResponse().getOutputStream();
HttpClientCallbackResult result = new HttpClientCallbackResult(null, os);
HttpAsyncException exp = new HttpAsyncException(HttpAsyncException.ExceptionEvent.REQASYNC_ERROR,
arg0.getThrowable());
result.setRetCode(getStatusCode());
result.setException(exp);
callback.failed(result);
}
catch (RuntimeException e) {
// ignore
}
}
示例3: onTimeout
import javax.servlet.AsyncEvent; //导入方法依赖的package包/类
@Override
public void onTimeout(AsyncEvent arg0) throws IOException {
// 超时,也要返回合理的错误信息
try {
OutputStream os = ac.getResponse().getOutputStream();
HttpClientCallbackResult result = new HttpClientCallbackResult(null, os);
HttpAsyncException exp = new HttpAsyncException(HttpAsyncException.ExceptionEvent.REQASYNC_TIMEOUT,
arg0.getThrowable());
result.setRetCode(getStatusCode());
result.setException(exp);
callback.failed(result);
}
catch (RuntimeException e) {
// ignore
}
}
示例4: customizeEvent
import javax.servlet.AsyncEvent; //导入方法依赖的package包/类
private AsyncEvent customizeEvent(AsyncEvent event) {
if (servletRequest != null && servletResponse != null) {
return new AsyncEvent(event.getAsyncContext(), servletRequest, servletResponse,
event.getThrowable());
} else {
return event;
}
}
示例5: customizeEvent
import javax.servlet.AsyncEvent; //导入方法依赖的package包/类
private AsyncEvent customizeEvent(AsyncEvent event) {
if (servletRequest != null && servletResponse != null) {
return new AsyncEvent(event.getAsyncContext(), servletRequest, servletResponse, event.getThrowable());
} else {
return event;
}
}
示例6: onServletError
import javax.servlet.AsyncEvent; //导入方法依赖的package包/类
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Override
public void onServletError(AsyncEvent asyncEvent) throws IOException {
System.err.println("onServletError()");
if (asyncEvent.getThrowable() != null) {
asyncEvent.getThrowable().printStackTrace(System.err);
}
servletError.countDown();
super.onServletError(asyncEvent);
}
示例7: onError
import javax.servlet.AsyncEvent; //导入方法依赖的package包/类
@Override
public void onError(AsyncEvent event) throws IOException {
Throwable t = event.getThrowable();
logger.error("Async response error", t);
sendServerError(t.getMessage());
asyncContext.complete();
}
示例8: onError
import javax.servlet.AsyncEvent; //导入方法依赖的package包/类
@Override
public void onError(AsyncEvent event) throws IOException {
String error = (event.getThrowable() == null ? "UNKNOWN ERROR" : event.getThrowable().getMessage());
logger.error("Error in async request " + error);
handleTimeoutOrError(event, "Error processing " + error);
}