开发者

Stream HTTP GET response to file in Mule

How do you make a HTTP GET request in Mule, and then stream the response to a file? My application stores the entire response in memory, but the response can be large, so this needs to be fixed. I want to save the response to a temporary file, and then stream the file contents back to the client.

Right now, I'm doing:

Stri开发者_如何学Cng restUrl = "http://www.url.com";
UMOEventContext context = RequestContext.getEventContext();
GetMethod method = new GetMethod(restUrl);          
UMOMessage muleMessage = new MuleMessage(method);
muleMessage.setProperty(RestServiceWrapper.REST_SERVICE_URL, restUrl);

UMOMessage result = context.sendEvent(muleMessage, new MuleEndpointURI("vm://identifier")); //OutOfMemoryException
String body = result.getPayloadAsString();

I'm using Mule 1.3.3 and cannot upgrade. Thank you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜