Sync docs from master to gh-pages
This commit is contained in:
@@ -288,4 +288,38 @@ using something like <a class="link" href="http://projects.spring.io/spring-sess
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> - name</span>: RequestSize
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> args</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> maxSize</span>: <span class="hl-number">5000000</span></pre><p>
|
||||
</p><p>The RequestSize GatewayFilter Factory set the response status as <code class="literal">413 Payload Too Large</code> with a additional header <code class="literal">errorMessage</code> when the Request is rejected due to size. Following is an example of such an <code class="literal">errorMessage</code> .</p><p><code class="literal">errorMessage</code> : <code class="literal">Request size is larger than permissible limit. Request size is 6.0 MB where permissible limit is 5.0 MB</code></p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The default Request size will be set to 5 MB if not provided as filter argument in route definition.</p></td></tr></table></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_gateway-request-predicates-factories.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__global_filters.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4. Route Predicate Factories </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-gateway.html">Home</a></td><td width="40%" align="right" valign="top"> 6. Global Filters</td></tr></table></div></body></html>
|
||||
</p><p>The RequestSize GatewayFilter Factory set the response status as <code class="literal">413 Payload Too Large</code> with a additional header <code class="literal">errorMessage</code> when the Request is rejected due to size. Following is an example of such an <code class="literal">errorMessage</code> .</p><p><code class="literal">errorMessage</code> : <code class="literal">Request size is larger than permissible limit. Request size is 6.0 MB where permissible limit is 5.0 MB</code></p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The default Request size will be set to 5 MB if not provided as filter argument in route definition.</p></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_modify_request_body_gatewayfilter_factory" href="#_modify_request_body_gatewayfilter_factory"></a>5.23 Modify Request Body GatewayFilter Factory</h2></div></div></div><p><span class="strong"><strong>This filter is considered BETA and the API may change in the future</strong></span></p><p>This filter can be used to modify the request body before it is sent downstream by the Gateway.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>This filter can only be configured using the Java DSL</p></td></tr></table></div><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> RouteLocator routes(RouteLocatorBuilder builder) {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> builder.routes()
|
||||
.route(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"rewrite_request_obj"</span>, r -> r.host(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"*.rewriterequestobj.org"</span>)
|
||||
.filters(f -> f.prefixPath(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"/httpbin"</span>)
|
||||
.modifyRequestBody(String.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, Hello.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, MediaType.APPLICATION_JSON_VALUE,
|
||||
(exchange, s) -> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> Mono.just(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> Hello(s.toUpperCase())))).uri(uri))
|
||||
.build();
|
||||
}
|
||||
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Hello {
|
||||
String message;
|
||||
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> Hello() { }
|
||||
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> Hello(String message) {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.message = message;
|
||||
}
|
||||
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> String getMessage() {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> message;
|
||||
}
|
||||
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> setMessage(String message) {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.message = message;
|
||||
}
|
||||
}</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_modify_response_body_gatewayfilter_factory" href="#_modify_response_body_gatewayfilter_factory"></a>5.24 Modify Response Body GatewayFilter Factory</h2></div></div></div><p><span class="strong"><strong>This filter is considered BETA and the API may change in the future</strong></span></p><p>This filter can be used to modify the response body before it is sent back to the Client.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>This filter can only be configured using the Java DSL</p></td></tr></table></div><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> RouteLocator routes(RouteLocatorBuilder builder) {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> builder.routes()
|
||||
.route(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"rewrite_response_upper"</span>, r -> r.host(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"*.rewriteresponseupper.org"</span>)
|
||||
.filters(f -> f.prefixPath(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"/httpbin"</span>)
|
||||
.modifyResponseBody(String.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, String.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>,
|
||||
(exchange, s) -> Mono.just(s.toUpperCase()))).uri(uri)
|
||||
.build();
|
||||
}</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_gateway-request-predicates-factories.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__global_filters.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4. Route Predicate Factories </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-gateway.html">Home</a></td><td width="40%" align="right" valign="top"> 6. Global Filters</td></tr></table></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -972,6 +972,58 @@ using something like <link xl:href="http://projects.spring.io/spring-session/">S
|
||||
<simpara>The default Request size will be set to 5 MB if not provided as filter argument in route definition.</simpara>
|
||||
</note>
|
||||
</section>
|
||||
<section xml:id="_modify_request_body_gatewayfilter_factory">
|
||||
<title>Modify Request Body GatewayFilter Factory</title>
|
||||
<simpara><emphasis role="strong">This filter is considered BETA and the API may change in the future</emphasis></simpara>
|
||||
<simpara>This filter can be used to modify the request body before it is sent downstream by the Gateway.</simpara>
|
||||
<note>
|
||||
<simpara>This filter can only be configured using the Java DSL</simpara>
|
||||
</note>
|
||||
<programlisting language="java" linenumbering="unnumbered">@Bean
|
||||
public RouteLocator routes(RouteLocatorBuilder builder) {
|
||||
return builder.routes()
|
||||
.route("rewrite_request_obj", r -> r.host("*.rewriterequestobj.org")
|
||||
.filters(f -> f.prefixPath("/httpbin")
|
||||
.modifyRequestBody(String.class, Hello.class, MediaType.APPLICATION_JSON_VALUE,
|
||||
(exchange, s) -> return Mono.just(new Hello(s.toUpperCase())))).uri(uri))
|
||||
.build();
|
||||
}
|
||||
|
||||
static class Hello {
|
||||
String message;
|
||||
|
||||
public Hello() { }
|
||||
|
||||
public Hello(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}</programlisting>
|
||||
</section>
|
||||
<section xml:id="_modify_response_body_gatewayfilter_factory">
|
||||
<title>Modify Response Body GatewayFilter Factory</title>
|
||||
<simpara><emphasis role="strong">This filter is considered BETA and the API may change in the future</emphasis></simpara>
|
||||
<simpara>This filter can be used to modify the response body before it is sent back to the Client.</simpara>
|
||||
<note>
|
||||
<simpara>This filter can only be configured using the Java DSL</simpara>
|
||||
</note>
|
||||
<programlisting language="java" linenumbering="unnumbered">@Bean
|
||||
public RouteLocator routes(RouteLocatorBuilder builder) {
|
||||
return builder.routes()
|
||||
.route("rewrite_response_upper", r -> r.host("*.rewriteresponseupper.org")
|
||||
.filters(f -> f.prefixPath("/httpbin")
|
||||
.modifyResponseBody(String.class, String.class,
|
||||
(exchange, s) -> Mono.just(s.toUpperCase()))).uri(uri)
|
||||
.build();
|
||||
}</programlisting>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter xml:id="_global_filters">
|
||||
<title>Global Filters</title>
|
||||
|
||||
Reference in New Issue
Block a user