|
I have a number of RESTful controllers that return xml content. Ideally I’d like to gzip the xml results. What is the easiest way to achieve this in Grails. The zipped resources plugin does a nice job of gzipping static resources but my
problem is that the xml is dynamic. I’d like something like this to work: http://myapp.com/api/some/resource.xml.gz Thanks Jon This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system. |
|
On 2 May 2012, at 18:56, Jon Palmer wrote: > I have a number of RESTful controllers that return xml content. Ideally I’d like to gzip the xml results. What is the easiest way to achieve this in Grails. The zipped resources plugin does a nice job of gzipping static resources but my problem is that the xml is dynamic. I’d like something like this to work: > > http://myapp.com/api/some/resource.xml.gz > Hi Jon, Just look at the source for the zipped-resources mapper and rip it off for a normal controller/filter. It should be easy there's almost no code in the zip mapper: https://github.com/Grailsrocks/grails-zipped-resources/blob/master/grails-app/resourceMappers/org/grails/plugin/zippedresources/ZipResourceMapper.groovy Note that the mapper does not set the extension to .gz as apparently that causes problems with some IE versions of the past. You could/should do the same I think, and just set the right response header for Content-Encoding. Marc ~ ~ ~ Marc Palmer Freelancer (Grails/Groovy/Java/UX) I offer commercial support for Grails plugins from as low as $50/mo. For details see: http://grailsrocks.com Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc Contributor @ http://grails.org | Founder @ http://noticelocal.com Developer @ http://weceem.org | Member @ http://spottymushroom.com Twitter: http://twitter.com/wangjammer5 --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by jonspalmer
Is .zip OK?
http://grails.org/plugin/grails-ant
Note that I don't think that works with Grails 2.x. It's on my todo to update. --------------------------- www.maf.org/rhoads www.ontherhoads.org On Wed, May 2, 2012 at 11:56 AM, Jon Palmer <[hidden email]> wrote:
|
|
I'd recommend putting this in the apache instance you use to front your grails instance.
Nathan Wells On Wed, May 2, 2012 at 12:22 PM, Brad Rhoads <[hidden email]> wrote: Is .zip OK? |
|
On Wed, May 2, 2012 at 5:05 PM, Nathan Wells <[hidden email]> wrote:
I'd recommend putting this in the apache instance you use to front your grails instance. Or just put a servlet filter around your application. There must be dozens of blog posts out there that describe how to install a gzipping servlet filter into a webapp.
|
|
In reply to this post by Nathan Wells
Yup, I hadn’t realized how simple it is to have Apache take care of that. For static content its nicely efficient for the resources plugin to do the gzipping
once, for dynamic content Apache is a great way to do it. Thanks From: Nathan Wells [mailto:[hidden email]]
I'd recommend putting this in the apache instance you use to front your grails instance.
On Wed, May 2, 2012 at 12:22 PM, Brad Rhoads <[hidden email]> wrote: Is .zip OK? http://grails.org/plugin/grails-ant Note that I don't think that works with Grails 2.x. It's on my todo to update.
On Wed, May 2, 2012 at 11:56 AM, Jon Palmer <[hidden email]> wrote: I have a number of RESTful controllers that return xml content. Ideally I’d like to gzip the xml results. What is the easiest way to achieve this in Grails. The zipped resources
plugin does a nice job of gzipping static resources but my problem is that the xml is dynamic. I’d like something like this to work: http://myapp.com/api/some/resource.xml.gz Thanks Jon This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure
by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system. |
| Powered by Nabble | Edit this page |
