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


Java Extension.getParameters方法代码示例

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


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

示例1: generateExtensionHeaders

import javax.websocket.Extension; //导入方法依赖的package包/类
private static List<String> generateExtensionHeaders(List<Extension> extensions) {
    List<String> result = new ArrayList<String>(extensions.size());
    for (Extension extension : extensions) {
        StringBuilder header = new StringBuilder();
        header.append(extension.getName());
        for (Extension.Parameter param : extension.getParameters()) {
            header.append(';');
            header.append(param.getName());
            String value = param.getValue();
            if (value != null && value.length() > 0) {
                header.append('=');
                header.append(value);
            }
        }
        result.add(header.toString());
    }
    return result;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:WsWebSocketContainer.java

示例2: getExtensionResponse

import javax.websocket.Extension; //导入方法依赖的package包/类
@Override
public Extension getExtensionResponse() {
    Extension result = new WsExtension(NAME);

    List<Extension.Parameter> params = result.getParameters();

    if (!serverContextTakeover) {
        params.add(new WsExtensionParameter(SERVER_NO_CONTEXT_TAKEOVER, null));
    }
    if (serverMaxWindowBits != -1) {
        params.add(new WsExtensionParameter(SERVER_MAX_WINDOW_BITS,
                Integer.toString(serverMaxWindowBits)));
    }
    if (!clientContextTakeover) {
        params.add(new WsExtensionParameter(CLIENT_NO_CONTEXT_TAKEOVER, null));
    }
    if (clientMaxWindowBits != -1) {
        params.add(new WsExtensionParameter(CLIENT_MAX_WINDOW_BITS,
                Integer.toString(clientMaxWindowBits)));
    }

    return result;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:PerMessageDeflate.java

示例3: append

import javax.websocket.Extension; //导入方法依赖的package包/类
private static void append(StringBuilder sb, Extension extension) {
    if (extension == null || extension.getName() == null || extension.getName().length() == 0) {
        return;
    }

    sb.append(extension.getName());

    for (Extension.Parameter p : extension.getParameters()) {
        sb.append(';');
        sb.append(p.getName());
        if (p.getValue() != null) {
            sb.append('=');
            sb.append(p.getValue());
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:UpgradeUtil.java

示例4: doTestParseExtensionHeaderSimple

import javax.websocket.Extension; //导入方法依赖的package包/类
private void doTestParseExtensionHeaderSimple(String header) {
    // Simple test
    List<Extension> result = new ArrayList<Extension>();
    Util.parseExtensionHeader(result, header);

    Assert.assertEquals(1, result.size());

    Extension ext = result.get(0);
    Assert.assertEquals("ext", ext.getName());
    List<Parameter> params = ext.getParameters();
    Assert.assertEquals(2, params.size());
    Parameter paramA = params.get(0);
    Assert.assertEquals("a", paramA.getName());
    Assert.assertEquals("1", paramA.getValue());
    Parameter paramB = params.get(1);
    Assert.assertEquals("b", paramB.getName());
    Assert.assertEquals("2", paramB.getValue());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:TestUtil.java

示例5: generateExtensionHeaders

import javax.websocket.Extension; //导入方法依赖的package包/类
private static List<String> generateExtensionHeaders(List<Extension> extensions) {
	List<String> result = new ArrayList<String>(extensions.size());
	for (Extension extension : extensions) {
		StringBuilder header = new StringBuilder();
		header.append(extension.getName());
		for (Extension.Parameter param : extension.getParameters()) {
			header.append(';');
			header.append(param.getName());
			String value = param.getValue();
			if (value != null && value.length() > 0) {
				header.append('=');
				header.append(value);
			}
		}
		result.add(header.toString());
	}
	return result;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:19,代码来源:WsWebSocketContainer.java

示例6: getExtensionResponse

import javax.websocket.Extension; //导入方法依赖的package包/类
@Override
public Extension getExtensionResponse() {
	Extension result = new WsExtension(NAME);

	List<Extension.Parameter> params = result.getParameters();

	if (!serverContextTakeover) {
		params.add(new WsExtensionParameter(SERVER_NO_CONTEXT_TAKEOVER, null));
	}
	if (serverMaxWindowBits != -1) {
		params.add(new WsExtensionParameter(SERVER_MAX_WINDOW_BITS, Integer.toString(serverMaxWindowBits)));
	}
	if (!clientContextTakeover) {
		params.add(new WsExtensionParameter(CLIENT_NO_CONTEXT_TAKEOVER, null));
	}
	if (clientMaxWindowBits != -1) {
		params.add(new WsExtensionParameter(CLIENT_MAX_WINDOW_BITS, Integer.toString(clientMaxWindowBits)));
	}

	return result;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:22,代码来源:PerMessageDeflate.java

示例7: append

import javax.websocket.Extension; //导入方法依赖的package包/类
private static void append(StringBuilder sb, Extension extension) {
	if (extension == null || extension.getName() == null || extension.getName().length() == 0) {
		return;
	}

	sb.append(extension.getName());

	for (Extension.Parameter p : extension.getParameters()) {
		sb.append(';');
		sb.append(p.getName());
		if (p.getValue() != null) {
			sb.append('=');
			sb.append(p.getValue());
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:UpgradeUtil.java

示例8: generateExtensionHeaders

import javax.websocket.Extension; //导入方法依赖的package包/类
private List<String> generateExtensionHeaders(List<Extension> extensions) {
    List<String> result = new ArrayList<String>(extensions.size());
    for (Extension extension : extensions) {
        StringBuilder header = new StringBuilder();
        header.append(extension.getName());
        for (Extension.Parameter param : extension.getParameters()) {
            header.append(';');
            header.append(param.getName());
            String value = param.getValue();
            if (value != null && value.length() > 0) {
                header.append('=');
                header.append(value);
            }
        }
    }
    return result;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:18,代码来源:WsWebSocketContainer.java

示例9: doTestParseExtensionHeaderMultiple

import javax.websocket.Extension; //导入方法依赖的package包/类
private void doTestParseExtensionHeaderMultiple(String header) {
    // Simple test
    List<Extension> result = new ArrayList<Extension>();
    Util.parseExtensionHeader(result, header);

    Assert.assertEquals(3, result.size());

    Extension ext = result.get(0);
    Assert.assertEquals("ext", ext.getName());
    List<Parameter> params = ext.getParameters();
    Assert.assertEquals(2, params.size());
    Parameter paramA = params.get(0);
    Assert.assertEquals("a", paramA.getName());
    Assert.assertEquals("1", paramA.getValue());
    Parameter paramB = params.get(1);
    Assert.assertEquals("b", paramB.getName());
    Assert.assertEquals("2", paramB.getValue());

    Extension ext2 = result.get(1);
    Assert.assertEquals("ext2", ext2.getName());
    List<Parameter> params2 = ext2.getParameters();
    Assert.assertEquals(2, params2.size());
    Parameter paramC = params2.get(0);
    Assert.assertEquals("c", paramC.getName());
    Assert.assertNull(paramC.getValue());
    Parameter paramD = params2.get(1);
    Assert.assertEquals("d", paramD.getName());
    Assert.assertEquals("xyz", paramD.getValue());

    Extension ext3 = result.get(2);
    Assert.assertEquals("ext3", ext3.getName());
    List<Parameter> params3 = ext3.getParameters();
    Assert.assertEquals(0, params3.size());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:35,代码来源:TestUtil.java

示例10: initParameters

import javax.websocket.Extension; //导入方法依赖的package包/类
private static Map<String, String> initParameters(Extension extension) {
	List<Extension.Parameter> parameters = extension.getParameters();
	Map<String, String> result = new LinkedCaseInsensitiveMap<String>(parameters.size(), Locale.ENGLISH);
	for (Extension.Parameter parameter : parameters) {
		result.put(parameter.getName(), parameter.getValue());
	}
	return result;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:StandardToWebSocketExtensionAdapter.java


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