Is there a way to redirect the user-agent in a Jersey Resource?
In Spring MVC there’s the “redirect:”-syntax but I didn’t find anything comparable in Jersey’s Viewable class. The only method I found working was using HttpServletResponse.sendRedirect().
You have to return a
Responseobject containing your status code andLocation-header. The easiest way is to usejavax.ws.rs.core.Response.temporaryRedirect(URI).When using
Viewableyou might need to throw aWebApplicationExceptioncontaining thatResponseobject.