本文整理汇总了Java中org.apache.catalina.util.RequestUtil.parseParameters方法的典型用法代码示例。如果您正苦于以下问题:Java RequestUtil.parseParameters方法的具体用法?Java RequestUtil.parseParameters怎么用?Java RequestUtil.parseParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.util.RequestUtil
的用法示例。
在下文中一共展示了RequestUtil.parseParameters方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mergeParameters
import org.apache.catalina.util.RequestUtil; //导入方法依赖的package包/类
/**
* Merge the parameters from the saved query parameter string (if any), and
* the parameters already present on this request (if any), such that the
* parameter values from the query string show up first if there are
* duplicate parameter names.
*/
private void mergeParameters() {
if ((queryParamString == null) || (queryParamString.length() < 1))
return;
HashMap<String, String[]> queryParameters = new HashMap<String, String[]>();
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = "ISO-8859-1";
RequestUtil.parseParameters(queryParameters, queryParamString,
encoding);
Iterator<String> keys = parameters.keySet().iterator();
while (keys.hasNext()) {
String key = keys.next();
Object value = queryParameters.get(key);
if (value == null) {
queryParameters.put(key, parameters.get(key));
continue;
}
queryParameters.put
(key, mergeValues(value, parameters.get(key)));
}
parameters = queryParameters;
}
示例2: parseStreamParameters
import org.apache.catalina.util.RequestUtil; //导入方法依赖的package包/类
/**
* Read all parameters directly from the input stream. Necessary because parameters are not mapped to the
* HttpRequest.getParameter api on PUT requests
* @param req
* @param params
*/
private void parseStreamParameters(HttpServletRequest req, Map<String, List<String>> params) {
try {
String content = this.convertStreamToString(req.getInputStream());
if( content != null && content.length() >= 1 ){
Map<String, String[]> ps = new HashMap<String, String[]>();
RequestUtil.parseParameters(ps, content, "UTF-8");
for (String key : ps.keySet()) {
List<String> param = new ArrayList<String>();
for(String value : ps.get(key)) {
param.add(value);
}
params.put(key, param);
}
}
} catch (IOException e) {
throw new InputException(e);
}
}
示例3: mergeParameters
import org.apache.catalina.util.RequestUtil; //导入方法依赖的package包/类
/**
* Merge the parameters from the saved query parameter string (if any), and
* the parameters already present on this request (if any), such that the
* parameter values from the query string show up first if there are
* duplicate parameter names.
*/
private void mergeParameters() {
if ((queryParamString == null) || (queryParamString.length() < 1))
return;
HashMap queryParameters = new HashMap();
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = "ISO-8859-1";
try {
RequestUtil.parseParameters
(queryParameters, queryParamString, encoding);
} catch (Exception e) {
;
}
Iterator keys = parameters.keySet().iterator();
while (keys.hasNext()) {
String key = (String) keys.next();
Object value = queryParameters.get(key);
if (value == null) {
queryParameters.put(key, parameters.get(key));
continue;
}
queryParameters.put
(key, mergeValues(value, parameters.get(key)));
}
parameters = queryParameters;
}
示例4: mergeParameters
import org.apache.catalina.util.RequestUtil; //导入方法依赖的package包/类
/**
* Merge the parameters from the specified query string (if any), and
* the parameters already present on this request (if any), such that
* the parameter values from the query string show up first if there are
* duplicate parameter names.
*
* @param queryString The query string containing parameters to be merged
*/
void mergeParameters(String queryString) {
if ((queryString == null) || (queryString.length() < 1))
return;
HashMap queryParameters = new HashMap();
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = "ISO-8859-1";
try {
RequestUtil.parseParameters
(queryParameters, queryString, encoding);
} catch (Exception e) {
;
}
synchronized (parameters) {
Iterator keys = parameters.keySet().iterator();
while (keys.hasNext()) {
String key = (String) keys.next();
Object value = queryParameters.get(key);
if (value == null) {
queryParameters.put(key, parameters.get(key));
continue;
}
queryParameters.put
(key, mergeValues(value, parameters.get(key)));
}
parameters = queryParameters;
}
}