This discussion is archived
2 Replies Latest reply: Apr 14, 2012 9:44 PM by DrClap RSS

[Servlet/filters] Filter makes a folder private!

Squall867 Newbie
Currently Being Moderated
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 {
          
        ((HttpServletResponse)response).sendRedirect("/appName/index.jsp");
        
        
    }
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?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points