You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by David Latorre <dv...@gmail.com> on 2008/10/30 22:13:12 UTC

[FTPSERVER] Return values of Ftplet methods.

Currently (I don't have the code here so correct me if I am wrong) when a
Ftplet method invoked via beforeCommand()  returns FtpletResult.SKIP the
command itself is not called but afterCommand still gets called.
By reading the docs i cannot conclude if this the expected behaviour  for I
cannot understand the sentence between brackets. Is it because of my broken
English or some typo?
*SKIP* : It indicates that the server will skip everything. No further
processing will be done for this request (besides called afterCommand is
SKIP is returned before the command invocation).

To my mind, in most cases when we return SKIP we would also want to skip the
afterCommand( e.g.,   I check if the data channel is secured in
 beforeCommand and if it is not, I  write an appropiate response and return
SKIP  . Afterwards,  onUploadEnd() could try to copy the file to another
location, update the database to record the event of the arrival ... In this
case, I don't want afterCommand to be called.
You may argue that there're cases in which we still want that the
afterCommand be called. So my proposal would be to add a new result so we
can have a return code meaning "skip everything" and another one meaning
"call afterCommand if it exists".

Makes sense?

Re: [FTPSERVER] Return values of Ftplet methods.

Posted by David Latorre <dv...@gmail.com>.
2008/10/31 Niklas Gustavsson <ni...@protocol7.com>

> On Thu, Oct 30, 2008 at 10:13 PM, David Latorre <dv...@gmail.com> wrote:
> > To my mind, in most cases when we return SKIP we would also want to skip
> the
> > afterCommand( e.g.,   I check if the data channel is secured in
> > beforeCommand and if it is not, I  write an appropiate response and
> return
> > SKIP  . Afterwards,  onUploadEnd() could try to copy the file to another
> > location, update the database to record the event of the arrival ... In
> this
> > case, I don't want afterCommand to be called.
> > You may argue that there're cases in which we still want that the
> > afterCommand be called.
>
> I can't actually think of such a case. Could you give an example? if
> not, I think we should change the behavior so that afterCommand is not
> called if SKIP is returned. I believe the current behavior is there
> due to me not thinking properly :-)
>

 The only reason for this I can think is to do some cleanup - but you're
right it seems  not very likely if you skipped the whole command.
 So, if everone agrees (yeah maybe we are not that many - yet x) i it should
be ok to just skip the whole thing when SKIP is returned.


david.

Re: [FTPSERVER] Return values of Ftplet methods.

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Thu, Oct 30, 2008 at 10:13 PM, David Latorre <dv...@gmail.com> wrote:
> To my mind, in most cases when we return SKIP we would also want to skip the
> afterCommand( e.g.,   I check if the data channel is secured in
> beforeCommand and if it is not, I  write an appropiate response and return
> SKIP  . Afterwards,  onUploadEnd() could try to copy the file to another
> location, update the database to record the event of the arrival ... In this
> case, I don't want afterCommand to be called.
> You may argue that there're cases in which we still want that the
> afterCommand be called.

I can't actually think of such a case. Could you give an example? if
not, I think we should change the behavior so that afterCommand is not
called if SKIP is returned. I believe the current behavior is there
due to me not thinking properly :-)

/niklas