[I18N] Contribution: Timezone independence and argument filtering
-----------------------------------------------------------------
Key: SANDBOX-167
URL: http://issues.apache.org/jira/browse/SANDBOX-167
Project: Commons Sandbox
Issue Type: New Feature
Components: I18n
Environment: Operating System: All
Platform: All
Reporter: Armin Häberling
Priority: Minor
Attachments: commons-i18n_timezone-filtering.patch
Adding two new features:
1) Timezone independence:
Currently dates as message arguments are only displayed in the default time
zone returned by the method TimeZone.getDefault(). I extended the
MessageManager.getText() method so that one can also choose in which timezone
Date arguments should be displayed.
In the current implementation the message template must contain a date or time
format so that the message is formated with the right timezone. That means the
template "it's now {0}" will not work, whereas "it's now {o,time}" will work.
2) Filtering of message arguments:
You may want to include String in message arguments that are untrusted (i.e.
user input). But when you display such a message n a html site it may contain a
javascript attack or other nasty things. Otherwise if you want to store the
message in an sql table there are also attacks possible. Cause of this the
arguments should be filtered depending on later use of the message. For this I
created a new Filter Interface and extended the LocalizedBundle so that you can
attach a specific filter which filters the message arguments before formating
it. I also did two simple implementations of specific filters.
Attached is a patch with these two features including unit test.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]