if (!endpoint.isIgnoreFileNameHeader()) {
name = message.getHeader(FileComponent.HEADER_FILE_NAME, String.class);
}
// expression support
Expression expression = endpoint.getExpression();
if (name != null) {
// the header name can be an expression too, that should override whatever configured on the endpoint
if (name.indexOf("${") > -1) {
if (LOG.isDebugEnabled()) {
LOG.debug(FileComponent.HEADER_FILE_NAME + " contains a FileLanguage expression: " + name);
}
expression = FileLanguage.file(name);
}
}
if (expression != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Filename evaluated as expression: " + expression);
}
Object result = expression.evaluate(message.getExchange());
name = message.getExchange().getContext().getTypeConverter().convertTo(String.class, result);
}
File endpointFile = endpoint.getFile();
if (endpointFile.isDirectory()) {