javazoom.download
Class DownloadServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byjavazoom.download.DownloadServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class DownloadServlet
extends javax.servlet.http.HttpServlet

This class implements a servlet to download files through DownloadImpl.

See Also:
Serialized Form

Constructor Summary
DownloadServlet()
           
 
Method Summary
 java.lang.String checkFilename(java.lang.String filename)
          Removes UnSafe characters in URL (for instance %2E%2E/ means ../) An Download4J malicious user could try to download files outside the downloadRoot.
 void destroy()
          Clean up resources.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Processes HTTP Get.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Processes HTTP Post.
 void init()
          Initializes DownloadServlet.
 void performDownload(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Processes the download.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadServlet

public DownloadServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initializes DownloadServlet.
Instanciates DownloadBean with scope application.
Instanciates DownloadImpl.

Throws:
javax.servlet.ServletException

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Processes HTTP Get.

Parameters:
request - incoming user's request.
response - user's response
Throws:
javax.servlet.ServletException
java.io.IOException

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Processes HTTP Post.

Parameters:
request - incoming user's request.
response - user's response
Throws:
javax.servlet.ServletException
java.io.IOException

performDownload

public void performDownload(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Processes the download.

Parameters:
request - HttpRequest from browser
response - HttpResponse sent to browser
Throws:
javax.servlet.ServletException
java.io.IOException

checkFilename

public java.lang.String checkFilename(java.lang.String filename)
Removes UnSafe characters in URL (for instance %2E%2E/ means ../) An Download4J malicious user could try to download files outside the downloadRoot.

Parameters:
filename - from URL
Returns:
securedFilename

destroy

public void destroy()
Clean up resources.