O'Reilly logo

Mastering Spring Application Development by Anjana Mankale

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending multipart HTTP requests using Spring's RestTemplate

Most of the time, we have implemented file upload functionality in our application. Files are sent over HTTP as a multipart request.

In this section, let us see how we can configure the inbound channel adapter using RestTemplate to send a file over HTTP request.

Let us configure the server with the inbound channel adapter and then write a client for it:

<int-http:inbound-channel-adapter id="httpInboundAdapter" channel="receiveChannel" name="/inboundAdapter.htm" supported-methods="GET, POST"/> <int:channel id="receiveChannel"/> <int:service-activator input-channel="receiveChannel"> <bean class="org.springframework.integration.samples.multipart.MultipartReceiver"/> </int:service-activator> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required