com.sap.ip.me.api.runtime.jsp
Class ParameterConverter

java.lang.Object
  extended bycom.sap.ip.me.api.runtime.jsp.ParameterConverter

public class ParameterConverter
extends java.lang.Object

This class provides methods for converting the encoding of http servlet request parameter values. A conversion will always be performed from ISO8859_1 to a character encoding that has to be specified via setCharacterEncoding method.

Author:
SAP

Constructor Summary
ParameterConverter(HttpServletRequest request)
          Constructs a new ParameterConverter instance around the given http servlet request.
 
Method Summary
 java.lang.String getParameter(java.lang.String name)
          Returns the converted parameter value as a string, null if the parameter does not exist, or the original parameter value without encoding change if no encoding was yet set.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns the converted parameter values as a string array, null if the parameter does not exist, or the original parameter values without encoding change if no encoding was yet set.
 HttpServletRequest getRequest()
          Returns the request the ParameterConverter instance was constructed around.
 void setCharacterEncoding(java.lang.String encoding)
          Sets the character encoding that has to be used for parameter value conversions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterConverter

public ParameterConverter(HttpServletRequest request)
Constructs a new ParameterConverter instance around the given http servlet request. However, a character encoding for the parameter value conversions is not implicitly set. The (target) character encoding has explicitly to be set using the setCharacterEncoding method.

Parameters:
request - The HttpServletRequest instance containing the parameter values that have to be converted.
Method Detail

setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding)
                          throws java.io.UnsupportedEncodingException
Sets the character encoding that has to be used for parameter value conversions. A implict test is performed to check whether ISO8859_1 as well as the given encoding are supported.

Parameters:
encoding - The character encoding that has to be used for parameter value conversions.
Throws:
java.io.UnsupportedEncodingException - Will be thrown if either ISO8859_1 or the given encoding are not supported.

getParameter

public java.lang.String getParameter(java.lang.String name)
Returns the converted parameter value as a string, null if the parameter does not exist, or the original parameter value without encoding change if no encoding was yet set.

Parameters:
name - Name of the http servlet request parameter whose value should be converted.
Returns:
The converted parameter value, if a conversion was possible, otherwise the unchanged parameter value.

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Returns the converted parameter values as a string array, null if the parameter does not exist, or the original parameter values without encoding change if no encoding was yet set.

Parameters:
name - Name of the http servlet request parameter whose values should be converted.
Returns:
The converted parameter values, if a conversion was possible, otherwise the unchanged parameter values.

getRequest

public HttpServletRequest getRequest()
Returns the request the ParameterConverter instance was constructed around.

Returns:
The request instance.


Copyright © 2005 SAP AG. All Rights Reserved.