org.apache.turbine.services.upload
Class TurbineUpload

java.lang.Object
  |
  +--org.apache.turbine.services.upload.TurbineUpload

public abstract class TurbineUpload
extends java.lang.Object

This is a facade class for UploadService.

This class provides static methods that retrieve the configured (in TurbineResource.properties) implementation of UploadService and perform certain operations on it. It uses constants defined in UploadService interface for accessing the service's properties and default values for them.

Version:
$Id$
Author:
Rafal Krzewski

Constructor Summary
TurbineUpload()
           
 
Method Summary
static boolean getAutomatic()
           Retrieves the value of 'automatic' property of UploadService.
static java.lang.String getRepository()
           Retrieves the value of the repository property of UploadService.
static UploadService getService()
           Retrieves an instance of system's configured implementation of UploadService
static int getSizeMax()
           Retrieves the value of 'size.max' property of UploadService.
static int getSizeThreshold()
           Retrieves the value of size.threshold property of UploadService.
static void parseRequest(javax.servlet.http.HttpServletRequest req, ParameterParser params)
           Performs parsing the request and storing files and form fields.
static void parseRequest(javax.servlet.http.HttpServletRequest req, ParameterParser params, java.lang.String path)
           Performs parsing the request and storing files and form fields.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

TurbineUpload

public TurbineUpload()
Method Detail

getService

public static UploadService getService()

Retrieves an instance of system's configured implementation of UploadService

Returns:
An instance of UploadService

getAutomatic

public static boolean getAutomatic()

Retrieves the value of 'automatic' property of UploadService.

Returns:
The value of 'automatic' property of UploadService.

getSizeMax

public static int getSizeMax()

Retrieves the value of 'size.max' property of UploadService.

Returns:
The value of 'size.max' property of UploadService.

getSizeThreshold

public static int getSizeThreshold()

Retrieves the value of size.threshold property of UploadService.

Returns:
The threshold beyond which files are written directly to disk.

getRepository

public static java.lang.String getRepository()

Retrieves the value of the repository property of UploadService.

Returns:
The repository.

parseRequest

public static void parseRequest(javax.servlet.http.HttpServletRequest req,
                                ParameterParser params)
                         throws TurbineException

Performs parsing the request and storing files and form fields. Default file repository is used. This method is called by the ParameterParser if automatic upload is enabled.

Parameters:
req - The servlet request to be parsed.
params - The ParameterParser instance to insert form fields into.
Throws:
TurbineException - If there are problems reading/parsing the request or storing files.

parseRequest

public static void parseRequest(javax.servlet.http.HttpServletRequest req,
                                ParameterParser params,
                                java.lang.String path)
                         throws TurbineException

Performs parsing the request and storing files and form fields. Custom file repository may be specified. You can call this method in your file upload Action to if you need to specify a custom directory for storing files.

Parameters:
req - The servlet request to be parsed.
params - The ParameterParser instance to insert form fields into.
path - The location where the files should be stored.
Throws:
TurbineException - If there are problems reading/parsing the request or storing files.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.