Sorry for bringing such old thread, but wouldn't it work with try-finanly
?
Something like:
try {
// some actions
return javax.ws.rs.core.Response.status(200).entity("response").build();
} finally {
// here I would like to perform an action after the response is sent to the browser
// for eg. change a state of a file to processed or do a database operation or anything in that manner
}
I would expect that this way - in case the return crashes the service for whatever reason (usually OOM Kill in kubernetes)
the finally part will not be executed, allowing the request to become idempotent