A servlet container that uses SFTP instead of HTTP as its access protocol.
The SFTP Servlet Container presents filesystem view of a Java EE web application via the SFTP/SCP protocol.
It behaves in two different ways, depending on if the deployed web application supports the HTTP WebDAV extensions.
If the web application does not support WebDAV extensions (this is typical):
SFTP command | Servlet request method |
---|---|
get | GET |
put | PUT |
rm | DELETE |
rmdir | DELETE |
(Commands are based on the OpenSSH SFTP client)
sftp> cd /WEB-INF
sftp> get web.xml
Couldn't stat remote file: No such file or directory
File "/WEB-INF/web.xml" not found.
E.g., If you list the files under root, you only see this file listed even though "/index.jsp" may in fact be a valid Servlet resource:
sftp> ls /
WHERE_ARE_MY_FILES.txt
sftp> get /index.jsp
Fetching /index.jsp to index.jsp
/index.jsp 100% 7779 7.6KB/s 00:00
E.g., To access "/foo/bar.gif" you can do:
sftp> get /foo/bar.gif
or:
sftp> cd /foo
sftp> get bar.gif
E.g., If /baz is both a file and a directory, this is how you would access its file contents:
sftp> get /baz
or:
sftp> get /baz/.
and this is how you would list its directory contents:
sftp> ls /baz/
One special case is the root directory, if it's both a file and directory, this is how you would access its file contents:
sftp> get /.
and this is how you would list its directory contents:
sftp> ls /
If the web application does support WebDAV extensions, you will be able to access it more or less like a regular filesystem. Specifically in addition to the capabilities above:
Installing SFTP Servlet Container is simply copying JAR files from the distribution package into Tomcat's lib folder, and adding the following lines to the conf/server.xml
file:
<Connector port="2222"
protocol="my.edu.clhs.tomcat.coyote.SftpProtocol"
anonymousUsername="anonymous"
sessionTimeout="600000" />
Please refer to INSTALL.txt in the distribution package for more details.