From d1551bdcec05109c5f78f5741af1d4bde6916921 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 23 Dec 2015 21:19:18 +0100 Subject: [PATCH] Polishing --- .../org/springframework/util/ClassUtils.java | 6 ++--- .../UndertowRequestUpgradeStrategy.java | 22 +++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/util/ClassUtils.java b/spring-core/src/main/java/org/springframework/util/ClassUtils.java index c4ee177cab..93dd3d616e 100644 --- a/spring-core/src/main/java/org/springframework/util/ClassUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ClassUtils.java @@ -428,7 +428,7 @@ public abstract class ClassUtils { * @see java.beans.Introspector#decapitalize(String) */ public static String getShortNameAsProperty(Class clazz) { - String shortName = ClassUtils.getShortName(clazz); + String shortName = getShortName(clazz); int dotIndex = shortName.lastIndexOf(PACKAGE_SEPARATOR); shortName = (dotIndex != -1 ? shortName.substring(dotIndex + 1) : shortName); return Introspector.decapitalize(shortName); @@ -498,7 +498,7 @@ public abstract class ClassUtils { StringBuilder result = new StringBuilder(); while (clazz.isArray()) { clazz = clazz.getComponentType(); - result.append(ClassUtils.ARRAY_SUFFIX); + result.append(ARRAY_SUFFIX); } result.insert(0, clazz.getName()); return result.toString(); @@ -1222,7 +1222,7 @@ public abstract class ClassUtils { * @see org.springframework.aop.support.AopUtils#isCglibProxy(Object) */ public static boolean isCglibProxy(Object object) { - return ClassUtils.isCglibProxyClass(object.getClass()); + return isCglibProxyClass(object.getClass()); } /** diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/UndertowRequestUpgradeStrategy.java b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/UndertowRequestUpgradeStrategy.java index 3734d2e404..327df2f2c1 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/UndertowRequestUpgradeStrategy.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/UndertowRequestUpgradeStrategy.java @@ -60,21 +60,20 @@ import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; import org.springframework.web.socket.server.HandshakeFailureException; - /** - * RequestUpgradeStrategy for WildFly and its underlying Undertow web - * server. Also compatible with embedded Undertow usage. + * A WebSocket {@code RequestUpgradeStrategy} for WildFly and its underlying + * Undertow web server. Also compatible with embedded Undertow usage. * - *

Compatible with Undertow 1.0 to 1.3 and also 1.3.5+ - as included in - * WildFly 8.x, 9 and 10. + *

Designed for Undertow 1.3.5+ as of Spring Framework 4.3, with a fallback + * strategy for Undertow 1.0 to 1.3 - as included in WildFly 8.x, 9 and 10. * * @author Rossen Stoyanchev * @since 4.0.1 */ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrategy { - private static final boolean HAS_DO_UPGRADE = ClassUtils.hasMethod(ServerWebSocketContainer.class, - "doUpgrade", (Class[]) null); + private static final boolean HAS_DO_UPGRADE = ClassUtils.hasMethod(ServerWebSocketContainer.class, "doUpgrade", + HttpServletRequest.class, HttpServletResponse.class, ServerEndpointConfig.class, Map.class); private static final FallbackStrategy FALLBACK_STRATEGY = (HAS_DO_UPGRADE ? null : new FallbackStrategy()); @@ -108,8 +107,7 @@ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrat endpointConfig.setExtensions(selectedExtensions); try { - getContainer(servletRequest).doUpgrade(servletRequest, servletResponse, - endpointConfig, pathParams); + getContainer(servletRequest).doUpgrade(servletRequest, servletResponse, endpointConfig, pathParams); } catch (ServletException ex) { throw new HandshakeFailureException( @@ -121,8 +119,7 @@ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrat } } else { - FALLBACK_STRATEGY.upgradeInternal(request, response, selectedProtocol, - selectedExtensions, endpoint); + FALLBACK_STRATEGY.upgradeInternal(request, response, selectedProtocol, selectedExtensions, endpoint); } } @@ -195,10 +192,8 @@ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrat } } - private final Set peerConnections; - public FallbackStrategy() { if (exchangeConstructorWithPeerConnections) { this.peerConnections = Collections.newSetFromMap(new ConcurrentHashMap()); @@ -208,7 +203,6 @@ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrat } } - @Override public String[] getSupportedVersions() { return VERSIONS;