tags:

views:

25

answers:

1

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().

Thanks!

+1  A: 

You have to return a Response object containing your status code and Location-header. The easiest way is to use javax.ws.rs.core.Response.temporaryRedirect(URI).

When using Viewable you might need to throw a WebApplicationException containing that Response object.

Moritz