Example usage for org.springframework.web.context.request.async CallableProcessingInterceptor RESPONSE_HANDLED

List of usage examples for org.springframework.web.context.request.async CallableProcessingInterceptor RESPONSE_HANDLED

Introduction

In this page you can find the example usage for org.springframework.web.context.request.async CallableProcessingInterceptor RESPONSE_HANDLED.

Prototype

Object RESPONSE_HANDLED

To view the source code for org.springframework.web.context.request.async CallableProcessingInterceptor RESPONSE_HANDLED.

Click Source Link

Document

Constant indicating that the response has been handled by this interceptor without a result and that no further interceptors are to be invoked.

Usage

From source file:com.nec.harvest.servlet.interceptor.async.TimeoutCallableProcessingInterceptor.java

@Override
public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception {
    final HttpServletResponse servletResponse = request.getNativeResponse(HttpServletResponse.class);
    if (!servletResponse.isCommitted()) {
        servletResponse.sendError(HttpStatus.SERVICE_UNAVAILABLE.value());
    }//from   w  ww .  j  av a2 s.  c o  m

    return CallableProcessingInterceptor.RESPONSE_HANDLED;
}

From source file:org.springframework.web.context.request.async.CallableInterceptorChain.java

public Object triggerAfterTimeout(NativeWebRequest request, Callable<?> task) {
    cancelTask();/*w w  w . j  a v  a  2 s  .c o  m*/
    for (CallableProcessingInterceptor interceptor : this.interceptors) {
        try {
            Object result = interceptor.handleTimeout(request, task);
            if (result == CallableProcessingInterceptor.RESPONSE_HANDLED) {
                break;
            } else if (result != CallableProcessingInterceptor.RESULT_NONE) {
                return result;
            }
        } catch (Throwable t) {
            return t;
        }
    }
    return CallableProcessingInterceptor.RESULT_NONE;
}

From source file:org.springframework.web.context.request.async.CallableInterceptorChain.java

public Object triggerAfterError(NativeWebRequest request, Callable<?> task, Throwable throwable) {
    cancelTask();/*from   w  w  w.j a  v  a2s  .c o m*/
    for (CallableProcessingInterceptor interceptor : this.interceptors) {
        try {
            Object result = interceptor.handleError(request, task, throwable);
            if (result == CallableProcessingInterceptor.RESPONSE_HANDLED) {
                break;
            } else if (result != CallableProcessingInterceptor.RESULT_NONE) {
                return result;
            }
        } catch (Throwable t) {
            return t;
        }
    }
    return CallableProcessingInterceptor.RESULT_NONE;
}