892d490466045604e2d086e50646cfdd3f7f0166
[JavaForFun] /
1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4   xmlns:context="http://www.springframework.org/schema/context"
5   xmlns:websocket="http://www.springframework.org/schema/websocket"
6
7   xsi:schemaLocation="http://www.springframework.org/schema/beans 
8                       http://www.springframework.org/schema/beans/spring-beans.xsd
9                       http://www.springframework.org/schema/context 
10                       http://www.springframework.org/schema/context/spring-context.xsd
11                       http://www.springframework.org/schema/websocket
12                                   http://www.springframework.org/schema/websocket/spring-websocket.xsd">
13
14     <!--
15         Searches for beans in packages (instead of XML configuration we can use
16         in this way annotations like @Service, @Endpoint, etc, etc)
17     -->
18     <context:component-scan base-package="de.spring.stomp"/>
19     
20     <!-- SockJS -->
21     <websocket:handlers allowed-origins="*">
22         <websocket:mapping path="/myHandler" handler="sockJsHandler"/>
23         <!-- Using SockJS protocol -->
24         <websocket:sockjs/>
25         <websocket:handshake-interceptors>
26             <bean class="org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor"/>
27         </websocket:handshake-interceptors>
28     </websocket:handlers>
29
30     <bean id="sockJsHandler" class="org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler"/>
31     
32     <bean class="org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean">
33         <property name="maxTextMessageBufferSize" value="8192"/>
34         <property name="maxBinaryMessageBufferSize" value="8192"/>
35     </bean>
36     
37     
38     <!-- STOMP -->
39     <websocket:message-broker application-destination-prefix="/app">
40         <websocket:stomp-endpoint path="/portfolio">
41             <websocket:sockjs/>
42         </websocket:stomp-endpoint>
43         <!-- Full-featured broker, see: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-handle-broker-relay -->
44         <websocket:stomp-broker-relay prefix="/topic,/queue" />
45     </websocket:message-broker>
46
47 </beans>