Skip to content

Commit 08b249c

Browse files
Improve documentation: Migrate XML snippets to yaml javadoc (#2768)
* Update LoadBalancingInterceptor documentation * Update SetCookiesInterceptor documentation with YAML example * Add YAML example to WSDLPublisherInterceptor documentation * Add YAML example to Cluster documentation * Add YAML example to BeautifierInterceptor documentation * Add YAML example to JavascriptInterceptor documentation
1 parent 8df454d commit 08b249c

6 files changed

Lines changed: 65 additions & 9 deletions

File tree

core/src/main/java/com/predic8/membrane/core/interceptor/balancer/Cluster.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424
/**
2525
* @description Represents a load-balancing cluster (a named group of {@link Node}s).
2626
* Provides status management (UP/DOWN/TAKEOUT), node lookup, and simple session tracking.
27+
* @yaml <pre><code>
28+
* balancer:
29+
* name: DemoBalancer
30+
* priorityStrategy: {}
31+
* clusters:
32+
* - name: PROD
33+
* nodes:
34+
* - host: node1.predic8.com
35+
* port: 8080
36+
* - host: node2.predic8.com
37+
* port: 8090
38+
* </code></pre>
2739
*/
2840
@MCElement(name="cluster", component =false)
2941
public class Cluster {

core/src/main/java/com/predic8/membrane/core/interceptor/balancer/LoadBalancingInterceptor.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@
4343
* name: DemoBalancer
4444
* priorityStrategy: {}
4545
* clusters:
46-
* - cluster:
47-
* name: PROD
48-
* nodes:
49-
* - node:
50-
* host: node1.predic8.com
51-
* port: 8080
52-
* - node:
53-
* host: node2.predic8.com
54-
* port: 8090
46+
* - name: PROD
47+
* nodes:
48+
* - host: node1.predic8.com
49+
* port: 8080
50+
* - host: node2.predic8.com
51+
* port: 8090
5552
* </code></pre>
5653
*/
5754
@MCElement(name = "balancer")

core/src/main/java/com/predic8/membrane/core/interceptor/beautifier/BeautifierInterceptor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929

3030
/**
3131
* @description Beautifies request and response bodies. Supported are the Formats: <b>JSON</b>, <b>JSON5</b>, <b>XML</b>, <b>TEXT</b>
32+
* @yaml <pre><code>
33+
* api:
34+
* port: 2000
35+
* flow:
36+
* - static:
37+
* contentType: application/json
38+
* src: <foo><bar>baz</bar></foo>
39+
* - beautifier: {}
40+
* - return: {}
41+
* </code></pre>
3242
* @topic 2. Enterprise Integration Patterns
3343
*/
3444
@MCElement(name = "beautifier")

core/src/main/java/com/predic8/membrane/core/interceptor/javascript/JavascriptInterceptor.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@
2727
/**
2828
* @description Executes a Javascript. The script can access and manipulate data from the request and response.
2929
* Use this or the Groovy plugin to extend the functions of Membrane by scripting. See the samples in examples/javascript.
30+
* @yaml <pre><code>
31+
* api:
32+
* port: 2000
33+
* flow:
34+
* - response:
35+
* - javascript:
36+
* src: |
37+
* var body = JSON.stringify({
38+
* foo: 7,
39+
* bar: 42
40+
* });
41+
*
42+
* Response.ok(body).contentType("application/json").build();
43+
* - return: {} # Do not forward, return immediately
44+
* </code></pre>
3045
* @topic 2. Enterprise Integration Patterns
3146
*/
3247
@MCElement(name = "javascript", mixed = true)

core/src/main/java/com/predic8/membrane/core/interceptor/lang/SetCookiesInterceptor.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
* @description Adds one or more Set-Cookie headers to the HTTP response for session handling, user preferences, or tracking purposes.
3333
* Supports computing expiry, setting standard attributes like Domain and Path, and building a compliant cookie string.
3434
* Useful for enriching responses with configurable cookies directly at gateway level without backend involvement.
35+
* @yaml <pre><code>
36+
* api:
37+
* port: 2000
38+
* flow:
39+
* - response:
40+
* - setCookies:
41+
* - name: SESSION
42+
* value: akj34
43+
* </code></pre>
3544
* @topic 6. Misc
3645
*/
3746
@MCElement(name = "setCookies", noEnvelope = true)

core/src/main/java/com/predic8/membrane/core/interceptor/server/WSDLPublisherInterceptor.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@
3737
* The <i>wsdlPublisher</i> serves WSDL files (and attached XML Schema Documents), if your
3838
* backend service does not already do so.
3939
* </p>
40+
* @yaml <pre><code>
41+
* api:
42+
* port: 2000
43+
* path:
44+
* uri: /material/*
45+
* flow:
46+
* - wsdlPublisher:
47+
* wsdl: /WEB-INF/wsdl/ArticleService.wsdl
48+
* - validator:
49+
* wsdl: /WEB-INF/wsdl/ArticleService.wsdl
50+
* target:
51+
* url: https://api.predic8.de
52+
* </code></pre>
4053
* @topic 5. Web Services with SOAP and WSDL
4154
*/
4255
@MCElement(name = "wsdlPublisher")

0 commit comments

Comments
 (0)