当前位置: 首页>>代码示例>>Java>>正文


Java UrlEncoded.decodeTo方法代码示例

本文整理汇总了Java中org.eclipse.jetty.util.UrlEncoded.decodeTo方法的典型用法代码示例。如果您正苦于以下问题:Java UrlEncoded.decodeTo方法的具体用法?Java UrlEncoded.decodeTo怎么用?Java UrlEncoded.decodeTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jetty.util.UrlEncoded的用法示例。


在下文中一共展示了UrlEncoded.decodeTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JdbcUrlConnection

import org.eclipse.jetty.util.UrlEncoded; //导入方法依赖的package包/类
protected JdbcUrlConnection(URL url) {
    super(url);

    String urlAsString = url.toString();
    int position = urlAsString.indexOf("?");
    if (position == -1) {
        jdbcBase = urlAsString;
    } else {
        jdbcBase = urlAsString.substring(0, position);
        String rest = urlAsString.substring(position+1);
        MultiMap<String> map = new MultiMap<>();
        UrlEncoded.decodeTo(rest, map, (String) null, 10);

        for (Map.Entry<String, List<String>> entry : map.entrySet()) {
            if (entry.getValue().size()>1) {
                throw new IllegalArgumentException("parameter " + entry.getKey() + " occurs more than once");
            }
            jdbcProperties.put(entry.getKey(), entry.getValue().get(0));
        }
    }
}
 
开发者ID:sarmbruster,项目名称:neo4j-csv-firehose,代码行数:22,代码来源:JdbcUrlConnection.java

示例2: getContent

import org.eclipse.jetty.util.UrlEncoded; //导入方法依赖的package包/类
private String getContent(String m_url, ContentTaggingRule contentTaggingRule){		
	try {
		URL url = new URL(m_url);
		int ruleType = contentTaggingRule.getRuleType();			
		switch (ruleType) {
		case pathRuleIndex:
			String path = url.getPath();
			//System.out.println("--------"+path);
			Pattern pattern = Pattern.compile(contentTaggingRule.getPara());
			Matcher matcher = pattern.matcher(path);
			if(matcher.find()){
				//System.out.println("--------"+matcher.group(1));
				return matcher.group(1);
			}				
			break;			
		case paraRuleIndex:
			String query = url.getQuery();
			MultiMap<String> values = new MultiMap<String>(); 
			UrlEncoded.decodeTo(query, values, "UTF-8", 1000);

			String para = contentTaggingRule.getPara();
			if(values.containsKey(para)){
				return values.get(para).get(0);
			}
			break;
		default:
			break;
		}
		
	} catch (MalformedURLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return "";
}
 
开发者ID:TheGrail,项目名称:http-request-tag-engine,代码行数:36,代码来源:JDContentRecognitionModel.java

示例3: parseParameters

import org.eclipse.jetty.util.UrlEncoded; //导入方法依赖的package包/类
/**
 * Parse query parameters which might be embedded in the URI double
 * encoded after and @ sign.
 */
private void parseParameters() {
	if (parametersAlreadyParsed) {
		return;
	}

	parametersAlreadyParsed = true;

	final String uri = overrideUri;
	final int atPos = uri.indexOf("@");
	if (atPos == -1) {
		requestUri = overrideUri;
		parameters = request.getParameterMap();
		return;
	}

	requestUri = uri.substring(0, atPos);
	final String doubleEncodedContent = uri.substring(atPos + 1);

	final Charset utf8 = Charset.forName("UTF-8");
	final String singleEncodedContent = UrlEncoded.decodeString(
			doubleEncodedContent, 0, doubleEncodedContent.length(),
			utf8);

	final MultiMap<String> tempParameters = new MultiMap<String>();
	UrlEncoded.decodeTo(singleEncodedContent, tempParameters, utf8, 10);
	parameters = new HashMap<String, String[]>();
	final Iterator<Map.Entry<String, List<String>>> iter = tempParameters
			.entrySet().iterator();
	while (iter.hasNext()) {
		final Map.Entry<String, List<String>> e = iter.next();
		final String key = e.getKey();
		final List<String> valsList = e.getValue();
		final String[] valsArray = new String[valsList.size()];
		valsList.toArray(valsArray);
		parameters.put(key, valsArray);
	}
}
 
开发者ID:ZapBlasterson,项目名称:crushpaper,代码行数:42,代码来源:Servlet.java


注:本文中的org.eclipse.jetty.util.UrlEncoded.decodeTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。