Note that there are some explanatory texts on larger screens.

plurals
  1. POAkka Futures + Spring MVC deferred results + tomcat 7.+
    primarykey
    data
    text
    <p>Spring-api 3.+ onwards introduces support aync request processing, So I thought of putting it to sample webapplication with my favourite concurrency model provided by Akka</p> <p>my code looks something like this </p> <pre><code> @RequestMapping(value = Array("/"), method = Array(RequestMethod.GET)) @ResponseBody def adminHome(request: HttpServletRequest) : DeferredResult[ModelAndView] = { import ExecutionContext.Implicits.global val result = new DeferredResult[ModelAndView] ........ code for some future ......... // creating model map future from some future val modelMapFuture: Future[Map[String, Any]] = someFuture.flatMap(urlObjects =&gt; Future( Map("urlList" -&gt; urlObjects.asJava) )) // setting the deferred result value upon completion of future modelMapFuture.onComplete { case Success(modelMap) =&gt; result.setResult(new ModelAndView("index", modelMap.asJava)) case Failure(e) =&gt; result.setResult(new ModelAndView("index")) } result } </code></pre> <p>I have enable the aync support for Spring mvc DispatcherServelet and all the Filters attached to the url mapping of particular servelet.</p> <p>But all the time I'm getting an empty page as the result. </p> <p>I can help you to narrow down the problem by saying - </p> <p>a. No exception in model/view</p> <p>If I set view as a simple JSP with hello world, its also not loading. </p> <p>b. Request mapping is working perfectly</p> <p>c. Future gets completed without errors </p> <p>d. Deffered result is set properly </p> <p>I have bind a DeferredResultProcessingInterceptorAdapter implementation to the mvc:deferred-result-interceptors and put logs for beforeConcurrentHandling, preProcess, postProcess and afterCompletion I'm getting following logs from the interceptor</p> <blockquote> <p>Before concurrent handling request : deffered result expired or set is : false </p> <p>pre process : deffered result expired or set is : false</p> <p>post process : deffered result expired or set is : true </p> <p>after completion : deffered result expired or set is : true</p> </blockquote> <p>Any help will be highly appriciated as I was strugging with this for entire two days. </p> <p>More details </p> <p>Spring version 3.2.3-RELEASE Tomcat version 7.0.42</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload