use of javax.websocket.Extension in project spring-framework by spring-projects.
the class StandardWebSocketSession method initializeNativeSession.
@Override
public void initializeNativeSession(Session session) {
super.initializeNativeSession(session);
this.id = session.getId();
this.uri = session.getRequestURI();
this.acceptedProtocol = session.getNegotiatedSubprotocol();
List<Extension> standardExtensions = getNativeSession().getNegotiatedExtensions();
if (!CollectionUtils.isEmpty(standardExtensions)) {
this.extensions = new ArrayList<>(standardExtensions.size());
for (Extension standardExtension : standardExtensions) {
this.extensions.add(new StandardToWebSocketExtensionAdapter(standardExtension));
}
this.extensions = Collections.unmodifiableList(this.extensions);
} else {
this.extensions = Collections.emptyList();
}
if (this.user == null) {
this.user = session.getUserPrincipal();
}
}
use of javax.websocket.Extension in project undertow by undertow-io.
the class ServerWebSocketContainer method toExtensionList.
private static List<WebSocketExtension> toExtensionList(final List<Extension> extensions) {
List<WebSocketExtension> ret = new ArrayList<>();
for (Extension e : extensions) {
final List<WebSocketExtension.Parameter> parameters = new ArrayList<>();
for (Extension.Parameter p : e.getParameters()) {
parameters.add(new WebSocketExtension.Parameter(p.getName(), p.getValue()));
}
ret.add(new WebSocketExtension(e.getName(), parameters));
}
return ret;
}
Aggregations