Polishing

This commit is contained in:
Juergen Hoeller
2014-10-20 17:42:18 +02:00
parent 10328f1c22
commit 77a62ec8b8
4 changed files with 73 additions and 102 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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,23 +26,24 @@ import org.springframework.util.Assert;
import org.springframework.web.context.ServletContextAware;
/**
* A FactoryBean for configuring {@link javax.websocket.server.ServerContainer}. Since
* there is only one {@code ServerContainer} instance accessible under a well-known
* {@code javax.servlet.ServletContext} attribute, simply declaring this FactoryBean and
* using its setters allows configuring the {@code ServerContainer} through Spring
* configuration.
* A {@link FactoryBean} for configuring {@link javax.websocket.server.ServerContainer}.
* Since there is usually only one {@code ServerContainer} instance accessible under a
* well-known {@code javax.servlet.ServletContext} attribute, simply declaring this
* FactoryBean and using its setters allows for configuring the {@code ServerContainer}
* through Spring configuration.
*
* <p>This is useful even if the {@code ServerContainer} is not injected into any other
* bean. For example, an application can configure a {@link org.springframework.web.socket.server.support.DefaultHandshakeHandler}, a
* {@link org.springframework.web.socket.sockjs.SockJsService}, or {@link ServerEndpointExporter},
* and separately declare this FactoryBean in order to customize the properties of the
* (one and only) {@code ServerContainer} instance.
* bean within the Spring application context. For example, an application can configure
* a {@link org.springframework.web.socket.server.support.DefaultHandshakeHandler},
* a {@link org.springframework.web.socket.sockjs.SockJsService}, or
* {@link ServerEndpointExporter}, and separately declare this FactoryBean in order
* to customize the properties of the (one and only) {@code ServerContainer} instance.
*
* @author Rossen Stoyanchev
* @since 4.0
*/
public class ServletServerContainerFactoryBean
implements FactoryBean<WebSocketContainer>, InitializingBean, ServletContextAware {
implements FactoryBean<WebSocketContainer>, ServletContextAware, InitializingBean {
private Long asyncSendTimeout;
@@ -120,7 +121,7 @@ public class ServletServerContainerFactoryBean
@Override
public Class<?> getObjectType() {
return ServerContainer.class;
return (this.serverContainer != null ? this.serverContainer.getClass() : ServerContainer.class);
}
@Override