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. 

 

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.  

 

>From within an Ftplet's  on<Something>  method  (like: onUploadStart(),
onUploadEnd(), onDownloadStart(), etc...), you have access to the
FtpSession object associated with that Ftplet instance & thread.  In
fact, inside those onXXX() methods, you ONLY have access to the
FtpSession and FtpRequest.  But neither of these seem to allow a way to
get the FtpletContainer. Am I wrong-is there a method for that in-scope
within those Ftplet method bodies?  I am only asking about it within the
method bodies for the FTPlet onXXX() event-handler methods.  That is the
only place I need access to them.

 

I know I could subclass DefaultFtplet, and give it an member variable to
store a reference to the FtpContainer object it was added to-the only
problem is: this may lead to disastrous thread issues.   The same Ftplet
instance is being used by multiple concurrent threads.  So just as with
Servlets, adding member variables to a Servlet class is ill-advised and
problematic. So would be doing so to an Ftplet.

 

Is there another way, already built-in, to get it?

 

 

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.

Reply via email to