How to get content from response in grails 2.4.4

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to get content from response in grails 2.4.4

shovonis
Recently we were upgrading our application from grails version 2.2.4 to 2.4.4. But we got stuck in one specific problem related to sitemesh filter which was removed from web.xml from grails version 2.4.4.

The problem is, in our code base(grails version 2.2.4) the response object was being initialized at runtime by org.codehaus.groovy.grails.web.sitemesh.GrailsContentBufferingResponse(http://grails.org/doc/2.4.x/api/org/codehaus/groovy/grails/web/sitemesh/GrailsContentBufferingResponse.html) and we used response.response.contents to get the html contents of the rendered gsp page and then used it for pdf rendering in the application filter of our application.

pdfRenderer(uri: '/pdf/**') {
            afterView = {
                byte[] pdf = PdfUtils.makePdf(response.response.contents, params.title, params.avoidDefaultHeader ?: false, session.user, servletContext)

As from grails version 2.4.4 sitemesh filter has replaced with GrailsLayoutView the response object is now initialized with weblogic httpServletResponse which have no method to get the content.Now we must configure the application to use GrailsContentBufferingResponse at runtime so that the response object get initialized with it.

This is why our application has been broke down, in case of all pdf rendering.

Can anyone please tell me how to configure GrailsLayoutView so that the response object get initialized with GrailsContentBufferingResponse object at runtime. Or is there any other way to use the sitemesh filter so that the application use GrailsContentBufferingResponse object at runtime.

I have also created a jira issue at https://jira.grails.org/browse/GRAILS-11896 and a stack overflos post at : http://stackoverflow.com/questions/27802876/how-to-get-content-from-response-in-grails-2-4-4