Answer from Spring Async Controller

I wrote a spring rest Async controller that returns a String JSON response.When I ask the browser to complete the response and the controller hasn't finished processing, so the response is not ready.

I am using spring Boot, Apache as an embedded server. In EmbeddedServletContainerFactory, I have set AsyncTimeout as well.

TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
        factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
            @Override
            public void customize(Connector connector) {
                connector.setAsyncTimeout(10000000);
            }
        });

      

So how do I make the browser wait for the Async'ly controller to complete the response?

And the controller

@Async
 @RequestMapping(value = "/id", method = RequestMethod.GET)
    public String getDetails(@PathVariable("id") String id) {
       // wrote logic for JSON response....
}

      

+3


source to share





All Articles