spring-integration icon indicating copy to clipboard operation
spring-integration copied to clipboard

i wannt to encode uri in WebSocketConnectionManager

Open TheheiWorld opened this issue 3 years ago • 3 comments

Expected Behavior

if uri is 'ws://localhost:5000/test?sgin=abc%2', WebSocketConnectionManager encode uri %2 to %252 , but i need %S

Current Behavior

Context

TheheiWorld avatar May 25 '22 09:05 TheheiWorld

The logic there is like this:

	public ConnectionManagerSupport(String uriTemplate, Object... uriVariables) {
		this.uri = UriComponentsBuilder.fromUriString(uriTemplate).buildAndExpand(
				uriVariables).encode().toUri();
	}

So, uri is indeed encoded. Maybe you need to look into exactly opposite way: provide not encoded uri and then that WebSocketConnectionManager will a proper encoding for you?

artembilan avatar May 25 '22 14:05 artembilan

i had seen this code . i want to encode url param depending on myself. in some Third Party services, like ws://localhost:5000/test?sign={value}, value=a,b,c require to encode value, but using ConnectionManagerSupport , the , is not encoded, so i need to encode , manually,like ws://localhost:5000/test?sign=a%2Cb%2Cc then ConnectionManagerSupport encode url again, like ws://localhost:5000/test?sign=a%252Cb%252Cc, so the url become invaild for Third Party services, so i want to encode url param depending on myself.

TheheiWorld avatar May 25 '22 14:05 TheheiWorld

I think that makes sense. So, consider to raise an issue in https://github.com/spring-projects/spring-framework and ask that org.springframework.web.socket.client.ConnectionManagerSupport must also provide a ctor for the URI which will be created and encoded respectively by end-user upfront. When that ctor is present, we fix org.springframework.integration.websocket.ClientWebSocketContainer for a new ctor as well.

Please, cross-link that issue back here, so we know what is a context and when we are good to go with the fix over here.

Thanks

artembilan avatar May 25 '22 14:05 artembilan