INT-2455: Support HTTP Outbound 'encode-uri' Flag
The `<http:outbound-channel-adapter>` and `<http:outbound-gateway>` now provide an `encode-uri` option that controls whether the request uri is encoded (default `true`). It can be useful in some scenarios with a non standard URL, e.g. RabbitMQ REST API: 'http://foo.RabbitMQ.com/api/queues/%2f/bar.queue' where we must not encode the '%'. https://jira.springsource.org/browse/INT-2455 INT-2455: Polishing based on PR comments INT-2455: 'encode-uri' in the Reference Manual
This commit is contained in:
committed by
Gary Russell
parent
ab9b6fb1dd
commit
bb77f508ec
@@ -376,7 +376,7 @@ In the case of the Outbound Gateway, the reply message produced by the gateway w
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<emphasis>Mapping URI variables</emphasis>
|
||||
<emphasis>Mapping URI Variables</emphasis>
|
||||
</para>
|
||||
<para>
|
||||
If your URL contains URI variables, you can map them using the
|
||||
@@ -402,6 +402,24 @@ In the case of the Outbound Gateway, the reply message produced by the gateway w
|
||||
method will be invoked on the payload object of the Message and the result
|
||||
of that method will be used as the value for the URI variable named 'zipCode'.
|
||||
</para>
|
||||
<para>
|
||||
<emphasis>Controlling URI Encoding</emphasis>
|
||||
</para>
|
||||
<para>
|
||||
By default, the URL string is encoded (see
|
||||
<ulink url="http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/web/util/UriComponentsBuilder.html">UriComponentsBuilder</ulink>)
|
||||
to the URI object before sending the request. In some scenarios with a non-standard URI (e.g. the RabbitMQ Rest API) it is
|
||||
undesirable to perform the encoding. The <code><http:outbound-gateway/></code>
|
||||
and <code><http:outbound-channel-adapter/></code> provide an <code>encode-uri</code> attribute.
|
||||
To disable encoding the URL, this attribute should be set to <code>false</code> (by default it is <code>true</code>).
|
||||
If you wish to partially encode some of the URL, this can be achieved using an <code>expression</code> within a
|
||||
<code><uri-variable/></code>:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[<http:outbound-gateway url="http://somehost/%2f/fooApps?bar={param}" encode-uri="false">
|
||||
<http:uri-variable name="param"
|
||||
expression="T(org.apache.commons.httpclient.util.URIUtil)
|
||||
.encodeWithinQuery('Hellow World!')"/>
|
||||
</http:outbound-gateway>]]></programlisting>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
@@ -136,5 +136,14 @@
|
||||
see 'JSON Transformers' in <xref linkend="transformer"/>.
|
||||
</para>
|
||||
</section>
|
||||
<section id="3.0-http-encode-uri">
|
||||
<title>HTTP Outbound Endpoint 'encode-uri' property</title>
|
||||
<para>
|
||||
<code><http:outbound-gateway/></code> and <code><http:outbound-channel-adapter/></code> now
|
||||
provide an <code>encode-uri</code> attribute to allow disabling the encoding of the URI object
|
||||
before sending the request. For more information see <xref linkend="http"/>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
Reference in New Issue
Block a user