forked from membrane/api-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxies.xml
More file actions
60 lines (55 loc) · 2.52 KB
/
proxies.xml
File metadata and controls
60 lines (55 loc) · 2.52 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<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-4.2.xsd
http://membrane-soa.org/proxies/1/ http://membrane-soa.org/schemas/proxies-1.xsd">
<router>
<api port="2000">
<request>
<if test="request.isJSON()" language="SpEL">
<log message="JSON Request!"/>
<if test="$.name" language="jsonpath">
<log message="The JSON request contains the key 'name' with the value 'foo'."/>
</if>
</if>
<if test="method == 'POST'" language="SpEL">
<log message="Request method was POST."/>
</if>
<if test="params['param1'] == 'value2'" language="SpEL">
<log message="Query Parameter Given!"/>
</if>
<if test="headers['X-Test-Header'] != null and headers['X-Test-Header'] matches '.*bar.*'">
<log message="X-Test-Header contains 'bar'"/>
</if>
<if test="request.getBody.getLength gt 64">
<log message="Long body"/>
</if>
<if test="request.isXML()">
<log message="XML Request!"/>
<if test="//foo" language="xpath">
<log message="Has foo element!"/>
</if>
</if>
</request>
<response>
<if test="statusCode matches '[45]\d\d'">
<template pretty="yes" contentType="application/json">
{
"type": "https://membrane-api.io/error/",
"title": ${exc.response.statusMessage},
"status": ${exc.response.statusCode}
}
</template>
</if>
<if test="statusCode == 302">
<groovy>
println("Status code changed")
exc.getResponse().setStatusCode(404) // Changing it!
</groovy>
</if>
</response>
<template>Success</template>
<return statusCode="302"/>
</api>
</router>
</spring:beans>