If you have been using Stephan Wissel’s “Web Agents, XPages Style” technique for outputting non-HTML content from your XPages, you may run into a problem when you upgrade your server to 8.5.2.
In the original afterRenderResponse sample code, you would use something like…
try{
var exCon = facesContext.getExternalContext();
var writer = facesContext.getResponseWriter();
var response = exCon.getResponse();
response.setContentType("text/plain");
writer.write("Hello World");
writer.close();
}catch(e){
_dump(e);
}
What you may find is running that code on your lovely new 8.5.2 server will result in an Error 500 with no detail of the error itself. To fix the problem, simple remove the
writer.close();
line from the source code and you should be good to go.
The code I gratefully stole out of the LS2010 AD111 session (Tim and Stephan's session on this topic) ends with:
facesContext.responseComplete();
Any problems with that line in 8.5.2?
@John, You're right, Stephan's codesample does use the responseComplete() argument. From my testing this is still an issue though.
Matt
So we should get rid of facesContext.responseComplete(); in 8.5.2?
Do you have any idea if leaving that line out in 8.5.1 will cause memory leaks?
John,
I've not done any significant testing yet but I suspect we should leave the responseComplete line in.
With regards any potential memory leaks, again I've not looked in detail but I suspect it will be OK.
Matt
Thanks Matt. 🙂