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 DownloadImpl

    java.lang.Object
      javazoom.download.DownloadImpl

public class DownloadImpl
extends java.lang.Object

This class is the core of Download4J.
It instanciates the Debug object for traces.
It instanciates the Config object matching to XML configuration file.
It reads mime-types from XML file.
It checks data availability
It checks for WWW authentication
It checks for download hits limit
It sets the returning Content-Type
It runs the download in the incoming thread
It counts download hits
It runs as a singleton

Constructor Summary
`DownloadImpl(java.lang.String configpath, java.lang.String xmlconfig)` Constructs and initializes Download4J.

Method Summary
`int` | `checkAuth(java.lang.String base64auth, FileInfo fi)` Checks WWW authentication for FileInfo.
`int` | `checkAuth(java.lang.String base64auth, java.lang.String login, java.lang.String password)` Checks WWW authentication for input login/password.
`void` | `download(FileInfo fi, java.io.OutputStream out, Config conf)` Downloads file (in the incoming thread) and sends binary data to user's outputstream.
`int` | `getDataLength(FileInfo fi, Config conf)` Checks if data available are for download.
`void` | `process(java.lang.String filename, java.util.Properties HttpProps, javax.servlet.http.HttpServletResponse response)` Runs download in the incoming thread.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DownloadImpl

    public DownloadImpl(java.lang.String configpath,
                        java.lang.String xmlconfig)
                 throws org.xml.sax.SAXException,
                        javax.xml.parsers.ParserConfigurationException,
                        java.io.IOException

  Constructs and initializes Download4J.

Parameters:
  `configpath` - to xmlconfig file
  `xmlconfig` - file to read and parse
Throws:
  `org.xml.sax.SAXException`
  `javax.xml.parsers.ParserConfigurationException`
  `java.io.IOException`

Method Detail

### process

    public void process(java.lang.String filename,
                        java.util.Properties HttpProps,
                        javax.servlet.http.HttpServletResponse response)
                 throws java.io.IOException

  Runs download in the incoming thread.

  Parameters:
    `filename` - to download
    `HttpProps` - Http Properties as login/password, IP address
    `response` - for each end-user
  Throws:
    `java.io.IOException`

### checkAuth

    public int checkAuth(java.lang.String base64auth,
                         FileInfo fi)

  Checks WWW authentication for FileInfo.

  Parameters:
    `base64auth` - base64 encoded login:password
    `fi` - FileInfo
  Returns:
    0=OK, 1=NOT OK, -1=Not authentication needed.

### checkAuth

    public int checkAuth(java.lang.String base64auth,
                         java.lang.String login,
                         java.lang.String password)

  Checks WWW authentication for input login/password.

  Parameters:
    `base64auth` - WWW authentication
    `login` - to check
    `password` - to check
  Returns:
    0=OK, 1=NOT OK, -1=Not authentication needed.

### getDataLength

    public int getDataLength(FileInfo fi,
                             Config conf)

  Checks if data available are for download.

  Parameters:
    `fi` - FileInfo
  Returns:
    file's length or -1 if file is not found or not readable.

### download

    public void download(FileInfo fi,
                         java.io.OutputStream out,
                         Config conf)
                  throws java.io.IOException

  Downloads file (in the incoming thread) and sends binary data to user's outputstream.

  Parameters:
    `fi` - Input FileInfo
    `out` - user's outputstream
  Throws:
    `java.io.IOException`

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