在我们之前的项目中,我们使用了Viewable(当时我们将 Jersey 作为 JAX-RS 的实现)。现在我们想在 WebSphere 8.5 中运行它。它是 JEE6 服务器,默认情况下 JAX-RS 不支持 Viewable。由于在那里使用了 JAX-RS Apache Wink 的实现。
将答案作为带有内部对象的 HTML 的最佳方式是什么?我们想使用渲染引擎。
谢谢,罗伯特
在我们之前的项目中,我们使用了Viewable(当时我们将 Jersey 作为 JAX-RS 的实现)。现在我们想在 WebSphere 8.5 中运行它。它是 JEE6 服务器,默认情况下 JAX-RS 不支持 Viewable。由于在那里使用了 JAX-RS Apache Wink 的实现。
将答案作为带有内部对象的 HTML 的最佳方式是什么?我们想使用渲染引擎。
谢谢,罗伯特
如果您需要显示简单的 jsp 页面,您可以像这样注入请求并执行正常转发:
@Path("/service")
public class RestService {
@Context
HttpServletRequest request;
@Context
HttpServletResponse response;
@GET
@Path("/getPage")
public void getPage() {
try {
request.getRequestDispatcher("/mypage.jsp").forward(request, response);
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}