Skip to content

Commit

Permalink
HttpClientOptions fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Nov 2, 2018
1 parent 7979f5a commit 004a1e9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
49 changes: 25 additions & 24 deletions src/main/java/io/vertx/core/http/HttpClientOptions.java
Expand Up @@ -1091,68 +1091,69 @@ public HttpClientOptions setLogActivity(boolean logEnabled) {
} }


/** /**
* Set option to offer Deflate Frame websocket compression * Set option to offer per frame WebSocket compression.
* @param tryDeflateFrame *
* @return a reference to this, so the API can be used fluently * @param tryUsePerFrameWebsocketCompression the per frame compression WebSocket compression
* @return a reference to this, so the API can be used fluently
*/ */
public HttpClientOptions setTryUsePerFrameWebsocketCompression (boolean tryUsePerFrameWebsocketCompression ) public HttpClientOptions setTryUsePerFrameWebsocketCompression (boolean tryUsePerFrameWebsocketCompression)
{ {
this.websocketTryUseDeflateFrame = tryUsePerFrameWebsocketCompression; this.websocketTryUseDeflateFrame = tryUsePerFrameWebsocketCompression;
return this; return this;
} }


/** /**
* * @return Whether Deflate Frame WebSocket compression will be offered
* @return Whether Deflate Frame websocket compression will be offered
*/ */
public boolean tryWebsocketDeflateFrameCompression() public boolean tryWebsocketDeflateFrameCompression()
{ {
return this.websocketTryUseDeflateFrame; return this.websocketTryUseDeflateFrame;
} }


/** /**
* Set option to offer Permessage Deflate websocket compression * Set option to offer per message WebSocket compression.
* @param tryPermessageDeflate *
* @param tryUsePerMessageWebsocketCompression the per message WebSocket compression
* @return a reference to this, so the API can be used fluently * @return a reference to this, so the API can be used fluently
*/ */
public HttpClientOptions setTryUsePerMessageWebsocketCompression (boolean tryUsePerMessageWebsocketCompression ) public HttpClientOptions setTryUsePerMessageWebsocketCompression (boolean tryUsePerMessageWebsocketCompression)
{ {
this.websocketTryUsePermessageDeflate = tryUsePerMessageWebsocketCompression; this.websocketTryUsePermessageDeflate = tryUsePerMessageWebsocketCompression;
return this; return this;
} }


/** /**
* * @return whether per message WebSocket compression will be offered
* @return whether Permessage Deflate websocket compression will be offered
*/ */
public boolean tryUsePerMessageWebsocketCompression () public boolean tryUsePerMessageWebsocketCompression ()
{ {
return this.websocketTryUsePermessageDeflate; return this.websocketTryUsePermessageDeflate;
} }


/** /**
* Set websocket compression level * Set WebSocket compression level
* @param compressionLevel *
* @param compressionLevel the WebSocket compression level
* @return a reference to this, so the API can be used fluently * @return a reference to this, so the API can be used fluently
*/ */
public HttpClientOptions setWebsocketCompressionLevel (int websocketCompressionLevel) public HttpClientOptions setWebsocketCompressionLevel (int compressionLevel)
{ {
this.websocketCompressionLevel = websocketCompressionLevel; this.websocketCompressionLevel = compressionLevel;
return this; return this;
} }


/** /**
* * @return the WebSocket compression level
* @return websocket compression level
*/ */
public int websocketCompressionLevel() public int getWebsocketCompressionLevel()
{ {
return this.websocketCompressionLevel; return this.websocketCompressionLevel;
} }


/** /**
* Set the websocket compression allow client no context option * Set the WebSocket compression allow client no context option.
* @param allowClientNoContext *
* @param allowClientNoContext the no context option value
* @return a reference to this, so the API can be used fluently * @return a reference to this, so the API can be used fluently
*/ */
public HttpClientOptions setWebsocketCompressionAllowClientNoContext(boolean allowClientNoContext) public HttpClientOptions setWebsocketCompressionAllowClientNoContext(boolean allowClientNoContext)
Expand All @@ -1162,7 +1163,6 @@ public HttpClientOptions setWebsocketCompressionAllowClientNoContext(boolean all
} }


/** /**
*
* @return the current websocket compression client no context setting * @return the current websocket compression client no context setting
*/ */
public boolean getWebsocketCompressionAllowClientNoContext() public boolean getWebsocketCompressionAllowClientNoContext()
Expand All @@ -1171,8 +1171,9 @@ public boolean getWebsocketCompressionAllowClientNoContext()
} }


/** /**
* Set the websocket compression server no context option * Set the WebSocket compression server no context option
* @param requestServerNoContext *
* @param requestServerNoContext the server no context option value
* @return a reference to this, so the API can be used fluently * @return a reference to this, so the API can be used fluently
*/ */
public HttpClientOptions setWebsocketCompressionRequestServerNoContext(boolean requestServerNoContext) public HttpClientOptions setWebsocketCompressionRequestServerNoContext(boolean requestServerNoContext)
Expand All @@ -1182,7 +1183,6 @@ public HttpClientOptions setWebsocketCompressionRequestServerNoContext(boolean r
} }


/** /**
*
* @return current setting of the websocket compression server no context option * @return current setting of the websocket compression server no context option
*/ */
public boolean getWebsocketCompressionRequestServerNoContext() public boolean getWebsocketCompressionRequestServerNoContext()
Expand All @@ -1197,6 +1197,7 @@ public boolean getWebsocketCompressionRequestServerNoContext()


/** /**
* set to {@code initialBufferSizeHttpDecoder} the initial buffer of the HttpDecoder. * set to {@code initialBufferSizeHttpDecoder} the initial buffer of the HttpDecoder.
*
* @param decoderInitialBufferSize the initial buffer size * @param decoderInitialBufferSize the initial buffer size
* @return a reference to this, so the API can be used fluently * @return a reference to this, so the API can be used fluently
*/ */
Expand Down
Expand Up @@ -712,12 +712,12 @@ synchronized void toWebSocket(String requestURI, MultiMap headers, WebsocketVers
ArrayList<WebSocketClientExtensionHandshaker> initializeWebsocketExtensionHandshakers (HttpClientOptions options) { ArrayList<WebSocketClientExtensionHandshaker> initializeWebsocketExtensionHandshakers (HttpClientOptions options) {
ArrayList<WebSocketClientExtensionHandshaker> extensionHandshakers = new ArrayList<WebSocketClientExtensionHandshaker>(); ArrayList<WebSocketClientExtensionHandshaker> extensionHandshakers = new ArrayList<WebSocketClientExtensionHandshaker>();
if (options.tryWebsocketDeflateFrameCompression()) { if (options.tryWebsocketDeflateFrameCompression()) {
extensionHandshakers.add(new DeflateFrameClientExtensionHandshaker(options.websocketCompressionLevel(), extensionHandshakers.add(new DeflateFrameClientExtensionHandshaker(options.getWebsocketCompressionLevel(),
false)); false));
} }


if (options.tryUsePerMessageWebsocketCompression ()) { if (options.tryUsePerMessageWebsocketCompression ()) {
extensionHandshakers.add(new PerMessageDeflateClientExtensionHandshaker(options.websocketCompressionLevel(), extensionHandshakers.add(new PerMessageDeflateClientExtensionHandshaker(options.getWebsocketCompressionLevel(),
ZlibCodecFactory.isSupportingWindowSizeAndMemLevel(), PerMessageDeflateServerExtensionHandshaker.MAX_WINDOW_SIZE, ZlibCodecFactory.isSupportingWindowSizeAndMemLevel(), PerMessageDeflateServerExtensionHandshaker.MAX_WINDOW_SIZE,
options.getWebsocketCompressionAllowClientNoContext(), options.getWebsocketCompressionRequestServerNoContext())); options.getWebsocketCompressionAllowClientNoContext(), options.getWebsocketCompressionRequestServerNoContext()));
} }
Expand Down

0 comments on commit 004a1e9

Please sign in to comment.