The first thing is to come up with a special syntax that hints the
FtpReplyTranslator that there is a variable in the message and it
needs to be expanded before sending the reply to the client. The
current syntax we use is something like:
{variable}
some of the example variables that we currently have are -
{client.ip} - evaluates to the IP address of the client
{request.cmd} - the command portion of the request excluding any arguments
I would recommend that we use variables that start with "session." to
get any attribute from the session. So, for example, if we have an
attribute named "bandwidthLimit" in the session (FtpIoSession), this
value can be sent in replies using the variable
{session.bandwidthLimit}. When the FtpReplyTranslator sees this
variable, it first checks the first part of the variable, which is
"session" in this case. Then it would call another utility method that
knows how to expand session variables. The new utility method would
simply do something like this:
return String.valueOf(session.getAttribute("bandwidthLimit"));
I think something like this should do the trick.
Regards,
Sai Pullabhotla
On Thu, Feb 25, 2010 at 6:01 PM, DevNull 43 <[email protected]> wrote:
>>I would urge you to have a look at
>>FtpReplyTranslator.getClientVariableValue() and
>>patch in code for including any session attribute. As Sai mentioned,
>>we would be interested in such a patch, so feel free to sharing it
>>with us and we'll have a look at including it in 1.1.0.
>
> Uhmm I can try, however does not seem an easy task.
>
> The problem is not to implement it, the problem is how to do it so
> attributes couold be any and configurable.
>
> I need to think about it.. if you have some ideas I would like to hear.
>
> Regards.
>