-
1. Re: Undertow configuration: caching of JS, CSS, and images
ctomc Jan 19, 2015 10:19 AM (in response to juergen.zimmermann)I would go with adding cache filter that would than be enabled by predicate that matches css, js & other relevant resources.
Only problem is that currently you cannot do this easily with configuring subsystem as cache handler needs to get DirectCache passed in as constructor parameter.
Only thing I can think of now is that you add ServletExtension http://undertow.io/documentation/servlet/servlet-extensions.html
and create cache handler something along the lines:
final CacheHandler cacheHandler = new CacheHandler(new DirectBufferCache(100, 10, 1000));
where you should adjust the sizes of the cache according to your needs.
than add that cache handler to outerDeploymentChain
-
2. Re: Undertow configuration: caching of JS, CSS, and images
ctomc Jan 19, 2015 10:24 AM (in response to ctomc)Forgot to add the "when file is css, js & like" part.
HttpHandler handler = Handlers.predicate(Predicates.suffixes("css","js","jpg"),cacheHandler,next);
this will make sure cache handler only gets called for suffixes defined in predicate.