Package org.apache.fulcrum.parser
Interface ParserService
-
- All Known Implementing Classes:
DefaultParserService
public interface ParserService
ParserService defines the methods which are needed by the parser objects to get their necessities.- Version:
- $Id: ValueParser.java 535465 2007-05-05 06:58:06Z tv $
- Author:
- Thomas Vandahl
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
AUTOMATIC_DEFAULT
The default value of 'automaticUpload' property (false
).static String
AUTOMATIC_KEY
Parse file upload items automaticallystatic int
DEFAULT_MAX_IDLE
The default value of 'maxIdle' property in 'pool' (2
).static int
DEFAULT_POOL_CAPACITY
The default value of 'maxTotal' property in 'pool' (1024
).static boolean
FULCRUM_POOL_DEFAULT
fulcrum pool by default falsestatic String
FULCRUM_POOL_KEY
fulcrum pool activation parameterstatic String
PARAMETER_ENCODING_DEFAULT
Default Encoding for Parameter Parserstatic String
PARAMETER_ENCODING_KEY
Key for the Parameter Parser Encodingstatic String
POOL_KEY
commons pool2 parametersstatic String
ROLE
Avalon Identifierstatic String
URL_CASE_FOLDING_KEY
Property for setting the URL folding value
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
convert(String value)
Trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING.String
convertAndTrim(String value)
Convert a String value according to the url-case-folding property.String
convertAndTrim(String value, ValueParser.URLCaseFolding fold)
A convert method, which trims the string data and applies the conversion specified in the parameter given.boolean
getAutomaticUpload()
Gets the automaticUpload value from the configurationString
getParameterEncoding()
Get the parameter encoding that has been configured as default for the ParserService.<P extends ValueParser>
PgetParser(Class<P> ppClass)
Get aValueParser
instance from the service.ValueParser.URLCaseFolding
getUrlFolding()
Gets the folding value from the configurationList<Part>
parseUpload(HttpServletRequest request)
Parse the given request for uploaded filesvoid
putParser(ValueParser parser)
Put the parser into service
-
-
-
Field Detail
-
PARAMETER_ENCODING_DEFAULT
static final String PARAMETER_ENCODING_DEFAULT
Default Encoding for Parameter Parser- See Also:
- Constant Field Values
-
PARAMETER_ENCODING_KEY
static final String PARAMETER_ENCODING_KEY
Key for the Parameter Parser Encoding- See Also:
- Constant Field Values
-
URL_CASE_FOLDING_KEY
static final String URL_CASE_FOLDING_KEY
Property for setting the URL folding value- See Also:
- Constant Field Values
-
AUTOMATIC_KEY
static final String AUTOMATIC_KEY
Parse file upload items automatically- See Also:
- Constant Field Values
-
FULCRUM_POOL_DEFAULT
static final boolean FULCRUM_POOL_DEFAULT
fulcrum pool by default false- See Also:
- Constant Field Values
-
FULCRUM_POOL_KEY
static final String FULCRUM_POOL_KEY
fulcrum pool activation parameter- See Also:
- Constant Field Values
-
POOL_KEY
static final String POOL_KEY
commons pool2 parameters- See Also:
- Constant Field Values
-
AUTOMATIC_DEFAULT
static final boolean AUTOMATIC_DEFAULT
The default value of 'automaticUpload' property (
false
). If set totrue
, parsing the multipart request will be performed automatically byParameterParser
. Otherwise, an org.apache.turbine.modules.Action may decide to parse the request by callingparseRequest
manually.- See Also:
- Constant Field Values
-
DEFAULT_POOL_CAPACITY
static final int DEFAULT_POOL_CAPACITY
The default value of 'maxTotal' property in 'pool' (
1024
). The default pool capacity.- See Also:
- Constant Field Values
-
DEFAULT_MAX_IDLE
static final int DEFAULT_MAX_IDLE
The default value of 'maxIdle' property in 'pool' (
2
). The default maximum idle object.- See Also:
- Constant Field Values
-
-
Method Detail
-
getParameterEncoding
String getParameterEncoding()
Get the parameter encoding that has been configured as default for the ParserService.- Returns:
- A String for the parameter encoding
-
convert
String convert(String value)
Trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING. It returns a new string so that it does not destroy the value data.- Parameters:
value
- A String to be processed.- Returns:
- A new String converted to lowercase and trimmed.
-
convertAndTrim
String convertAndTrim(String value)
Convert a String value according to the url-case-folding property.- Parameters:
value
- the String to convert- Returns:
- a new String.
-
convertAndTrim
String convertAndTrim(String value, ValueParser.URLCaseFolding fold)
A convert method, which trims the string data and applies the conversion specified in the parameter given. It returns a new string so that it does not destroy the value data.- Parameters:
value
- A String to be processed.fold
- The parameter folding to be applied (seeParserService
)- Returns:
- A new String converted to the correct case and trimmed.
-
getUrlFolding
ValueParser.URLCaseFolding getUrlFolding()
Gets the folding value from the configuration- Returns:
- The current Folding Value
-
getAutomaticUpload
boolean getAutomaticUpload()
Gets the automaticUpload value from the configuration- Returns:
- The current automaticUpload Value
-
parseUpload
List<Part> parseUpload(HttpServletRequest request) throws org.apache.avalon.framework.service.ServiceException
Parse the given request for uploaded files- Parameters:
request
- the HttpServletRequest object- Returns:
- A list of
Part
s - Throws:
org.apache.avalon.framework.service.ServiceException
- if parsing fails
-
getParser
<P extends ValueParser> P getParser(Class<P> ppClass) throws InstantiationException
Get aValueParser
instance from the service. Use the default implementation.- Type Parameters:
P
- The ValueParser we are using- Parameters:
ppClass
- parameter parser class- Returns:
- An object that implements ValueParser
- Throws:
InstantiationException
- if the instance could not be created
-
putParser
void putParser(ValueParser parser)
Put the parser into service- Parameters:
parser
- The value parser to be used
-
-