泽西(JSR311-实施)和重定向
有没有办法在Jersey资源中重定向用户代理?
在Spring MVC中有“redirect:” – 语法,但我在Jersey的Viewable
类中找不到任何可比性。 我发现工作的唯一方法是使用HttpServletResponse.sendRedirect()
。
您必须返回包含您的状态代码和Location
-header的Response
对象。 最简单的方法是使用javax.ws.rs.core.Response.temporaryRedirect(URI)
。
使用Viewable
您可能需要抛出包含该Response
对象的WebApplicationException
。