开发者

JSF: How to capture response that is send to client

I want to implement some kind of help-functionality within my jsf-application

Scenario:

When the users of my app are having problems, they send me screenshots. These are of poor quality and I cannot see the information I want.

My idea: I add a "help"-Button into my jsf-Page. When this button is pressed I store the render-response (resulting html) that is send to client on my hd.

Now I can open that generated html-file and can see the information I want (e.g. values of inputfield)

Now my Question.

How can I perform this task?

I have tried PhaseListener and using

PrintWriter w = new PrintWriter(System.out); DebugUtil.simplePrintTree(FacesContext.getCurrentInstance().getViewRoot(),"",w);

but this is just the component tree and not the resulting html

In other words: I want to capture the output of FacesContext.getExternalContext().getResponse() that开发者_JS百科 is send to client

any ideas?


Use a Filter around the FacesServlet. There define a HttpServletResponseWrapper and in turn make its getOutputStream() and getWriter() return wrappers of the original objects. In the wrappers, in addition to delegating to the original implementation, store the written data somewhere else.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜