まあ、私はJAX-から前方への道を見つけましたRSメソッドからJSFページへ:
@GET
@Path("/test")
@Produces("text/html")
public Response test(@Context ServletContext context,
@Context HttpServletRequest request,
@Context HttpServletResponse response) {
try {
String myJsfPage = "/response.xhtml";
context.getRequestDispatcher(myJsfPage).forward(request, response);
} catch (ServletException | IOException ex) {
return Response.status(NOT_FOUND).build();
}
return null;
}
ここで説明したように:メソッドを経由してhttps://www.java.net//forum/topic/glassfish/glassfish/forwarding-jsf-jax-rs
注入はフィールドに注射を介してもを行うことができ、それは「好み」の問題である
このTomEE(ApacheのCXF)でテストされています。私はこれが単なる汚れた "ハック"か、それを行うためのより良い方法があるなら、ちょっと好奇心旺盛です。
UPDATE
私は何の問題もなくJSFタグをレンダリングすることに良い方法はをリダイレクトした(私の場合には、そのような<p:graphicImage/>
などのタグが正しくレンダリングされませんでした)
@GET
@Path("/test")
@Produces("text/html")
public Response test(@Context HttpServletRequest request, @Context HttpServletResponse response)
throws IOException {
String myJsfPage = "/response.xhtml";
String contextPath = request.getContextPath();
response.sendRedirect(contextPath + myJsfPage);
return Response.status(Status.ACCEPTED).build();
}
リダイレクトのためにこれを行う: '' page1?faces-redirect = true '' –
この[リンク]を実行する(http://www.mkyong.com/jsf2/jsf-page-forward-vs-page-redirect /) –
これはちょうどjsfリダイレクトです。jax-rsメソッドの中には、返されたStringが表示されます。 – Sergio