You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by Pierre-Luc Pineault <pi...@hotmail.com> on 2011/03/09 15:40:29 UTC

Advise the client that an error has occurred

Hello
Sorry for the bas english that follows
I use my own DefaultFtplet and i have redefine onUploadEnd(). In this method, i parse a file and if there is an error, the file is moved into an error file folder. This works perfectly but now, i want to advise the client that an error has occurred with his file (Incomplete, corrupted, ...).
How can i proceed ?
P-L 		 	   		  

RE: Advise the client that an error has occurred

Posted by Pierre-Luc Pineault <pi...@hotmail.com>.
Hi Toli
first, thank you to answer to my question as quick as you did. 
I just found a way to write something in the session but it's not easy to perceive.
FtpReply reply = new DefaultFtpReply(FtpReply.                        REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "*** WARNING *** : An error has occured when parsing the file.");pFtpSession.write(reply);

The best for us is to have something easier to see but I suppose that is specific to the FTP Client application used.


From: tkuznets@marinsoftware.com
Date: Wed, 9 Mar 2011 08:16:57 -0800
Subject: Re: Advise the client that an error has occurred
To: ftpserver-users@mina.apache.org
CC: pino_115@hotmail.com

Pierre-Luc, 
Have you tried throwing an exception form your onUploadEnd() function? 
You can throw and FtpException the file upload will error out, and (i believe) the message will eventually show up in the client session.


Should be fairly easy to try and see if that's working for you. 

On Wed, Mar 9, 2011 at 6:40 AM, Pierre-Luc Pineault <pi...@hotmail.com> wrote:




Hello

Sorry for the bas english that follows

I use my own DefaultFtplet and i have redefine onUploadEnd(). In this method, i parse a file and if there is an error, the file is moved into an error file folder. This works perfectly but now, i want to advise the client that an error has occurred with his file (Incomplete, corrupted, ...).



How can i proceed ?

P-L                                       
 		 	   		  

Re: Advise the client that an error has occurred

Posted by Toli Kuznets <tk...@marinsoftware.com>.
Pierre-Luc,

Have you tried throwing an exception form your onUploadEnd() function?

You can throw and FtpException the file upload will error out, and (i
believe) the message will eventually show up in the client session.

Should be fairly easy to try and see if that's working for you.


On Wed, Mar 9, 2011 at 6:40 AM, Pierre-Luc Pineault <pi...@hotmail.com>wrote:

>
> Hello
> Sorry for the bas english that follows
> I use my own DefaultFtplet and i have redefine onUploadEnd(). In this
> method, i parse a file and if there is an error, the file is moved into an
> error file folder. This works perfectly but now, i want to advise the client
> that an error has occurred with his file (Incomplete, corrupted, ...).
> How can i proceed ?
> P-L