Consistent use of StringUtils.toStringArray
(cherry picked from commit 6d11b40)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.server.HandshakeHandler;
|
||||
import org.springframework.web.socket.server.HandshakeInterceptor;
|
||||
@@ -65,7 +66,6 @@ public abstract class AbstractWebSocketHandlerRegistration<M> implements WebSock
|
||||
|
||||
/**
|
||||
* Deprecated constructor with a TaskScheduler.
|
||||
*
|
||||
* @deprecated as of 5.0 a TaskScheduler is not provided upfront, not until
|
||||
* it is obvious that it is needed, see {@link #getSockJsServiceRegistration()}.
|
||||
*/
|
||||
@@ -126,8 +126,7 @@ public abstract class AbstractWebSocketHandlerRegistration<M> implements WebSock
|
||||
this.sockJsServiceRegistration.setTransportHandlerOverrides(transportHandler);
|
||||
}
|
||||
if (!this.allowedOrigins.isEmpty()) {
|
||||
this.sockJsServiceRegistration.setAllowedOrigins(
|
||||
this.allowedOrigins.toArray(new String[this.allowedOrigins.size()]));
|
||||
this.sockJsServiceRegistration.setAllowedOrigins(StringUtils.toStringArray(this.allowedOrigins));
|
||||
}
|
||||
return this.sockJsServiceRegistration;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.HttpRequestHandler;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.server.HandshakeHandler;
|
||||
@@ -110,7 +111,7 @@ public class WebMvcStompWebSocketEndpointRegistration implements StompWebSocketE
|
||||
this.registration.setTransportHandlerOverrides(handler);
|
||||
}
|
||||
if (!this.allowedOrigins.isEmpty()) {
|
||||
this.registration.setAllowedOrigins(this.allowedOrigins.toArray(new String[this.allowedOrigins.size()]));
|
||||
this.registration.setAllowedOrigins(StringUtils.toStringArray(this.allowedOrigins));
|
||||
}
|
||||
return this.registration;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -182,7 +182,7 @@ public abstract class AbstractHandshakeHandler implements HandshakeHandler, Life
|
||||
* Return the list of supported sub-protocols.
|
||||
*/
|
||||
public String[] getSupportedProtocols() {
|
||||
return this.supportedProtocols.toArray(new String[this.supportedProtocols.size()]);
|
||||
return StringUtils.toStringArray(this.supportedProtocols);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -403,8 +403,8 @@ public abstract class AbstractHandshakeHandler implements HandshakeHandler, Life
|
||||
* @return the user for the WebSocket session, or {@code null} if not available
|
||||
*/
|
||||
@Nullable
|
||||
protected Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler,
|
||||
Map<String, Object> attributes) {
|
||||
protected Principal determineUser(
|
||||
ServerHttpRequest request, WebSocketHandler wsHandler, Map<String, Object> attributes) {
|
||||
|
||||
return request.getPrincipal();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user