Skip to content

Commit

Permalink
Rename WebsocketVersion to WebSocketVersion
Browse files Browse the repository at this point in the history
Motivation:

There has been a typo in WebSocketVersion enum for ages, it seems reasonable to fix it in Vert.x 5.0

Changes:

Rename WebsocketVersion to WebSocketVersion
  • Loading branch information
vietj committed Oct 24, 2024
1 parent 88f9b06 commit 99cb7e3
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, WebSock
switch (member.getKey()) {
case "version":
if (member.getValue() instanceof String) {
obj.setVersion(io.vertx.core.http.WebsocketVersion.valueOf((String)member.getValue()));
obj.setVersion(io.vertx.core.http.WebSocketVersion.valueOf((String)member.getValue()));
}
break;
case "subProtocols":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import io.vertx.core.net.Address;
import io.vertx.core.net.ClientSSLOptions;
import io.vertx.core.net.ProxyOptions;
import io.vertx.core.net.SocketAddress;

import java.net.URI;
import java.net.URISyntaxException;
Expand All @@ -43,9 +42,9 @@ public class WebSocketConnectOptions extends RequestOptions {
public static final ProxyOptions DEFAULT_PROXY_OPTIONS = null;

/**
* The default WebSocket version = {@link WebsocketVersion#V13}
* The default WebSocket version = {@link WebSocketVersion#V13}
*/
public static final WebsocketVersion DEFAULT_VERSION = WebsocketVersion.V13;
public static final WebSocketVersion DEFAULT_VERSION = WebSocketVersion.V13;

/**
* The default WebSocket sub protocols = {@code null}
Expand All @@ -63,7 +62,7 @@ public class WebSocketConnectOptions extends RequestOptions {
public static final boolean DEFAULT_REGISTER_WRITE_HANDLERS = false;

private ProxyOptions proxyOptions;
private WebsocketVersion version;
private WebSocketVersion version;
private List<String> subProtocols;
private boolean allowOriginHeader;
private boolean registerWriteHandlers;
Expand Down Expand Up @@ -93,7 +92,7 @@ public WebSocketConnectOptions(JsonObject json) {
/**
* @return the WebSocket version
*/
public WebsocketVersion getVersion() {
public WebSocketVersion getVersion() {
return version;
}

Expand All @@ -102,7 +101,7 @@ public WebsocketVersion getVersion() {
*
* @return a reference to this, so the API can be used fluently
*/
public WebSocketConnectOptions setVersion(WebsocketVersion version) {
public WebSocketConnectOptions setVersion(WebSocketVersion version) {
this.version = version;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
* @author <a href="http://tfox.org">Tim Fox</a>
*/
@VertxGen
public enum WebsocketVersion {
public enum WebSocketVersion {
V00, V07, V08, V13
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.netty.util.concurrent.GenericFutureListener;
import io.vertx.core.*;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.WebSocketVersion;
import io.vertx.core.internal.buffer.BufferInternal;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpVersion;
Expand Down Expand Up @@ -926,7 +927,7 @@ synchronized void toWebSocket(
MultiMap headers,
boolean allowOriginHeader,
WebSocketClientOptions options,
WebsocketVersion vers,
WebSocketVersion vers,
List<String> subProtocols,
long handshakeTimeout,
boolean registerWriteHandlers,
Expand All @@ -938,9 +939,9 @@ synchronized void toWebSocket(
// Netty requires an absolute url
wsuri = new URI((ssl ? "https:" : "http:") + "//" + server.host() + ":" + server.port() + requestURI);
}
WebSocketVersion version =
WebSocketVersion.valueOf((vers == null ?
WebSocketVersion.V13 : vers).toString());
io.netty.handler.codec.http.websocketx.WebSocketVersion version =
io.netty.handler.codec.http.websocketx.WebSocketVersion.valueOf((vers == null ?
io.netty.handler.codec.http.websocketx.WebSocketVersion.V13 : vers).toString());
HttpHeaders nettyHeaders;
if (headers != null) {
nettyHeaders = new DefaultHttpHeaders();
Expand Down Expand Up @@ -1035,7 +1036,7 @@ synchronized void toWebSocket(
}

static WebSocketClientHandshaker newHandshaker(
URI webSocketURL, WebSocketVersion version, String subprotocol,
URI webSocketURL, io.netty.handler.codec.http.websocketx.WebSocketVersion version, String subprotocol,
boolean allowExtensions, boolean allowOriginHeader, HttpHeaders customHeaders, int maxFramePayloadLength,
boolean performMasking) {
WebSocketDecoderConfig config = WebSocketDecoderConfig.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Future<WebSocket> webSocket(WebSocketConnectOptions options) {
return webSocket(vertx.getOrCreateContext(), options);
}

static WebSocketConnectOptions webSocketConnectOptionsAbs(String url, MultiMap headers, WebsocketVersion version, List<String> subProtocols) {
static WebSocketConnectOptions webSocketConnectOptionsAbs(String url, MultiMap headers, WebSocketVersion version, List<String> subProtocols) {
URI uri;
try {
uri = new URI(url);
Expand Down Expand Up @@ -126,7 +126,7 @@ static WebSocketConnectOptions webSocketConnectOptionsAbs(String url, MultiMap h
.setSubProtocols(subProtocols);
}

public Future<WebSocket> webSocketAbs(String url, MultiMap headers, WebsocketVersion version, List<String> subProtocols) {
public Future<WebSocket> webSocketAbs(String url, MultiMap headers, WebSocketVersion version, List<String> subProtocols) {
return webSocket(webSocketConnectOptionsAbs(url, headers, version, subProtocols));
}

Expand Down
Loading

0 comments on commit 99cb7e3

Please sign in to comment.