org.apache.turbine.services.upload
Interface UploadService

All Superinterfaces:
Initable, Service
All Known Implementing Classes:
BaseUploadService, TurbineUploadService

public interface UploadService
extends Service

This service handles parsing multipart/form-data POST requests and turing them into form fields and uploaded files. This can be either performed automatically by the ParameterParser or manually by an user definded Action.

Version:
$Id: UploadService.java 534527 2007-05-02 16:10:59Z tv $
Author:
Rafal Krzewski, Daniel Rall

Field Summary
static boolean AUTOMATIC_DEFAULT
           The default value of 'automatic' property (false).
static java.lang.String AUTOMATIC_KEY
          The key in UploadService properties in TurbineResources.properties 'automatic' property.
static java.lang.String CONTENT_DISPOSITION
          HTTP header.
static java.lang.String CONTENT_TYPE
          HTTP header.
static java.lang.String FORM_DATA
          HTTP header base type modifier.
static java.lang.String MIXED
          HTTP header base type modifier.
static java.lang.String MULTIPART
          HTTP header base type.
static java.lang.String MULTIPART_FORM_DATA
          HTTP header.
static java.lang.String MULTIPART_MIXED
          HTTP header.
static java.lang.String REPOSITORY_DEFAULT
           The default value of 'repository' property (.).
static java.lang.String REPOSITORY_KEY
          The key in UploadService properties in TurbineResources.properties 'repository' property.
static java.lang.String REPOSITORY_PARAMETER
          The request parameter name for overriding 'repository' property (path).
static java.lang.String SERVICE_NAME
          The key in the TurbineResources.properties that references this service.
static long SIZE_MAX_DEFAULT
           The default value of 'size.max' property (1 megabyte = 1048576 bytes).
static java.lang.String SIZE_MAX_KEY
          The key in UploadService properties in TurbineResources.properties 'size.max' property.
static int SIZE_THRESHOLD_DEFAULT
           The default value of 'size.threshold' property (10 kilobytes = 10240 bytes).
static java.lang.String SIZE_THRESHOLD_KEY
          The key in UploadService properties in TurbineResources.properties 'size.threshold' property.
 
Method Summary
 boolean getAutomatic()
           Retrieves the value of 'automatic' property of UploadService.
 java.lang.String getRepository()
           Retrieves the value of the repository property of UploadService.
 long getSizeMax()
           Retrieves the value of size.max property of the UploadService.
 int getSizeThreshold()
           Retrieves the value of size.threshold property of UploadService.
 void parseRequest(javax.servlet.http.HttpServletRequest req, ParameterParser params, java.lang.String path)
           This method performs parsing the request, and storing the acquired information in apropriate places.
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
 

Field Detail

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
HTTP header.

See Also:
Constant Field Values

CONTENT_DISPOSITION

public static final java.lang.String CONTENT_DISPOSITION
HTTP header.

See Also:
Constant Field Values

MULTIPART

public static final java.lang.String MULTIPART
HTTP header base type.

See Also:
Constant Field Values

FORM_DATA

public static final java.lang.String FORM_DATA
HTTP header base type modifier.

See Also:
Constant Field Values

MIXED

public static final java.lang.String MIXED
HTTP header base type modifier.

See Also:
Constant Field Values

MULTIPART_FORM_DATA

public static final java.lang.String MULTIPART_FORM_DATA
HTTP header.

See Also:
Constant Field Values

MULTIPART_MIXED

public static final java.lang.String MULTIPART_MIXED
HTTP header.

See Also:
Constant Field Values

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
The key in the TurbineResources.properties that references this service.

See Also:
Constant Field Values

AUTOMATIC_KEY

public static final java.lang.String AUTOMATIC_KEY
The key in UploadService properties in TurbineResources.properties 'automatic' property.

See Also:
Constant Field Values

AUTOMATIC_DEFAULT

public static final boolean AUTOMATIC_DEFAULT

The default value of 'automatic' property (false). If set to true, parsing the multipart request will be performed automaticaly by ParameterParser. Otherwise, an Action may decide to to parse the request by calling parseRequest manually.

See Also:
Constant Field Values

REPOSITORY_PARAMETER

public static final java.lang.String REPOSITORY_PARAMETER
The request parameter name for overriding 'repository' property (path).

See Also:
Constant Field Values

REPOSITORY_KEY

public static final java.lang.String REPOSITORY_KEY
The key in UploadService properties in TurbineResources.properties 'repository' property.

See Also:
Constant Field Values

REPOSITORY_DEFAULT

public static final java.lang.String REPOSITORY_DEFAULT

The default value of 'repository' property (.). This is the directory where uploaded fiels will get stored temporarily. Note that "." is whatever the servlet container chooses to be it's 'current directory'.

See Also:
Constant Field Values

SIZE_MAX_KEY

public static final java.lang.String SIZE_MAX_KEY
The key in UploadService properties in TurbineResources.properties 'size.max' property.

See Also:
Constant Field Values

SIZE_MAX_DEFAULT

public static final long SIZE_MAX_DEFAULT

The default value of 'size.max' property (1 megabyte = 1048576 bytes). This is the maximum size of POST request that will be parsed by the uploader. If you need to set specific limits for your users, set this property to the largest limit value, and use an action + no auto upload to enforce limits.

See Also:
Constant Field Values

SIZE_THRESHOLD_KEY

public static final java.lang.String SIZE_THRESHOLD_KEY
The key in UploadService properties in TurbineResources.properties 'size.threshold' property.

See Also:
Constant Field Values

SIZE_THRESHOLD_DEFAULT

public static final int SIZE_THRESHOLD_DEFAULT

The default value of 'size.threshold' property (10 kilobytes = 10240 bytes). This is the maximum size of a POST request that will have it's components stored temporarily in memory, instead of disk.

See Also:
Constant Field Values
Method Detail

parseRequest

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

This method performs parsing the request, and storing the acquired information in apropriate places.

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 - Problems reading/parsing the request or storing the uploaded file(s).

getSizeMax

public long getSizeMax()

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

Returns:
The maximum upload size.

getSizeThreshold

public int getSizeThreshold()

Retrieves the value of size.threshold property of UploadService.

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

getRepository

public java.lang.String getRepository()

Retrieves the value of the repository property of UploadService.

Returns:
The repository.

getAutomatic

public boolean getAutomatic()

Retrieves the value of 'automatic' property of UploadService.

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


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.