Hello, Thank you for your reply.
I'm packaging upstream software (css-validator) for Debian so your suggestions won't really fit to ship a package working out of the box. So I created a request on bugzilla. https://bz.apache.org/bugzilla/show_bug.cgi?id=69735 Regards Fab Le mardi 8 juillet 2025, 21:21:53 CEST Christopher Schultz a écrit : > Fab, > > On 7/6/25 6:58 AM, Fab Stz wrote: > > Does tomcat support content negotiation like apache httpd does [1] > > for the Accept-Language header? > > No. > > > How to configure this for a webapp context? > > You'll have to build this capability into your own web application. > > > Use case is *serving static pages* with "href=my_page.html" and where > > files in the webapp folder are actually> - my_page.html.en > > - my_page.html.de > > - my_page.html.fr > > - my_page.html.it > > - ... > > > > At the moment, when trying to load my_page.html it shows 404 error. > > Do you have a file called my_page.html without any language specifier? > Tomcat is looking for a directory entry with the exact name "my_page.html". > > > From what I understand it would be possible with > > org.apache.tomcat.util.http.parser.AcceptLanguage, but only is > > served inside a servlet. AFAIU this is not usable for static pages.> > > [1] https://httpd.apache.org/docs/current/content-negotiation.html > > You will have to implement this yourself in a deployed application, > since Tomcat does not support it directly. You have access to the > Accept-Language header but you will have to parse the header value and > compare it to the list of languages "supported" by the set of on-disk files. > > I wouldn't recommend using Tomcat's AcceptLanguage class, since it's not > really part of the public API and wouldn't be portable to other > containers. Instead, implement your own content-negotiation, since it's > not very complicated. > > On the other hand, you could advocate for content-negotiation > capabilities similar to mod_negotiation to be built into Tomcat. > > My advice would be to use a content-negotiating web server like httpd as > a proxy to Tomcat, but the addition of another component into your > environment might be more complicated than just implementing > content-negotiation in the application. > > -chris > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org