[xwiki-devs] How to end/finish respose programmatically?
Due to performance reasons I had to improve Groovy script to print results directly to the response object: {{groovy}} response.setContentType('application/xml'); response.setCharacterEncoding("UTF-8"); def out=response.getWriter(); try { ... out.println('<?xml version="1.0" encoding="UTF-8"?>'); out.println('<certificates>'); ... But now problem is that after that I got additional XWiki HTML even using ?outputSyntax=plain parameter. I suspect, I need to end/close response somehow programmatically. Any hints? Thanks in advance
Hi, Try adding "&xpage=plain" to the requested URL. Thanks, Eduard On Tue, Jan 7, 2014 at 9:18 PM, Valdis Vītoliņš <[email protected]>wrote:
Due to performance reasons I had to improve Groovy script to print results directly to the response object: {{groovy}} response.setContentType('application/xml'); response.setCharacterEncoding("UTF-8"); def out=response.getWriter(); try { ... out.println('<?xml version="1.0" encoding="UTF-8"?>'); out.println('<certificates>'); ... But now problem is that after that I got additional XWiki HTML even using ?outputSyntax=plain parameter.
I suspect, I need to end/close response somehow programmatically.
Any hints? Thanks in advance
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On 01/07/2014 02:18 PM, Valdis Vītoliņš wrote:
Due to performance reasons I had to improve Groovy script to print results directly to the response object: {{groovy}} response.setContentType('application/xml'); response.setCharacterEncoding("UTF-8"); def out=response.getWriter(); try { ... out.println('<?xml version="1.0" encoding="UTF-8"?>'); out.println('<certificates>'); ... But now problem is that after that I got additional XWiki HTML even using ?outputSyntax=plain parameter.
I suspect, I need to end/close response somehow programmatically.
Any hints?
out.close() xcontext.setFinished(true) -- Sergiu Dumitriu http://purl.org/net/sergiu
Thanks, Sergiu! Now it provides pure XML even without ?xpage=plain/?outputSyntax=plain parameters. Valdis
On 01/07/2014 02:18 PM, Valdis Vītoliņš wrote:
Due to performance reasons I had to improve Groovy script to print results directly to the response object: {{groovy}} response.setContentType('application/xml'); response.setCharacterEncoding("UTF-8"); def out=response.getWriter(); try { ... out.println('<?xml version="1.0" encoding="UTF-8"?>'); out.println('<certificates>'); ... But now problem is that after that I got additional XWiki HTML even using ?outputSyntax=plain parameter.
I suspect, I need to end/close response somehow programmatically.
Any hints?
out.close() xcontext.setFinished(true)
participants (3)
-
Eduard Moraru -
Sergiu Dumitriu -
Valdis Vītoliņš