Polishing

This commit is contained in:
Juergen Hoeller 2016-12-01 14:13:23 +01:00
parent f16d453805
commit 5fee5f39ea
14 changed files with 95 additions and 85 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,8 +30,8 @@ import org.springframework.util.StringUtils;
* Helper class for calculating property matches, according to a configurable * Helper class for calculating property matches, according to a configurable
* distance. Provide the list of potential matches and an easy way to generate * distance. Provide the list of potential matches and an easy way to generate
* an error message. Works for both java bean properties and fields. * an error message. Works for both java bean properties and fields.
* <p> *
* Mainly for use within the framework and in particular the binding facility * <p>Mainly for use within the framework and in particular the binding facility.
* *
* @author Alef Arendsen * @author Alef Arendsen
* @author Arjen Poutsma * @author Arjen Poutsma
@ -43,14 +43,12 @@ import org.springframework.util.StringUtils;
*/ */
public abstract class PropertyMatches { public abstract class PropertyMatches {
//---------------------------------------------------------------------
// Static section
//---------------------------------------------------------------------
/** Default maximum property distance: 2 */ /** Default maximum property distance: 2 */
public static final int DEFAULT_MAX_DISTANCE = 2; public static final int DEFAULT_MAX_DISTANCE = 2;
// Static factory methods
/** /**
* Create PropertyMatches for the given bean property. * Create PropertyMatches for the given bean property.
* @param propertyName the name of the property to find possible matches for * @param propertyName the name of the property to find possible matches for
@ -90,9 +88,7 @@ public abstract class PropertyMatches {
} }
//--------------------------------------------------------------------- // Instance state
// Instance section
//---------------------------------------------------------------------
private final String propertyName; private final String propertyName;
@ -107,18 +103,19 @@ public abstract class PropertyMatches {
this.possibleMatches = possibleMatches; this.possibleMatches = possibleMatches;
} }
/** /**
* Return the name of the requested property. * Return the name of the requested property.
*/ */
public String getPropertyName() { public String getPropertyName() {
return propertyName; return this.propertyName;
} }
/** /**
* Return the calculated possible matches. * Return the calculated possible matches.
*/ */
public String[] getPossibleMatches() { public String[] getPossibleMatches() {
return possibleMatches; return this.possibleMatches;
} }
/** /**
@ -127,6 +124,9 @@ public abstract class PropertyMatches {
*/ */
public abstract String buildErrorMessage(); public abstract String buildErrorMessage();
// Implementation support for subclasses
protected void appendHintMessage(StringBuilder msg) { protected void appendHintMessage(StringBuilder msg) {
msg.append("Did you mean "); msg.append("Did you mean ");
for (int i = 0; i < this.possibleMatches.length; i++) { for (int i = 0; i < this.possibleMatches.length; i++) {
@ -184,9 +184,12 @@ public abstract class PropertyMatches {
return d[s1.length()][s2.length()]; return d[s1.length()][s2.length()];
} }
// Concrete subclasses
private static class BeanPropertyMatches extends PropertyMatches { private static class BeanPropertyMatches extends PropertyMatches {
private BeanPropertyMatches(String propertyName, Class<?> beanClass, int maxDistance) { public BeanPropertyMatches(String propertyName, Class<?> beanClass, int maxDistance) {
super(propertyName, calculateMatches(propertyName, super(propertyName, calculateMatches(propertyName,
BeanUtils.getPropertyDescriptors(beanClass), maxDistance)); BeanUtils.getPropertyDescriptors(beanClass), maxDistance));
} }
@ -231,12 +234,12 @@ public abstract class PropertyMatches {
} }
return msg.toString(); return msg.toString();
} }
} }
private static class FieldPropertyMatches extends PropertyMatches { private static class FieldPropertyMatches extends PropertyMatches {
private FieldPropertyMatches(String propertyName, Class<?> beanClass, int maxDistance) { public FieldPropertyMatches(String propertyName, Class<?> beanClass, int maxDistance) {
super(propertyName, calculateMatches(propertyName, beanClass, maxDistance)); super(propertyName, calculateMatches(propertyName, beanClass, maxDistance));
} }
@ -255,7 +258,6 @@ public abstract class PropertyMatches {
return StringUtils.toStringArray(candidates); return StringUtils.toStringArray(candidates);
} }
@Override @Override
public String buildErrorMessage() { public String buildErrorMessage() {
String propertyName = getPropertyName(); String propertyName = getPropertyName();
@ -270,7 +272,6 @@ public abstract class PropertyMatches {
} }
return msg.toString(); return msg.toString();
} }
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,12 +27,12 @@ import org.springframework.core.convert.support.GenericConversionService;
/** /**
* A factory providing convenient access to a ConversionService configured with * A factory providing convenient access to a ConversionService configured with
* converters appropriate for most environments. Set the {@link #setConverters * converters appropriate for most environments. Set the
* "converters"} property to supplement the default converters. * {@link #setConverters "converters"} property to supplement the default converters.
* *
* <p>This implementation creates a {@link DefaultConversionService}. Subclasses * <p>This implementation creates a {@link DefaultConversionService}.
* may override {@link #createConversionService()} in order to return a * Subclasses may override {@link #createConversionService()} in order to return
* {@link GenericConversionService} instance of their choosing. * a {@link GenericConversionService} instance of their choosing.
* *
* <p>Like all {@code FactoryBean} implementations, this class is suitable for * <p>Like all {@code FactoryBean} implementations, this class is suitable for
* use when configuring a Spring application context using Spring {@code <beans>} * use when configuring a Spring application context using Spring {@code <beans>}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -49,7 +49,6 @@ import org.springframework.util.CollectionUtils;
* @author Rob Harrop * @author Rob Harrop
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 1.2 * @since 1.2
* @see FactoryBean
* @see JMXConnectorServer * @see JMXConnectorServer
* @see MBeanServer * @see MBeanServer
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -206,8 +206,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
@Override @Override
public void setBeanFactory(BeanFactory beanFactory) { public void setBeanFactory(BeanFactory beanFactory) {
if (!(beanFactory instanceof ConfigurableBeanFactory)) { if (!(beanFactory instanceof ConfigurableBeanFactory)) {
throw new IllegalStateException("ScriptFactoryPostProcessor doesn't work with a BeanFactory " throw new IllegalStateException("ScriptFactoryPostProcessor doesn't work with " +
+ "which does not implement ConfigurableBeanFactory: " + beanFactory.getClass()); "non-ConfigurableBeanFactory: " + beanFactory.getClass());
} }
this.beanFactory = (ConfigurableBeanFactory) beanFactory; this.beanFactory = (ConfigurableBeanFactory) beanFactory;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,13 +29,12 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/** /**
*
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
public class ExpressionCachingIntegrationTests { public class ExpressionCachingIntegrationTests {
@Test // SPR-11692
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test // SPR-11692
public void expressionIsCacheBasedOnActualMethod() { public void expressionIsCacheBasedOnActualMethod() {
ConfigurableApplicationContext context = ConfigurableApplicationContext context =
new AnnotationConfigApplicationContext(SharedConfig.class, Spr11692Config.class); new AnnotationConfigApplicationContext(SharedConfig.class, Spr11692Config.class);
@ -50,9 +49,9 @@ public class ExpressionCachingIntegrationTests {
} }
@Configuration @Configuration
static class Spr11692Config { static class Spr11692Config {
@Bean @Bean
public BaseDao<User> userDao() { public BaseDao<User> userDao() {
return new UserDaoImpl(); return new UserDaoImpl();
@ -65,11 +64,14 @@ public class ExpressionCachingIntegrationTests {
} }
private static interface BaseDao<T> { private interface BaseDao<T> {
T persist(T t); T persist(T t);
} }
private static class UserDaoImpl implements BaseDao<User> { private static class UserDaoImpl implements BaseDao<User> {
@Override @Override
@CachePut(value = "users", key = "#user.id") @CachePut(value = "users", key = "#user.id")
public User persist(User user) { public User persist(User user) {
@ -77,7 +79,9 @@ public class ExpressionCachingIntegrationTests {
} }
} }
private static class OrderDaoImpl implements BaseDao<Order> { private static class OrderDaoImpl implements BaseDao<Order> {
@Override @Override
@CachePut(value = "orders", key = "#order.id") @CachePut(value = "orders", key = "#order.id")
public Order persist(Order order) { public Order persist(Order order) {
@ -85,35 +89,41 @@ public class ExpressionCachingIntegrationTests {
} }
} }
private static class User { private static class User {
private final String id; private final String id;
private User(String id) { public User(String id) {
this.id = id; this.id = id;
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
public String getId() { public String getId() {
return id; return this.id;
} }
} }
private static class Order { private static class Order {
private final String id; private final String id;
private Order(String id) { public Order(String id) {
this.id = id; this.id = id;
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
public String getId() { public String getId() {
return id; return this.id;
} }
} }
@Configuration @Configuration
@EnableCaching @EnableCaching
static class SharedConfig extends CachingConfigurerSupport { static class SharedConfig extends CachingConfigurerSupport {
@Override @Override
@Bean @Bean
public CacheManager cacheManager() { public CacheManager cacheManager() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -72,7 +72,7 @@ public final class Property {
this.readMethod = readMethod; this.readMethod = readMethod;
this.writeMethod = writeMethod; this.writeMethod = writeMethod;
this.methodParameter = resolveMethodParameter(); this.methodParameter = resolveMethodParameter();
this.name = (name == null ? resolveName() : name); this.name = (name != null ? name : resolveName());
} }

View File

@ -32,6 +32,7 @@ abstract class ConversionUtils {
public static Object invokeConverter(GenericConverter converter, Object source, TypeDescriptor sourceType, public static Object invokeConverter(GenericConverter converter, Object source, TypeDescriptor sourceType,
TypeDescriptor targetType) { TypeDescriptor targetType) {
try { try {
return converter.convert(source, sourceType, targetType); return converter.convert(source, sourceType, targetType);
} }
@ -43,7 +44,9 @@ abstract class ConversionUtils {
} }
} }
public static boolean canConvertElements(TypeDescriptor sourceElementType, TypeDescriptor targetElementType, ConversionService conversionService) { public static boolean canConvertElements(TypeDescriptor sourceElementType, TypeDescriptor targetElementType,
ConversionService conversionService) {
if (targetElementType == null) { if (targetElementType == null) {
// yes // yes
return true; return true;
@ -57,11 +60,11 @@ abstract class ConversionUtils {
return true; return true;
} }
else if (sourceElementType.getType().isAssignableFrom(targetElementType.getType())) { else if (sourceElementType.getType().isAssignableFrom(targetElementType.getType())) {
// maybe; // maybe
return true; return true;
} }
else { else {
// no; // no
return false; return false;
} }
} }

View File

@ -67,8 +67,8 @@ public class GenericConversionService implements ConfigurableConversionService {
private static final GenericConverter NO_OP_CONVERTER = new NoOpConverter("NO_OP"); private static final GenericConverter NO_OP_CONVERTER = new NoOpConverter("NO_OP");
/** /**
* Used as a cache entry when no converter is available. This converter is never * Used as a cache entry when no converter is available.
* returned. * This converter is never returned.
*/ */
private static final GenericConverter NO_MATCH = new NoOpConverter("NO_MATCH"); private static final GenericConverter NO_MATCH = new NoOpConverter("NO_MATCH");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -151,8 +151,7 @@ public class SimpleClientHttpRequestFactory implements ClientHttpRequestFactory,
*/ */
@Override @Override
public AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod) throws IOException { public AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod) throws IOException {
Assert.state(this.taskExecutor != null, Assert.state(this.taskExecutor != null, "Asynchronous execution requires TaskExecutor to be set");
"Asynchronous execution requires an AsyncTaskExecutor to be set");
HttpURLConnection connection = openConnection(uri.toURL(), this.proxy); HttpURLConnection connection = openConnection(uri.toURL(), this.proxy);
prepareConnection(connection, httpMethod.name()); prepareConnection(connection, httpMethod.name());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -44,14 +44,14 @@ import org.springframework.util.Assert;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class UriTemplate implements Serializable { public class UriTemplate implements Serializable {
private final String uriTemplate;
private final UriComponents uriComponents; private final UriComponents uriComponents;
private final List<String> variableNames; private final List<String> variableNames;
private final Pattern matchPattern; private final Pattern matchPattern;
private final String uriTemplate;
/** /**
* Construct a new {@code UriTemplate} with the given URI String. * Construct a new {@code UriTemplate} with the given URI String.
@ -173,7 +173,6 @@ public class UriTemplate implements Serializable {
private final Pattern pattern; private final Pattern pattern;
private TemplateInfo(List<String> vars, Pattern pattern) { private TemplateInfo(List<String> vars, Pattern pattern) {
this.variableNames = vars; this.variableNames = vars;
this.pattern = pattern; this.pattern = pattern;
@ -187,7 +186,7 @@ public class UriTemplate implements Serializable {
return this.pattern; return this.pattern;
} }
private static TemplateInfo parse(String uriTemplate) { public static TemplateInfo parse(String uriTemplate) {
int level = 0; int level = 0;
List<String> variableNames = new ArrayList<String>(); List<String> variableNames = new ArrayList<String>();
StringBuilder pattern = new StringBuilder(); StringBuilder pattern = new StringBuilder();
@ -216,8 +215,7 @@ public class UriTemplate implements Serializable {
else { else {
if (idx + 1 == variable.length()) { if (idx + 1 == variable.length()) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"No custom regular expression specified after ':' " + "No custom regular expression specified after ':' in \"" + variable + "\"");
"in \"" + variable + "\"");
} }
String regex = variable.substring(idx + 1, variable.length()); String regex = variable.substring(idx + 1, variable.length());
pattern.append('('); pattern.append('(');
@ -238,7 +236,7 @@ public class UriTemplate implements Serializable {
} }
private static String quote(StringBuilder builder) { private static String quote(StringBuilder builder) {
return builder.length() != 0 ? Pattern.quote(builder.toString()) : ""; return (builder.length() > 0 ? Pattern.quote(builder.toString()) : "");
} }
} }

View File

@ -119,7 +119,6 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa
assertNull("Invalid content", entity.getBody()); assertNull("Invalid content", entity.getBody());
} }
@Test @Test
public void getNoContentTypeHeader() throws Exception { public void getNoContentTypeHeader() throws Exception {
Future<ResponseEntity<byte[]>> futureEntity = template.getForEntity(baseUrl + "/get/nocontenttype", byte[].class); Future<ResponseEntity<byte[]>> futureEntity = template.getForEntity(baseUrl + "/get/nocontenttype", byte[].class);
@ -127,7 +126,6 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa
assertArrayEquals("Invalid content", helloWorld.getBytes("UTF-8"), responseEntity.getBody()); assertArrayEquals("Invalid content", helloWorld.getBytes("UTF-8"), responseEntity.getBody());
} }
@Test @Test
public void getNoContent() throws Exception { public void getNoContent() throws Exception {
Future<ResponseEntity<String>> responseFuture = template.getForEntity(baseUrl + "/status/nocontent", String.class); Future<ResponseEntity<String>> responseFuture = template.getForEntity(baseUrl + "/status/nocontent", String.class);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -86,7 +86,8 @@ import org.springframework.web.context.support.ServletContextResource;
* @see #setDefaultUrl * @see #setDefaultUrl
* @see #setAllowedResources * @see #setAllowedResources
* @see #setApplyLastModified * @see #setApplyLastModified
* @deprecated in favor of the ResourceHttpRequestHandler * @deprecated as of Spring 4.3.5, in favor of
* {@link org.springframework.web.servlet.resource.ResourceHttpRequestHandler}
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
@Deprecated @Deprecated
@ -177,8 +178,8 @@ public class ResourceServlet extends HttpServletBean {
} }
/** /**
* Return a PathMatcher to use for matching the "allowedResources" URL pattern. * Return a {@link PathMatcher} to use for matching the "allowedResources" URL pattern.
* Default is AntPathMatcher. * <p>The default is {@link AntPathMatcher}.
* @see #setAllowedResources * @see #setAllowedResources
* @see org.springframework.util.AntPathMatcher * @see org.springframework.util.AntPathMatcher
*/ */
@ -193,9 +194,9 @@ public class ResourceServlet extends HttpServletBean {
*/ */
@Override @Override
protected final void doGet(HttpServletRequest request, HttpServletResponse response) protected final void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { throws ServletException, IOException {
// determine URL of resource to include // Determine URL of resource to include...
String resourceUrl = determineResourceUrl(request); String resourceUrl = determineResourceUrl(request);
if (resourceUrl != null) { if (resourceUrl != null) {
@ -222,7 +223,7 @@ public class ResourceServlet extends HttpServletBean {
} }
} }
// no resource URL specified -> try to include default URL. // No resource URL specified -> try to include default URL.
else if (!includeDefaultUrl(request, response)) { else if (!includeDefaultUrl(request, response)) {
throw new ServletException("No target resource URL found for request"); throw new ServletException("No target resource URL found for request");
} }
@ -267,23 +268,23 @@ public class ResourceServlet extends HttpServletBean {
* @throws IOException if thrown by the RequestDispatcher * @throws IOException if thrown by the RequestDispatcher
*/ */
private void doInclude(HttpServletRequest request, HttpServletResponse response, String resourceUrl) private void doInclude(HttpServletRequest request, HttpServletResponse response, String resourceUrl)
throws ServletException, IOException { throws ServletException, IOException {
if (this.contentType != null) { if (this.contentType != null) {
response.setContentType(this.contentType); response.setContentType(this.contentType);
} }
String[] resourceUrls =
StringUtils.tokenizeToStringArray(resourceUrl, RESOURCE_URL_DELIMITERS); String[] resourceUrls = StringUtils.tokenizeToStringArray(resourceUrl, RESOURCE_URL_DELIMITERS);
for (int i = 0; i < resourceUrls.length; i++) { for (String url : resourceUrls) {
// check whether URL matches allowed resources // Check whether URL matches allowed resources
if (this.allowedResources != null && !this.pathMatcher.match(this.allowedResources, resourceUrls[i])) { if (this.allowedResources != null && !this.pathMatcher.match(this.allowedResources, url)) {
throw new ServletException("Resource [" + resourceUrls[i] + throw new ServletException("Resource [" + url +
"] does not match allowed pattern [" + this.allowedResources + "]"); "] does not match allowed pattern [" + this.allowedResources + "]");
} }
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Including resource [" + resourceUrls[i] + "]"); logger.debug("Including resource [" + url + "]");
} }
RequestDispatcher rd = request.getRequestDispatcher(resourceUrls[i]); RequestDispatcher rd = request.getRequestDispatcher(url);
rd.include(request, response); rd.include(request, response);
} }
} }
@ -311,8 +312,8 @@ public class ResourceServlet extends HttpServletBean {
if (resourceUrl != null) { if (resourceUrl != null) {
String[] resourceUrls = StringUtils.tokenizeToStringArray(resourceUrl, RESOURCE_URL_DELIMITERS); String[] resourceUrls = StringUtils.tokenizeToStringArray(resourceUrl, RESOURCE_URL_DELIMITERS);
long latestTimestamp = -1; long latestTimestamp = -1;
for (int i = 0; i < resourceUrls.length; i++) { for (String url : resourceUrls) {
long timestamp = getFileTimestamp(resourceUrls[i]); long timestamp = getFileTimestamp(url);
if (timestamp > latestTimestamp) { if (timestamp > latestTimestamp) {
latestTimestamp = timestamp; latestTimestamp = timestamp;
} }
@ -338,8 +339,10 @@ public class ResourceServlet extends HttpServletBean {
return lastModifiedTime; return lastModifiedTime;
} }
catch (IOException ex) { catch (IOException ex) {
logger.warn("Couldn't retrieve last-modified timestamp of [" + resource + if (logger.isWarnEnabled()) {
"] - using ResourceServlet startup time"); logger.warn("Couldn't retrieve last-modified timestamp of " + resource +
" - using ResourceServlet startup time");
}
return -1; return -1;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -25,11 +25,10 @@ package org.springframework.web.socket;
public interface WebSocketMessage<T> { public interface WebSocketMessage<T> {
/** /**
* Returns the message payload. This will never be {@code null}. * Return the message payload (never {@code null}).
*/ */
T getPayload(); T getPayload();
/** /**
* Return the number of bytes contained in the message. * Return the number of bytes contained in the message.
*/ */

View File

@ -80,10 +80,10 @@ public abstract class AbstractSockJsSession implements SockJsSession {
private static final Set<String> disconnectedClientExceptions; private static final Set<String> disconnectedClientExceptions;
static { static {
Set<String> set = new HashSet<String>(2); Set<String> set = new HashSet<String>(4);
set.add("ClientAbortException"); // Tomcat set.add("ClientAbortException"); // Tomcat
set.add("EOFException"); // Tomcat set.add("EOFException"); // Tomcat
set.add("EofException"); // Jetty set.add("EofException"); // Jetty
// java.io.IOException "Broken pipe" on WildFly, Glassfish (already covered) // java.io.IOException "Broken pipe" on WildFly, Glassfish (already covered)
disconnectedClientExceptions = Collections.unmodifiableSet(set); disconnectedClientExceptions = Collections.unmodifiableSet(set);
} }
@ -208,7 +208,7 @@ public abstract class AbstractSockJsSession implements SockJsSession {
writeFrameInternal(SockJsFrame.closeFrame(status.getCode(), status.getReason())); writeFrameInternal(SockJsFrame.closeFrame(status.getCode(), status.getReason()));
} }
catch (Throwable ex) { catch (Throwable ex) {
logger.debug("Failure while send SockJS close frame", ex); logger.debug("Failure while sending SockJS close frame", ex);
} }
} }
updateLastActiveTime(); updateLastActiveTime();