本文整理匯總了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);
}