當前位置: 首頁>>代碼示例>>Java>>正文


Java AsyncEvent.getThrowable方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:aws,項目名稱:aws-xray-sdk-java,代碼行數:14,代碼來源:AWSXRayServletFilter.java

示例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
    }
}
 
開發者ID:uavorg,項目名稱:uavstack,代碼行數:18,代碼來源:AsyncReqProcWithHttpClientCallback.java

示例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
    }
}
 
開發者ID:uavorg,項目名稱:uavstack,代碼行數:18,代碼來源:AsyncReqProcWithHttpClientCallback.java

示例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;
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:9,代碼來源:AsyncListenerWrapper.java

示例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;
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:8,代碼來源:AsyncListenerWrapper.java

示例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);
}
 
開發者ID:signicat,項目名稱:hystrix-servlet,代碼行數:11,代碼來源:AsyncWrapperServletTest.java

示例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();
}
 
開發者ID:sfera-labs,項目名稱:sfera,代碼行數:8,代碼來源:HttpResponse.java

示例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);
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:7,代碼來源:AsyncDispatcherServlet.java


注:本文中的javax.servlet.AsyncEvent.getThrowable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。