FWIW, it just took a couple lines to hack SftpOperations.storeFile to have this
behavior. Not sure this is the right place for it though. Shall I submit an
official patch?
@@ -493,6 +493,10 @@ public class SftpOperations implements
RemoteFileOperations<ChannelSftp.LsEntry>
InputStream is = null;
try {
+ //interpret null body as request to delete teh file.
+ if (exchange.getIn().getBody() == null) {
+ return deleteFile(name);
+ }
is = ExchangeHelper.getMandatoryInBody(exchange,
InputStream.class);
if (endpoint.getFileExist() == GenericFileExist.Append) {
channel.put(is, name, ChannelSftp.APPEND);
On Sep 2, 2010, at 4:05 PM, Lorrin Nelson wrote:
> Is this possible? I don't see anything indicating how in the docs.
>
> I wonder if would be easy to interpret a null message body as a request to
> delete the target file?
>
> Right now a null body results in:
> org.apache.camel.InvalidPayloadException: No body available of type:
> java.io.InputStream on: Message: [Body is null].
> Caused by: No type converter available to convert from type: null to the
> required type: java.io.InputStream with value null. Exchange[Message: [Body
> is null]].
> Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type
> converter available to convert from type: null to the required type:
> java.io.InputStream with value null]
>
> -Lorrin