On Wed, Dec 7, 2011 at 4:22 PM, Claus Ibsen <claus.ib...@gmail.com> wrote: > On Wed, Dec 7, 2011 at 4:17 PM, Justin Rosenberg <rosenbe...@crlcorp.com> > wrote: >> I am receiving an e-mail with a PDF attachment, however the >> dh.getContentType() is returning [APPLICATION/OCTET-STREAM; name="file.pdf"] >> as opposed to the more preferable [application/pdf; name="file.pdf"]. >> >> I'm can get this to work by manually passing the filename to a >> MimetypesFileTypeMap instance or since I'm using Spring I will probably use >> org.springframework.mail.javamail.ConfigurableMimeFileTypeMap instead. >> >> Thanks for your dedication to this project. It's always nice to see a quick >> response on a usergroup forum! >> > > Thanks for sharing your use case. We could possible improve camel-mail > to use the custom ContentTypeResolver when receiving emails as well. > As its seems like a fast way to be in control of this. >
Just for the record. I logged a JIRA ticket https://issues.apache.org/jira/browse/CAMEL-4750 > > >> ~Justin >> >> >> -----Original Message----- >> From: Claus Ibsen [mailto:claus.ib...@gmail.com] >> Sent: Wednesday, December 07, 2011 12:58 AM >> To: users@camel.apache.org >> Subject: Re: Mail component ContentTypeResolver SPI customization >> >> Hi >> >> The ContentTypeResolver is used when *sending* emails. It was >> introduced to work around issues with the Geronimo Mail >> Implementation. >> 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 <rosenbe...@crlcorp.com> >> 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 >>> >>> >>> >>> >>> CONFIDENTIALITY NOTICE: >>> 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 >> ----------------- >> FuseSource >> Email: cib...@fusesource.com >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.blogspot.com/ >> Author of Camel in Action: http://www.manning.com/ibsen/ >> >> CONFIDENTIALITY NOTICE: >> 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 > ----------------- > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/