net.sourceforge.stripes.controller.multipart
Class DefaultMultipartWrapperFactory

java.lang.Object
  extended by net.sourceforge.stripes.controller.multipart.DefaultMultipartWrapperFactory
All Implemented Interfaces:
ConfigurableComponent, MultipartWrapperFactory

public class DefaultMultipartWrapperFactory
extends Object
implements MultipartWrapperFactory

Default implementation of a factory for MultipartWrappers. Looks up a class name in Configuration under the key specified by WRAPPER_CLASS_NAME. If no class name is configured, defaults to the CosMultipartWrapper. An additional configuration parameter is supported to specify the maximum post size allowable.

Since:
Stripes 1.4
Author:
Tim Fennell

Field Summary
static String[] BUNDLED_IMPLEMENTATIONS
          The names of the MultipartWrapper classes that will be tried if no other is specified.
static String MAX_POST
          Key used to lookup the name of the maximum post size.
static String WRAPPER_CLASS_NAME
          The configuration key used to lookup the implementation of MultipartWrapper.
 
Constructor Summary
DefaultMultipartWrapperFactory()
           
 
Method Summary
 void init(Configuration config)
          Invoked directly after instantiation to allow the configured component to perform one time initialization.
 MultipartWrapper wrap(HttpServletRequest request)
          Wraps the request in an appropriate implementation of MultipartWrapper that is capable of providing access to request parameters and any file parts contained within the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WRAPPER_CLASS_NAME

public static final String WRAPPER_CLASS_NAME
The configuration key used to lookup the implementation of MultipartWrapper.

See Also:
Constant Field Values

BUNDLED_IMPLEMENTATIONS

public static final String[] BUNDLED_IMPLEMENTATIONS
The names of the MultipartWrapper classes that will be tried if no other is specified.


MAX_POST

public static final String MAX_POST
Key used to lookup the name of the maximum post size.

See Also:
Constant Field Values
Constructor Detail

DefaultMultipartWrapperFactory

public DefaultMultipartWrapperFactory()
Method Detail

init

public void init(Configuration config)
          throws Exception
Invoked directly after instantiation to allow the configured component to perform one time initialization. Components are expected to fail loudly if they are not going to be in a valid state after initialization.

Specified by:
init in interface ConfigurableComponent
Parameters:
config - the Configuration object being used by Stripes
Throws:
Exception - should be thrown if the component cannot be configured well enough to use.

wrap

public MultipartWrapper wrap(HttpServletRequest request)
                      throws IOException,
                             FileUploadLimitExceededException
Wraps the request in an appropriate implementation of MultipartWrapper that is capable of providing access to request parameters and any file parts contained within the request.

Specified by:
wrap in interface MultipartWrapperFactory
Parameters:
request - an active HttpServletRequest
Returns:
an implementation of the appropriate wrapper
Throws:
IOException - if encountered when consuming the contents of the request
FileUploadLimitExceededException - if the post size of the request exceeds any configured limits


? Copyright 2005-2006, Stripes Development Team.