Java Code Examples for org.springframework.web.socket.handler.WebSocketHandlerDecoratorFactory

The following examples show how to use org.springframework.web.socket.handler.WebSocketHandlerDecoratorFactory. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public WebSocketHandler getObject() {
	WebSocketHandler result = this.handler;
	for (WebSocketHandlerDecoratorFactory factory : this.factories) {
		result = factory.decorate(result);
	}
	return result;
}
 
Example 2
@Override
protected void configureWebSocketTransport(WebSocketTransportRegistration registry) {
	registry.addDecoratorFactory(new WebSocketHandlerDecoratorFactory() {
		@Override
		public WebSocketHandlerDecorator decorate(WebSocketHandler handler) {
			return new WebSocketHandlerDecorator(handler) {
				@Override
				public void afterConnectionEstablished(WebSocketSession session) throws Exception {
					session.getAttributes().put("decorated", true);
					super.afterConnectionEstablished(session);
				}
			};
		}
	});
}
 
Example 3
@Override
public WebSocketHandler getObject() {
	WebSocketHandler result = this.handler;
	for (WebSocketHandlerDecoratorFactory factory : this.factories) {
		result = factory.decorate(result);
	}
	return result;
}
 
Example 4
@Override
protected void configureWebSocketTransport(WebSocketTransportRegistration registry) {
	registry.addDecoratorFactory(new WebSocketHandlerDecoratorFactory() {
		@Override
		public WebSocketHandlerDecorator decorate(WebSocketHandler handler) {
			return new WebSocketHandlerDecorator(handler) {
				@Override
				public void afterConnectionEstablished(WebSocketSession session) throws Exception {
					session.getAttributes().put("decorated", true);
					super.afterConnectionEstablished(session);
				}
			};
		}
	});
}
 
Example 5
@Override
public void configureWebSocketTransport(WebSocketTransportRegistration registration) {
    registration.addDecoratorFactory(new WebSocketHandlerDecoratorFactory() {
        @Override
        public WebSocketHandler decorate(WebSocketHandler handler) {
            ProxyWebSocketHandler proxyWebSocketHandler = new ProxyWebSocketHandler(
                    handler, stompClient, webSocketHttpHeadersCallback,
                    messagingTemplate,
                    proxyTargetResolver,
                    zuulWebSocketProperties);
            proxyWebSocketHandler.errorHandler(proxyWebSocketErrorHandler);
            return proxyWebSocketHandler;
        }
    });
}
 
Example 6
@Override
public WebSocketHandler getObject() throws Exception {
	WebSocketHandler result = this.handler;
	for (WebSocketHandlerDecoratorFactory factory : this.factories) {
		result = factory.decorate(result);
	}
	return result;
}
 
Example 7
@Override
protected void configureWebSocketTransport(WebSocketTransportRegistration registry) {
	registry.addDecoratorFactory(new WebSocketHandlerDecoratorFactory() {
		@Override
		public WebSocketHandlerDecorator decorate(WebSocketHandler handler) {
			return new WebSocketHandlerDecorator(handler) {
				@Override
				public void afterConnectionEstablished(WebSocketSession session) throws Exception {
					session.getAttributes().put("decorated", true);
					super.afterConnectionEstablished(session);
				}
			};
		}
	});
}
 
Example 8
protected List<WebSocketHandlerDecoratorFactory> getDecoratorFactories() {
	return this.decoratorFactories;
}
 
Example 9
protected WebSocketHandler decorateWebSocketHandler(WebSocketHandler handler) {
	for (WebSocketHandlerDecoratorFactory factory : getTransportRegistration().getDecoratorFactories()) {
		handler = factory.decorate(handler);
	}
	return handler;
}
 
Example 10
@SuppressWarnings("unused")
public DecoratingFactoryBean(WebSocketHandler handler, List<WebSocketHandlerDecoratorFactory> factories) {
	this.handler = handler;
	this.factories = factories;
}
 
Example 11
protected List<WebSocketHandlerDecoratorFactory> getDecoratorFactories() {
	return this.decoratorFactories;
}
 
Example 12
protected WebSocketHandler decorateWebSocketHandler(WebSocketHandler handler) {
	for (WebSocketHandlerDecoratorFactory factory : getTransportRegistration().getDecoratorFactories()) {
		handler = factory.decorate(handler);
	}
	return handler;
}
 
Example 13
@SuppressWarnings("unused")
public DecoratingFactoryBean(WebSocketHandler handler, List<WebSocketHandlerDecoratorFactory> factories) {
	this.handler = handler;
	this.factories = factories;
}
 
Example 14
protected List<WebSocketHandlerDecoratorFactory> getDecoratorFactories() {
	return this.decoratorFactories;
}
 
Example 15
protected WebSocketHandler decorateWebSocketHandler(WebSocketHandler handler) {
	for (WebSocketHandlerDecoratorFactory factory : getTransportRegistration().getDecoratorFactories()) {
		handler = factory.decorate(handler);
	}
	return handler;
}
 
Example 16
@SuppressWarnings("unused")
private DecoratingFactoryBean(WebSocketHandler handler, List<WebSocketHandlerDecoratorFactory> factories) {
	this.handler = handler;
	this.factories = factories;
}
 
Example 17
/**
 * Configure one or more factories to decorate the handler used to process
 * WebSocket messages. This may be useful in some advanced use cases, for
 * example to allow Spring Security to forcibly close the WebSocket session
 * when the corresponding HTTP session expires.
 * @since 4.1.2
 */
public WebSocketTransportRegistration setDecoratorFactories(WebSocketHandlerDecoratorFactory... factories) {
	if (factories != null) {
		this.decoratorFactories.addAll(Arrays.asList(factories));
	}
	return this;
}
 
Example 18
/**
 * Configure one or more factories to decorate the handler used to process
 * WebSocket messages. This may be useful in some advanced use cases, for
 * example to allow Spring Security to forcibly close the WebSocket session
 * when the corresponding HTTP session expires.
 * @since 4.1.2
 */
public WebSocketTransportRegistration setDecoratorFactories(WebSocketHandlerDecoratorFactory... factories) {
	this.decoratorFactories.addAll(Arrays.asList(factories));
	return this;
}
 
Example 19
/**
 * Add a factory that to decorate the handler used to process WebSocket
 * messages. This may be useful for some advanced use cases, for example
 * to allow Spring Security to forcibly close the WebSocket session when
 * the corresponding HTTP session expires.
 * @since 4.1.2
 */
public WebSocketTransportRegistration addDecoratorFactory(WebSocketHandlerDecoratorFactory factory) {
	this.decoratorFactories.add(factory);
	return this;
}
 
Example 20
/**
 * Configure one or more factories to decorate the handler used to process
 * WebSocket messages. This may be useful in some advanced use cases, for
 * example to allow Spring Security to forcibly close the WebSocket session
 * when the corresponding HTTP session expires.
 * @since 4.1.2
 */
public WebSocketTransportRegistration setDecoratorFactories(WebSocketHandlerDecoratorFactory... factories) {
	this.decoratorFactories.addAll(Arrays.asList(factories));
	return this;
}
 
Example 21
/**
 * Add a factory that to decorate the handler used to process WebSocket
 * messages. This may be useful for some advanced use cases, for example
 * to allow Spring Security to forcibly close the WebSocket session when
 * the corresponding HTTP session expires.
 * @since 4.1.2
 */
public WebSocketTransportRegistration addDecoratorFactory(WebSocketHandlerDecoratorFactory factory) {
	this.decoratorFactories.add(factory);
	return this;
}
 
Example 22
/**
 * Add a factory that to decorate the handler used to process WebSocket
 * messages. This may be useful for some advanced use cases, for example
 * to allow Spring Security to forcibly close the WebSocket session when
 * the corresponding HTTP session expires.
 * @since 4.1.2
 */
public WebSocketTransportRegistration addDecoratorFactory(WebSocketHandlerDecoratorFactory factory) {
	this.decoratorFactories.add(factory);
	return this;
}