}
@Override
public Response apply(final ContainerRequestContext req) {
// Suspend current request
final AsyncContext asyncContext = asyncContextProvider.get();
asyncContext.suspend();
Executors.newSingleThreadExecutor().submit(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
ex.printStackTrace(System.err);
}
// Returning will enter the suspended request
asyncContext.resume(Response.ok().entity(responseContent).build());
}
});
return null;
}