Quantcast
Channel: Servlet for serving static content - Stack Overflow
Browsing all 15 articles
Browse latest View live

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 Article



Answer 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 Article

Answer by Fareed Alnamrouti for Servlet for serving static content

try this...

View Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article


Answer by Coldbeans Software for Servlet for serving static content

See StaticFile in JSOS: http://www.servletsuite.com/servlets/staticfile.htm

View Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Servlet 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

Browsing all 15 articles
Browse latest View live




Latest Images