Skip to Main Content

[Servlet/filters] Filter makes a folder private!

Squall867Apr 14 2012 — edited Apr 15 2012
Hi, I'm making a web application for video sharing.
I got a folder, named "videos", in which I put videos, than a jsp with a jwplayer script does the magic streaming a video in a youtube-like manner.

I don't want someone can directly access to "videos" folder, going to an address like http://myapp/videos/video.flv, but "videos" folder has to be public in order for jwplayer to work so I made a filter which basically redirects all videos/* requests to my .jsp page.
Filter is really quite simple, here's doFilter() method:
public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain)
            throws ServletException, IOException {
Problem is that, using this filter, an error message shows on video in jwplayer window:
video not found or access denied to /videos/video.flv
while, without filter, everything goes fine.

So, what's the problem?
Post Details
Added on Apr 14 2012