Java Code Examples for javax.websocket.Extension#Parameter
The following examples show how to use
javax.websocket.Extension#Parameter .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PerMessageDeflate.java From Tomcat8-Source-Read with MIT License | 6 votes |
@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; }
Example 2
Source File: UpgradeUtil.java From tomcatsrc with Apache License 2.0 | 6 votes |
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()); } } }
Example 3
Source File: PerMessageDeflate.java From tomcatsrc with Apache License 2.0 | 6 votes |
@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; }
Example 4
Source File: WsWebSocketContainer.java From tomcatsrc with Apache License 2.0 | 6 votes |
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; }
Example 5
Source File: UpgradeUtil.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
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()); } } }
Example 6
Source File: PerMessageDeflate.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@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; }
Example 7
Source File: WsWebSocketContainer.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
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; }
Example 8
Source File: UpgradeUtil.java From Tomcat8-Source-Read with MIT License | 6 votes |
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()); } } }
Example 9
Source File: WsWebSocketContainer.java From Tomcat8-Source-Read with MIT License | 6 votes |
private static List<String> generateExtensionHeaders(List<Extension> extensions) { List<String> result = new ArrayList<>(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; }
Example 10
Source File: StandardToWebSocketExtensionAdapter.java From java-technology-stack with MIT License | 5 votes |
private static Map<String, String> initParameters(Extension extension) { List<Extension.Parameter> parameters = extension.getParameters(); Map<String, String> result = new LinkedCaseInsensitiveMap<>(parameters.size(), Locale.ENGLISH); for (Extension.Parameter parameter : parameters) { result.put(parameter.getName(), parameter.getValue()); } return result; }
Example 11
Source File: ServerWebSocketContainer.java From quarkus-http with Apache License 2.0 | 5 votes |
private static List<WebSocketExtensionData> toExtensionList(final List<Extension> extensions) { List<WebSocketExtensionData> ret = new ArrayList<>(); for (Extension e : extensions) { final Map<String, String> parameters = new HashMap<>(); for (Extension.Parameter p : e.getParameters()) { parameters.put(p.getName(), p.getValue()); } ret.add(new WebSocketExtensionData(e.getName(), parameters)); } return ret; }
Example 12
Source File: StandardToWebSocketExtensionAdapter.java From spring-analysis-note with MIT License | 5 votes |
private static Map<String, String> initParameters(Extension extension) { List<Extension.Parameter> parameters = extension.getParameters(); Map<String, String> result = new LinkedCaseInsensitiveMap<>(parameters.size(), Locale.ENGLISH); for (Extension.Parameter parameter : parameters) { result.put(parameter.getName(), parameter.getValue()); } return result; }
Example 13
Source File: UpgradeUtil.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
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; }
Example 14
Source File: TransformationFactory.java From Tomcat8-Source-Read with MIT License | 5 votes |
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)); } }
Example 15
Source File: TransformationFactory.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
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)); } }
Example 16
Source File: StandardToWebSocketExtensionAdapter.java From spring4-understanding with Apache License 2.0 | 5 votes |
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; }
Example 17
Source File: UpgradeUtil.java From Tomcat8-Source-Read with MIT License | 5 votes |
private static List<Transformation> createTransformations( List<Extension> negotiatedExtensions) { TransformationFactory factory = TransformationFactory.getInstance(); LinkedHashMap<String,List<List<Extension.Parameter>>> extensionPreferences = new LinkedHashMap<>(); // Result will likely be smaller than this List<Transformation> result = new ArrayList<>(negotiatedExtensions.size()); for (Extension extension : negotiatedExtensions) { List<List<Extension.Parameter>> preferences = extensionPreferences.get(extension.getName()); if (preferences == null) { preferences = new ArrayList<>(); 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; }
Example 18
Source File: UpgradeUtil.java From tomcatsrc with Apache License 2.0 | 5 votes |
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; }
Example 19
Source File: TransformationFactory.java From tomcatsrc with Apache License 2.0 | 5 votes |
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)); } }