camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Mail component ContentTypeResolver SPI customization
Date Wed, 07 Dec 2011 06:58:11 GMT

The ContentTypeResolver is used when *sending* emails. It was
introduced to work around issues with  the Geronimo Mail
The SUN Mail Provider works fine, so the resolver shouldn't really be
needed anymore.

What's your use case to use the ContentTypeResolver ?

On Wed, Dec 7, 2011 at 2:46 AM, Justin Rosenberg <> wrote:
> I'm having trouble understanding how to use a custom ContentTypeResolver
> for the mail component using Spring.
> Here is my Spring XML:
> <camel:camelContext
> id="CamelContext-${project.artifactId}_${project.version}">
>  <camel:contextScan />
> </camel:camelContext>
> <bean id="mail" class="org.apache.camel.component.mail.MailComponent">
>  <property name="contentTypeResolver">
>    <bean class="com.crlcorp.oasis.routing.util.CRLContentTypeResolver"
> />
>  </property>
> </bean>
> I'm retrieving the attachment in the processor as follows:
> DataHandler dh =
> exchange.getIn().getAttachments().values().iterator().next();
> String contentType = dh.getContentType();
> For testing I have the ContentTypeResolver always return the same value.
> However, the value that gets returned by dh.getContentType() is
> "APPLICATION/OCTET-STREAM; name="file.pdf"
> Am I missing a step to get the CamelContext to recognize the customized
> MailComponent?  I have tried using the same Spring XML setting the value
> on the MailEndpoint as well.
> Application versions:
> Camel 2.7.0
> Spring 3.0.5.RELEASE
> Any help is appreciated.
> Cheers,
> ~Justin
> The information in this message, and any attachment, is intended for the
> sole use of the individual and entity to whom it is addressed. This
> information may be privileged, confidential, and protected from
> disclosure. If you are not the intended recipient you are hereby notified
> that you have received this communication in error and that any review,
> disclosure, dissemination, distribution or copying of it, or its contents,
> is strictly prohibited. If you think that you have received this message
> in error please notify the sender and destroy all copies of this
> communication and any attachments. Thank you.

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message