Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javazoom.download
Class DownloadServlet

    java.lang.Object
      |
      +--javax.servlet.GenericServlet
            |
            +--javax.servlet.http.HttpServlet
                  |
                  +--javazoom.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

Field Summary
`static java.lang.String[]` | `BLACKLIST` Characters blacklist for secured filename :
`static java.lang.String` | `CUSTOMPARAMETER` Parameter name for custom field : Default is custom
`static java.lang.String` | `DOWNLOADBEANNAME` Bean name for JSP : Default is downloadbean
`static java.lang.String` | `FILENAMEPARAMETER` Parameter name for download : Default is name
`static boolean` | `SECUREFILENAME` Enables/Disables filename security : Default is true

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`

Field Detail

### DOWNLOADBEANNAME

    public static java.lang.String DOWNLOADBEANNAME

  Bean name for JSP : Default is downloadbean

### FILENAMEPARAMETER

    public static java.lang.String FILENAMEPARAMETER

  Parameter name for download : Default is name

### CUSTOMPARAMETER

    public static java.lang.String CUSTOMPARAMETER

  Parameter name for custom field : Default is custom

### SECUREFILENAME

    public static boolean SECUREFILENAME

  Enables/Disables filename security : Default is true

### BLACKLIST

    public static java.lang.String[] BLACKLIST

  Characters blacklist for secured filename :

Constructor Detail

### DownloadServlet

    public DownloadServlet()

Method Detail

### init

    public void init()
              throws javax.servlet.ServletException

  Initializes DownloadServlet.
  Instanciates DownloadBean with scope application.
  Instanciates DownloadImpl.

  Overrides:
    `init` in class `javax.servlet.GenericServlet`
  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.

  Overrides:
    `doGet` in class `javax.servlet.http.HttpServlet`
  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.

  Overrides:
    `doPost` in class `javax.servlet.http.HttpServlet`
  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.

  Specified by:
    `destroy` in interface `javax.servlet.Servlet`
  Overrides:
    `destroy` in class `javax.servlet.GenericServlet`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD