我有一个Jersey应用程序,我正在尝试重定向到一个html页面,当我访问" / apiconsole"时会显示api控制台。端点如下所示。
/**
* Redirect to API Console
*
* @return API Console
*/
@GET
@Path("/apiconsole")
public Response redirectToApiConsole() {
//redirect path from baseURI to the api console
URI redirectedURL = UriBuilder.fromPath("/api/console/index.html").build();
return Response.seeOther(redirectedURL).build();
}
这与在Spring中执行此操作相同吗?
/**
* Redirect to API Console
*
* @return API Console
*/
@RequestMapping(value = "/apiconsole", method = RequestMethod.GET)
public View redirectToApiConsole() {
return new RedirectView("/api/console/index.html?raml=/api/console/api.raml");
}