简体   繁体   English

Mule - 创建http多部分响应

[英]Mule - create http multipart response

how can I create a http/multipart response from a mule flow? 如何从骡子流创建http / multipart响应?

The outboundAttachments and outboundAttachmentFilenames are present and set but the received http response does not contain any attachment. outboundAttachments和outboundAttachmentFilenames存在并设置,但收到的http响应不包含任何附件。

I tried a custom java component which uses the provided jersey classes to build a multipart response, but i can't find a working transformer to a mule response. 我尝试了一个自定义的java组件,它使用提供的jersey类来构建一个多部分响应,但我找不到一个工作变换器来处理骡子。

@Override
public Object onCall(MuleEventContext eventContext) throws Exception {
    MultiPart multiPart = new MultiPart();

    MuleMessage message = eventContext.getMessage();

    for (String attachmentName : message.getOutboundAttachmentNames()) {

        multiPart.bodyPart(new BodyPart(message.getOutboundAttachment(attachmentName), MediaType.APPLICATION_OCTET_STREAM_TYPE));
    }

    Response response = Response.status(200).entity(multiPart).type(MultiPartMediaTypes.MULTIPART_MIXED).build();

    return response;
}

The error is 错误是

Could not find a transformer to transform "SimpleDataType{type=com.sun.jersey.core.spi.factory.ResponseImpl, mimeType='text/xml'}" to "SimpleDataType{type=org.mule.api.transport.OutputHandler, mimeType='*/*'}".

I'm using Mule 3.5.0 EE. 我正在使用Mule 3.5.0 EE。

Best regards, Marc 此致,Marc

This is a known issue that has been fixed in Mule 3.6.0. 这是已在Mule 3.6.0中修复的已知问题。

See: https://www.mulesoft.org/jira/browse/MULE-7885 请参阅: https//www.mulesoft.org/jira/browse/MULE-7885

Either upgrade or ask MuleSoft to provide a backported patch for 3.5.x EE. 升级或要求MuleSoft为3.5.x EE提供后端移植补丁。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM