0

when a button click, I need to have stuff running in my background, so I have a async Servlet. From my managed bean, if I do redirect, it works great (meaning that it execute my run() method inside my class that extends Runnable correctly). Like this

String url = externalContext.getRequestContextPath() + "/ReportExecutionServlet";
externalContext.redirect(url);

But if I switch to dispatch, like this

externalContext.redirect("/ReportExecutionServlet");

it fail when I try to obtain the AsyncContext

AsyncContext aCtx = request.startAsync(request, response);

The error is below

Caused By: java.lang.IllegalStateException: The async-support is disabled on this request: weblogic.servlet.internal.ServletRequestImpl

Any idea how to fix this please?

NOTE: This is how to execute my async servlet, just in case:

    AsyncContext aCtx = request.startAsync(request, response);            
    //delegate long running process to an "async" thread
    aCtx.addListener(new AsyncListener() {

        @Override
        public void onComplete(AsyncEvent event) throws IOException {
            logger.log(Level.INFO, "ReportExecutionServlet handle async request - onComplete");
        }

        @Override
        public void onTimeout(AsyncEvent event) throws IOException {
            logger.log(Level.WARNING, "ReportExecutionServlet handle async request - onTimeout");
        }

        @Override
        public void onError(AsyncEvent event) throws IOException {
            logger.log(Level.SEVERE, "ReportExecutionServlet handle async request - onError");
        }

        @Override
        public void onStartAsync(AsyncEvent event) throws IOException {
            logger.log(Level.INFO, "ReportExecutionServlet handle async request - onStartAsync");
        }
    });
    // Start another service
    ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(10);            
    executor.execute(new AsyncRequestReportProcessor(aCtx));
Thang Pham
  • 38,125
  • 75
  • 201
  • 285
  • SOLVED: I refer you to this post: http://stackoverflow.com/questions/7855712/how-to-avoid-request-set-async-supported-true-to-enable-async-servlet-3-0-proces?rq=1 – Given Nov 28 '12 at 11:58

1 Answers1

0

JSF 2.x does not support async feature, so that why it is not working. More information can be found here FacesServlet Servlet 3.0 Async Support

Community
  • 1
  • 1
Thang Pham
  • 38,125
  • 75
  • 201
  • 285