-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathproxies.xml
More file actions
44 lines (38 loc) · 1.74 KB
/
proxies.xml
File metadata and controls
44 lines (38 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<spring:beans xmlns="http://membrane-soa.org/proxies/1/"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://membrane-soa.org/proxies/1/ http://membrane-soa.org/schemas/proxies-1.xsd">
<router>
<serviceProxy port="9998">
<!-- Membrane does not support WebSocket Extensions for now, so we remove the header -->
<groovy>
if(exc.getRequest() != null)
exc.getRequest().getHeader().removeFields("Sec-WebSocket-Extensions");
if(exc.getResponse() != null)
exc.getResponse().getHeader().removeFields("Sec-WebSocket-Extensions");
</groovy>
<!-- WebSocket intercepting starts here -->
<webSocket url="http://localhost:61614/">
<!-- the wsStompReassembler take a STOMP over WebSocket frame and constructs an exchange from it -->
<wsStompReassembler>
<!-- modify the exchange to have a "[MEMBRANE]:" prefix -->
<groovy>
def method = exc.getRequest().getMethod();
def header = exc.getRequest().getHeader();
def body = exc.getRequest().getBodyAsStringDecoded();
if(exc.getRequest().getMethod() == "SEND")
body = "[MEMBRANE]: " + exc.getRequest().getBodyAsStringDecoded();
exc.setRequest(new Request.Builder().method(method).header(header).body(body).build());
</groovy>
</wsStompReassembler>
<!-- logs the content of a WebSocket frame to the console -->
<wsLog/>
</webSocket>
<target host="localhost" port="9999"/>
</serviceProxy>
<serviceProxy port="9999">
<webServer docBase="." index="index.html" />
</serviceProxy>
</router>
</spring:beans>