Interesting - looks like they are abusing the ls command to be interpreted as some session control.
Even if the gateway supported put, it wouldn't really be satisfactory because, even if you use cached sessions, there is no guarantee that each command would run on the same session. If you don't use cached sessions, each command would run in its own session, which wouldn't work anyway.
We don't support the kind of user-managed session life cycle that you need for this.
Probably the easiest way to get around this would be to implement a custom SessionFactory - simply subclass the DefaultSessionFactory, override the getSession() method, call super().getSession(), then issue your two ls commands (call list(path)) before returning the session to the client (the outbound adapter).
This assumes that the following command line sequence would work...
sftp username@server
ls /+recfm=FB
ls /+lrecl=128
put //directory/path/filename
(session doesn't support a cd command).
You would probably not want to cache-sessions in this case because the next user would inherit these settings.
Gary P. Russell
Spring Integration Team
SpringSource, a division of VMware