dropwizard-configurable-assets-bundle icon indicating copy to clipboard operation
dropwizard-configurable-assets-bundle copied to clipboard

supporting static gzipped assets?

Open victornoel opened this issue 8 years ago • 5 comments

Hi,

One really great option of the DefaultServlet from Jetty is the possibility to let it serve .gz files if they exists as an asset. Is it supported by this project's AssetServlet or is it something that could be added to it? I think this is one interesting feature! :)

victornoel avatar Nov 24 '16 13:11 victornoel

There is actually an effort started at dropwizard/dropwizard#1839 to rewrite AssetServlet on top of DefaultServlet: if you have some ideas on how to make it compatible with your needs (or even maybe include them?), then we could see how it could be reusable for you!

victornoel avatar Nov 27 '16 15:11 victornoel

Thanks for poking around and coming up with the idea. I'm very interested in delegating the majority of logic to DefaultServlet. I've started with this and was able to get 17/28 tests to pass without configuring the servlet. A little more work there and it should be good to go.

The only feature it doesn't look like we'll be able to support is changing the default charset. That's something we could try to back-port to jetty if someone needed/wanted.

nbauernfeind avatar Nov 30 '16 06:11 nbauernfeind

@nbauernfeind I was thinking, would you consider contributing it directly to dropwizard? Maybe in a way that could be then extended for your needs? Or once you've worked on yours, I could try to extract what could go into dropwizard and then you could just rely on it for your bundle? :)

victornoel avatar Dec 03 '16 11:12 victornoel

Unfortunately it would be more painful to write in a way that is both easily configurable (our project) and via dropwizard which is barely configurable.

I've completely most of the work. However, I'm concerned about a handful of tests that I don't think DefaultServlet is going to work out of the box for.

  • multiple-byte-ranges test fails
  • if-range test fails.
  • It does not default content types (this is probably OK, but deviates from original AssetServlet impl in dropwizard).
  • does not guess mime types
  • does not support changing the default charset
  • generates weak etags (might not be an issue... but we were supporting strong etags)

It seems that it might be best to just add gzip support into our implementation rather than re-using the DefaultServer. I'll need to sleep on it.

Feel free to see what kind of impl I was trying to get to work: https://github.com/nbauernfeind/dropwizard-configurable-assets-bundle/tree/DefaultServlet

nbauernfeind avatar Dec 06 '16 06:12 nbauernfeind

@nbauernfeind Did you have any new ideas? Brotli support: content encoding br would be pretty sweet too.

karolmie1 avatar Jun 08 '17 10:06 karolmie1