public void redirect(Environment environment, final String url) throws Exception {
ContinuationManagerContext continuationHandler =
(ContinuationManagerContext) environment.getEntry(ContinuationManagerContext.class);
// setting the continuation
continuationHandler.runContinuationOnce(new BaseService() {
protected void action(Path path, InputData input, OutputData output) throws Exception {
((ServletOutputData)output).getResponse().sendRedirect(url);
}
});
}