本文整理汇总了Java中javax.websocket.Extension.Parameter方法的典型用法代码示例。如果您正苦于以下问题:Java Extension.Parameter方法的具体用法?Java Extension.Parameter怎么用?Java Extension.Parameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.websocket.Extension
的用法示例。
在下文中一共展示了Extension.Parameter方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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());
}
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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());
}
}
}
示例7: 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;
}
示例8: createTransformations
import javax.websocket.Extension; //导入方法依赖的package包/类
private static List<Transformation> createTransformations(
List<Extension> negotiatedExtensions) {
TransformationFactory factory = TransformationFactory.getInstance();
LinkedHashMap<String,List<List<Extension.Parameter>>> extensionPreferences =
new LinkedHashMap<String,List<List<Extension.Parameter>>>();
// Result will likely be smaller than this
List<Transformation> result = new ArrayList<Transformation>(negotiatedExtensions.size());
for (Extension extension : negotiatedExtensions) {
List<List<Extension.Parameter>> preferences =
extensionPreferences.get(extension.getName());
if (preferences == null) {
preferences = new ArrayList<List<Extension.Parameter>>();
extensionPreferences.put(extension.getName(), preferences);
}
preferences.add(extension.getParameters());
}
for (Map.Entry<String,List<List<Extension.Parameter>>> entry :
extensionPreferences.entrySet()) {
Transformation transformation = factory.create(entry.getKey(), entry.getValue(), true);
if (transformation != null) {
result.add(transformation);
}
}
return result;
}
示例9: create
import javax.websocket.Extension; //导入方法依赖的package包/类
public Transformation create(String name, List<List<Extension.Parameter>> preferences,
boolean isServer) {
if (PerMessageDeflate.NAME.equals(name)) {
return PerMessageDeflate.negotiate(preferences, isServer);
}
if (Constants.ALLOW_UNSUPPORTED_EXTENSIONS) {
return null;
} else {
throw new IllegalArgumentException(
sm.getString("transformerFactory.unsupportedExtension", name));
}
}
示例10: createTransformations
import javax.websocket.Extension; //导入方法依赖的package包/类
private static List<Transformation> createTransformations(List<Extension> negotiatedExtensions) {
TransformationFactory factory = TransformationFactory.getInstance();
LinkedHashMap<String, List<List<Extension.Parameter>>> extensionPreferences = new LinkedHashMap<String, List<List<Extension.Parameter>>>();
// Result will likely be smaller than this
List<Transformation> result = new ArrayList<Transformation>(negotiatedExtensions.size());
for (Extension extension : negotiatedExtensions) {
List<List<Extension.Parameter>> preferences = extensionPreferences.get(extension.getName());
if (preferences == null) {
preferences = new ArrayList<List<Extension.Parameter>>();
extensionPreferences.put(extension.getName(), preferences);
}
preferences.add(extension.getParameters());
}
for (Map.Entry<String, List<List<Extension.Parameter>>> entry : extensionPreferences.entrySet()) {
Transformation transformation = factory.create(entry.getKey(), entry.getValue(), true);
if (transformation != null) {
result.add(transformation);
}
}
return result;
}
示例11: create
import javax.websocket.Extension; //导入方法依赖的package包/类
public Transformation create(String name, List<List<Extension.Parameter>> preferences, boolean isServer) {
if (PerMessageDeflate.NAME.equals(name)) {
return PerMessageDeflate.negotiate(preferences, isServer);
}
if (Constants.ALLOW_UNSUPPORTED_EXTENSIONS) {
return null;
} else {
throw new IllegalArgumentException(sm.getString("transformerFactory.unsupportedExtension", name));
}
}
示例12: 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;
}
示例13: createTransformations
import javax.websocket.Extension; //导入方法依赖的package包/类
private static List<Transformation> createTransformations(
List<Extension> negotiatedExtensions) {
TransformationFactory factory = TransformationFactory.getInstance();
LinkedHashMap<String,List<List<Extension.Parameter>>> extensionPreferences =
new LinkedHashMap<String,List<List<Extension.Parameter>>>();
// Result will likely be smaller than this
List<Transformation> result = new ArrayList<Transformation>(negotiatedExtensions.size());
for (Extension extension : negotiatedExtensions) {
List<List<Extension.Parameter>> preferences =
extensionPreferences.get(extension.getName());
if (preferences == null) {
preferences = new ArrayList<List<Extension.Parameter>>();
extensionPreferences.put(extension.getName(), preferences);
}
preferences.add(extension.getParameters());
}
for (Map.Entry<String,List<List<Extension.Parameter>>> entry :
extensionPreferences.entrySet()) {
Transformation transformation = factory.create(entry.getKey(), entry.getValue());
if (transformation != null) {
result.add(transformation);
}
}
return result;
}
示例14: create
import javax.websocket.Extension; //导入方法依赖的package包/类
public Transformation create(String name, List<List<Extension.Parameter>> preferences) {
if (PerMessageDeflate.NAME.equals(name)) {
return PerMessageDeflate.negotiate(preferences);
}
throw new IllegalArgumentException(
sm.getString("transformerFactory.unsupportedExtension", name));
}