Answer by Grigory Kislin for Servlet for serving static content
Checked for Tomcat 8.x: static resources work OK if root servlet map to "".For servlet 3.x it could be done by @WebServlet("")
View ArticleAnswer by BalusC for Servlet for serving static content
Abstract template for a static resource servletPartly based on this blog from 2007, here's a modernized and highly reusable abstract template for a servlet which properly deals with caching, ETag,...
View ArticleAnswer by Jeff Stice-Hall for Servlet for serving static content
Judging from the example information above, I think this entire article is based on a bugged behavior in Tomcat 6.0.29 and earlier. See https://issues.apache.org/bugzilla/show_bug.cgi?id=50026. Upgrade...
View ArticleAnswer by Taylor Gautier for Servlet for serving static content
I came up with a slightly different solution. It's a bit hack-ish, but here is the mapping:<servlet-mapping>...
View ArticleAnswer by clish for Servlet for serving static content
To serve all requests from a Spring app as well as /favicon.ico and the JSP files from /WEB-INF/jsp/* that Spring's AbstractUrlBasedView will request you can just remap the jsp servlet and default...
View ArticleAnswer by Will Hartung for Servlet for serving static content
I've had good results with FileServlet, as it supports pretty much all of HTTP (etags, chunking, etc.).
View ArticleAnswer by delux247 for Servlet for serving static content
I did this by extending the tomcat DefaultServlet (src) and overriding the getRelativePath() method.package com.example;import javax.servlet.ServletConfig;import javax.servlet.ServletException;import...
View ArticleAnswer by user164757 for Servlet for serving static content
I found great tutorial on the web about some workaround. It is simple and efficient, I used it in several projects with REST urls styles...
View ArticleAnswer by Coldbeans Software for Servlet for serving static content
See StaticFile in JSOS: http://www.servletsuite.com/servlets/staticfile.htm
View ArticleAnswer by axtavt for Servlet for serving static content
There is no need for completely custom implementation of the default servlet in this case, you can use this simple servlet to wrap request to the container's implementation:package com.example;import...
View ArticleAnswer by yogman for Servlet for serving static content
Use org.mortbay.jetty.handler.ContextHandler. You don't need additional components like StaticServlet.At the jetty home,$ cd contexts$ cp javadoc.xml static.xml$ vi static.xml...<Configure...
View ArticleAnswer by Bruno De Fraine for Servlet for serving static content
I ended up rolling my own StaticServlet. It supports If-Modified-Since, gzip encoding and it should be able to serve static files from war-files as well. It is not very difficult code, but it is not...
View ArticleAnswer by Panagiotis Korros for Servlet for serving static content
I had the same problem and I solved it by using the code of the 'default servlet' from the Tomcat...
View ArticleServlet for serving static content
I deploy a webapp on two different containers (Tomcat and Jetty), but their default servlets for serving the static content have a different way of handling the URL structure I want to use (details).I...
View Article
More Pages to Explore .....