public CorePackageScanClassResolver() { converters.add(ObjectConverter.class); converters.add(CollectionConverter.class); converters.add(DateTimeConverter.class); converters.add(SQLConverter.class); converters.add(IOConverter.class); converters.add(NIOConverter.class); converters.add(StaxConverter.class); converters.add(DomConverter.class); converters.add(StreamSourceConverter.class); converters.add(XmlConverter.class); converters.add(CamelConverter.class); converters.add(StreamCacheConverter.class); converters.add(TimePatternConverter.class); converters.add(FutureTypeConverter.class); converters.add(BeanConverter.class); converters.add(GenericFileConverter.class); converters.add(DurationConverter.class); }
private void setRecipientFromCamelMessage(MimeMessage mimeMessage, MailConfiguration configuration, Exchange exchange) throws MessagingException, IOException { for (Map.Entry<String, Object> entry : exchange.getIn().getHeaders().entrySet()) { String headerName = entry.getKey(); Object headerValue = entry.getValue(); if (headerValue != null && isRecipientHeader(headerName)) { // special handling of recipients if (ObjectConverter.isCollection(headerValue)) { Iterator<?> iter = ObjectHelper.createIterator(headerValue); while (iter.hasNext()) { Object recipient = iter.next(); appendRecipientToMimeMessage(mimeMessage, configuration, exchange, headerName, asString(exchange, recipient)); } } else { appendRecipientToMimeMessage(mimeMessage, configuration, exchange, headerName, asString(exchange, headerValue)); } } } }
/** * Appends the Mail headers from the Camel {@link MailMessage} */ protected void appendHeadersFromCamelMessage(MimeMessage mimeMessage, MailConfiguration configuration, Exchange exchange) throws MessagingException, IOException { for (Map.Entry<String, Object> entry : exchange.getIn().getHeaders().entrySet()) { String headerName = entry.getKey(); Object headerValue = entry.getValue(); if (headerValue != null) { if (headerFilterStrategy != null && !headerFilterStrategy.applyFilterToCamelHeaders(headerName, headerValue, exchange)) { if (headerName.equalsIgnoreCase("subject")) { mimeMessage.setSubject(asString(exchange, headerValue), determineCharSet(configuration, exchange)); continue; } if (headerName.equalsIgnoreCase("from")) { mimeMessage.setFrom(asEncodedInternetAddress(asString(exchange, headerValue), determineCharSet(configuration, exchange))); continue; } if (headerName.equalsIgnoreCase("sender")) { mimeMessage.setSender(asEncodedInternetAddress(asString(exchange, headerValue), determineCharSet(configuration, exchange))); continue; } if (isRecipientHeader(headerName)) { // skip any recipients as they are handled specially continue; } // alternative body should also be skipped if (headerName.equalsIgnoreCase(configuration.getAlternativeBodyHeader())) { // skip alternative body continue; } // Mail messages can repeat the same header... if (ObjectConverter.isCollection(headerValue)) { Iterator<?> iter = ObjectHelper.createIterator(headerValue); while (iter.hasNext()) { Object value = iter.next(); mimeMessage.addHeader(headerName, asString(exchange, value)); } } else { mimeMessage.setHeader(headerName, asString(exchange, headerValue)); } } } } }
@Converter public static char toChar(GString value) { return ObjectConverter.toChar(value.toString()); }
@Converter public static Integer toInteger(GString value) { return ObjectConverter.toInteger(value.toString()); }
@Converter public static Long toLong(GString value) { return ObjectConverter.toLong(value.toString()); }
@Converter public static Float toFloat(GString value) { return ObjectConverter.toFloat(value.toString()); }
@Converter public static Double toDouble(GString value) { return ObjectConverter.toDouble(value.toString()); }
@Converter public static Boolean toBoolean(GString value) { return ObjectConverter.toBoolean(value.toString()); }