Last active
April 3, 2016 06:29
-
-
Save abhirockzz/0f8263db676a438ec23cf2a296769875 to your computer and use it in GitHub Desktop.
Custom HTTP response on request time out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GET | |
public void async(@Suspended AsyncResponse ar) { | |
ar.setTimeout(3, TimeUnit.SECONDS); | |
ar.setTimeoutHandler(new TimeoutHandler() { | |
@Override | |
public void handleTimeout(AsyncResponse asyncResponse) { | |
asyncResponse.resume(Response.accepted(UUID.randomUUID().toString()).build()); //sending HTTP 202 (Accepted) | |
} | |
}); | |
...... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment