risdenk commented on a change in pull request #142: KNOX-1996: Adding changes
to remove extra / while generating backedn …
URL: https://github.com/apache/knox/pull/142#discussion_r321768245
##########
File path:
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
##########
@@ -173,12 +174,41 @@ private synchronized String getMatchedBackendURL(final
String path) {
/* URL used to connect to websocket backend */
String backendURL = urlFromServiceDefinition(serviceRegistryService,
entry, path);
+ LOG.logMessage("Url obtained from services definition: " + backendURL);
StringBuilder backend = new StringBuilder();
try {
-
- /* if we do not find websocket URL we default to HTTP */
- if (!StringUtils.containsAny(backendURL, WEBSOCKET_PROTOCOL_STRING,
SECURE_WEBSOCKET_PROTOCOL_STRING)) {
+ if (StringUtils.containsAny(backendURL, WEBSOCKET_PROTOCOL_STRING,
SECURE_WEBSOCKET_PROTOCOL_STRING)) {
Review comment:
Yea sure, but inside the two if clauses there are a bunch of duplicate
lines. Especially around handling `/ws` and `/websocket` which I think should
be in one place. Handling the prefix/suffix shouldn't need to happen in two
places.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services