Polishing
This commit is contained in:
@@ -1176,7 +1176,6 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
@SuppressWarnings({"rawtypes", "deprecation"})
|
||||
private static org.hibernate.Query queryObject(@Nullable Object result) {
|
||||
@@ -1228,12 +1227,12 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean
|
||||
|
||||
// If return value is a Query or Criteria, apply transaction timeout.
|
||||
// Applies to createQuery, getNamedQuery, createCriteria.
|
||||
if (retVal instanceof org.hibernate.Query) {
|
||||
prepareQuery(((org.hibernate.Query) retVal));
|
||||
}
|
||||
else if (retVal instanceof Criteria) {
|
||||
if (retVal instanceof Criteria) {
|
||||
prepareCriteria(((Criteria) retVal));
|
||||
}
|
||||
else if (retVal instanceof org.hibernate.Query) {
|
||||
prepareQuery(((org.hibernate.Query) retVal));
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -36,7 +36,7 @@ import org.springframework.web.socket.handler.BeanCreatingHandlerProvider;
|
||||
|
||||
/**
|
||||
* An implementation of {@link javax.websocket.server.ServerEndpointConfig} for use in
|
||||
* Spring applications. A {@link ServerEndpointRegistration} bean is detected by
|
||||
* Spring-based applications. A {@link ServerEndpointRegistration} bean is detected by
|
||||
* {@link ServerEndpointExporter} and registered with a Java WebSocket runtime at startup.
|
||||
*
|
||||
* <p>Class constructors accept a singleton {@link javax.websocket.Endpoint} instance
|
||||
@@ -45,11 +45,12 @@ import org.springframework.web.socket.handler.BeanCreatingHandlerProvider;
|
||||
* each client WebSocket connection.
|
||||
*
|
||||
* <p>This class also extends
|
||||
* {@link javax.websocket.server.ServerEndpointConfig.Configurator} to make it easier to
|
||||
* override methods for customizing the handshake process.
|
||||
* {@link javax.websocket.server.ServerEndpointConfig.Configurator} to make it easier
|
||||
* to override methods for customizing the handshake process.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.0
|
||||
* @see ServerEndpointExporter
|
||||
*/
|
||||
public class ServerEndpointRegistration extends ServerEndpointConfig.Configurator
|
||||
@@ -63,15 +64,15 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
|
||||
@Nullable
|
||||
private final BeanCreatingHandlerProvider<Endpoint> endpointProvider;
|
||||
|
||||
private List<Class<? extends Encoder>> encoders = new ArrayList<>();
|
||||
private List<String> subprotocols = new ArrayList<>(0);
|
||||
|
||||
private List<Class<? extends Decoder>> decoders = new ArrayList<>();
|
||||
private List<Extension> extensions = new ArrayList<>(0);
|
||||
|
||||
private List<String> protocols = new ArrayList<>();
|
||||
private List<Class<? extends Encoder>> encoders = new ArrayList<>(0);
|
||||
|
||||
private List<Extension> extensions = new ArrayList<>();
|
||||
private List<Class<? extends Decoder>> decoders = new ArrayList<>(0);
|
||||
|
||||
private final Map<String, Object> userProperties = new HashMap<>();
|
||||
private final Map<String, Object> userProperties = new HashMap<>(4);
|
||||
|
||||
|
||||
/**
|
||||
@@ -81,8 +82,8 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
|
||||
* @param endpoint the endpoint instance
|
||||
*/
|
||||
public ServerEndpointRegistration(String path, Endpoint endpoint) {
|
||||
Assert.hasText(path, "path must not be empty");
|
||||
Assert.notNull(endpoint, "endpoint must not be null");
|
||||
Assert.hasText(path, "Path must not be empty");
|
||||
Assert.notNull(endpoint, "Endpoint must not be null");
|
||||
this.path = path;
|
||||
this.endpoint = endpoint;
|
||||
this.endpointProvider = null;
|
||||
@@ -95,14 +96,16 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
|
||||
* @param endpointClass the endpoint class
|
||||
*/
|
||||
public ServerEndpointRegistration(String path, Class<? extends Endpoint> endpointClass) {
|
||||
Assert.hasText(path, "path must not be empty");
|
||||
Assert.notNull(endpointClass, "endpointClass must not be null");
|
||||
Assert.hasText(path, "Path must not be empty");
|
||||
Assert.notNull(endpointClass, "Endpoint Class must not be null");
|
||||
this.path = path;
|
||||
this.endpoint = null;
|
||||
this.endpointProvider = new BeanCreatingHandlerProvider<>(endpointClass);
|
||||
}
|
||||
|
||||
|
||||
// ServerEndpointConfig implementation
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
@@ -129,13 +132,13 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
|
||||
}
|
||||
}
|
||||
|
||||
public void setSubprotocols(List<String> protocols) {
|
||||
this.protocols = protocols;
|
||||
public void setSubprotocols(List<String> subprotocols) {
|
||||
this.subprotocols = subprotocols;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSubprotocols() {
|
||||
return this.protocols;
|
||||
return this.subprotocols;
|
||||
}
|
||||
|
||||
public void setExtensions(List<Extension> extensions) {
|
||||
@@ -147,16 +150,6 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
|
||||
return this.extensions;
|
||||
}
|
||||
|
||||
public void setUserProperties(Map<String, Object> userProperties) {
|
||||
this.userProperties.clear();
|
||||
this.userProperties.putAll(userProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getUserProperties() {
|
||||
return this.userProperties;
|
||||
}
|
||||
|
||||
public void setEncoders(List<Class<? extends Encoder>> encoders) {
|
||||
this.encoders = encoders;
|
||||
}
|
||||
@@ -175,20 +168,23 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
|
||||
return this.decoders;
|
||||
}
|
||||
|
||||
public void setUserProperties(Map<String, Object> userProperties) {
|
||||
this.userProperties.clear();
|
||||
this.userProperties.putAll(userProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getUserProperties() {
|
||||
return this.userProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configurator getConfigurator() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
if (this.endpointProvider != null) {
|
||||
this.endpointProvider.setBeanFactory(beanFactory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Implementations of ServerEndpointConfig.Configurator
|
||||
// ServerEndpointConfig.Configurator implementation
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@@ -201,8 +197,19 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
|
||||
super.modifyHandshake(this, request, response);
|
||||
}
|
||||
|
||||
|
||||
// Remaining methods
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
if (this.endpointProvider != null) {
|
||||
this.endpointProvider.setBeanFactory(beanFactory);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerEndpointRegistration for path '" + getPath() + "': " + getEndpointClass();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user