On Tue, Sep 30, 2008 at 9:07 PM, Sisk, Brad <[EMAIL PROTECTED]> wrote:
> With (Http) Servlets, you can use the implicit Session object to get the
> Context object. This allows you to get generic, statistical, or config
> information from the Servlet Container-info which is common to all
> Servlets.
This is somewhat similar to what FtpletContext is used for.
> Although FTPlets in an FtpletContainer are roughly analogous to Servlets
> in a ServletContainer, there is no method I see in the FtpSession class
> to get a pointer to the FtpletContainer or the Context object. I've
> read the javadoc and the source, and don't see any obvious method like
> that.
[snip]
> Is there another way, already built-in, to get it?
It is provided in the init method of Ftplets.
> Specifically, from within Ftplet.onUploadEnd(), I need to obtain the
> CWD (current working directory) on FTPServer. In other words, what
> directory the client user just uploaded his file to. Is there another
> way to get that? I see so for the Client's filesystem---but nothing for
> the Server's filesystem.
Assuming your using the native file system, put this in the relevant
callback method on your Ftplet:
String homeRoot = session.getUser().getHomeDirectory();
String currectDir =
session.getFileSystemView().getCurrentDirectory().getFullName();
System.out.println(new File(homeRoot, currectDir));
/niklas