You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by "Henning P. Schmiedehausen" <hp...@intermeta.de> on 2003/03/20 11:44:40 UTC
Re: cvs commit:
Peter Courcoux <pe...@courcoux.biz> writes:
>Quinton,
>Why do you only need to format the string if case folding != 'none'? I
>have a situation where I have user defined field names. If users include
>uppercase characters I need to have case folding set to 'none' to read
>them accurately. Then using these in forms I need to retrieve them and
>also have the event_submit_... correctly formatted or my image buttons
>don't work. I posted a note about this 6 months ago and still have to
>patch ActionEvent to get my app to work.
>My version below :-
>protected final String formatString(String input)
>{
> String tmp = input.toLowerCase();
> if ((tmp.length() != 0) && (tmp != null))
That test is silly. :-) If tmp == null, you will have an NPE before you
get to the 2nd test.
I think, Quinton got it almost right. I'd propose the following (Please test)
protected final String formatString(String input)
{
String tmp = null;
if (StringUtils.isNotEmpty(input))
{
if (ParserUtils.getUrlFolding() != ParserUtils.URL_CASE_FOLDING_NONE)
{
tmp = input.toLowerCase();
// Chop off suffixes (for image type)
tmp = (tmp.endsWith(".x") || tmp.endsWith(".y"))
? tmp.substring(0, tmp.length() - 2)
: tmp;
tmp = tmp.substring(BUTTON_LENGTH + METHOD_NAME_LENGTH);
tmp = METHOD_NAME_PREFIX + StringUtils.capitalise(tmp);
}
else
{
tmp = input.substring(BUTTON_LENGTH);
}
}
return tmp;
}
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: cvs commit:
Posted by Peter Courcoux <pe...@courcoux.biz>.
On Thu, 2003-03-20 at 12:12, Henning P. Schmiedehausen wrote:
> Peter Courcoux <pe...@courcoux.biz> writes:
>
> >As I understand things the name part of all parameters is case folded by
> >ParameterParser not just event names.
>
> Yes, this is correct.
>
> >ie "Surname=Courcoux" will be changed to "surname=Courcoux"
>
> >not just the event names. I have a tagging scheme where you have a
> >number of user defined tag groups and user defined tags.
>
> >Tag Group : Location
> > Tags : Place 1
> > : Place 2
> >
>
> >Tag Group : Doc. Type
> > Tags : Letter
> > : Drawing
>
> >To retain formatting, as both groups and tags are user defined I need to
> >retain the case if possible.
>
> So you need case.foldin == none
This is what I have done.
>
> >In the following example either I lose the case of my tag groups and
> >tags (the default) or I don't get the event firing because event name is
> >not processed by ActionEvent.formatString() and the .x and .y are not
> >dropped from the event (case folding set to none).
>
> So the problem is, that we don't remove the .x and .y in the "none"
> case? That is easy to fix.
See my proposed changes to ActionEvent.formatString() but do change my
silly error :-)
> You must only ensure that you don't put
> any case errors in the
>
> ><input type="image" name="eventSubmit_doSomething" src="..." />
>
> line because the case.folding == none will be unforgiving =:-)
Absolutely.
>
> Regards
> Henning
Thanks for your time.
--
Regards,
Peter
Peter Courcoux <pe...@courcoux.biz>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: cvs commit:
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Peter Courcoux <pe...@courcoux.biz> writes:
>As I understand things the name part of all parameters is case folded by
>ParameterParser not just event names.
Yes, this is correct.
>ie "Surname=Courcoux" will be changed to "surname=Courcoux"
>not just the event names. I have a tagging scheme where you have a
>number of user defined tag groups and user defined tags.
>Tag Group : Location
> Tags : Place 1
> : Place 2
>
>Tag Group : Doc. Type
> Tags : Letter
> : Drawing
>To retain formatting, as both groups and tags are user defined I need to
>retain the case if possible.
So you need case.foldin == none
>In the following example either I lose the case of my tag groups and
>tags (the default) or I don't get the event firing because event name is
>not processed by ActionEvent.formatString() and the .x and .y are not
>dropped from the event (case folding set to none).
So the problem is, that we don't remove the .x and .y in the "none"
case? That is easy to fix. You must only ensure that you don't put
any case errors in the
><input type="image" name="eventSubmit_doSomething" src="..." />
line because the case.folding == none will be unforgiving =:-)
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: cvs commit:
Posted by Peter Courcoux <pe...@courcoux.biz>.
As I understand things the name part of all parameters is case folded by
ParameterParser not just event names.
ie "Surname=Courcoux" will be changed to "surname=Courcoux"
not just the event names. I have a tagging scheme where you have a
number of user defined tag groups and user defined tags.
Tag Group : Location
Tags : Place 1
: Place 2
Tag Group : Doc. Type
Tags : Letter
: Drawing
To retain formatting, as both groups and tags are user defined I need to
retain the case if possible.
In the following example either I lose the case of my tag groups and
tags (the default) or I don't get the event firing because event name is
not processed by ActionEvent.formatString() and the .x and .y are not
dropped from the event (case folding set to none).
If I have a select box in a form :
<select name = "$taggroupname">
#foreach ($tag in $taggroup)
<option name="$tag.Name"/>$tag.Name
#end
</select>
<input type="image" name="eventSubmit_doSomething" src="..." />
Does this make sense?
On Thu, 2003-03-20 at 11:28, Henning Schmiedehausen wrote:
> Hi,
>
> the idea is "if folding is none, don't change anything", else fold
> the method names to lowercase (because folding uppercase would give
> you method names like doFOOBAR which are ugly (and discouraged in the
> Sun Coding Style)).
>
> So
>
> input case result
>
> eventSubmit_doBlaFooBar none doBlaFooBar
> eventSubmit_doBlaFooBar lower doBlafoobar
> eventSubmit_doBlaFooBar upper doBlafoobar
>
> if I understand you correctly, you want the behaviour of lower/upper
> for none, too, yes?
>
> Regards
> Henning
>
>
>
> On Thu, 2003-03-20 at 12:01, Peter Courcoux wrote:
> > On Thu, 2003-03-20 at 10:44, Henning P. Schmiedehausen wrote:
> > > Peter Courcoux <pe...@courcoux.biz> writes:
> > >
> > > >Quinton,
> > >
> > > >Why do you only need to format the string if case folding != 'none'? I
> > > >have a situation where I have user defined field names. If users include
> > > >uppercase characters I need to have case folding set to 'none' to read
> > > >them accurately. Then using these in forms I need to retrieve them and
> > > >also have the event_submit_... correctly formatted or my image buttons
> > > >don't work. I posted a note about this 6 months ago and still have to
> > > >patch ActionEvent to get my app to work.
> > >
> > >
> > > >My version below :-
> > >
> > > >protected final String formatString(String input)
> > > >{
> > > > String tmp = input.toLowerCase();
> > > > if ((tmp.length() != 0) && (tmp != null))
> > >
> > > That test is silly. :-) If tmp == null, you will have an NPE before you
> > > get to the 2nd test.
> >
> > True -- wake up Peter :-(
> >
> > but why does the setting for case folding matter. Unless case folding is
> > 'lower' convert it every time then chop the .x and .y. I'm missing
> > something. ( I do realize that I can work round this but ...)
> >
> > >
> > > I think, Quinton got it almost right. I'd propose the following (Please test)
> > >
> > > protected final String formatString(String input)
> > > {
> > > String tmp = null;
> > >
> > > if (StringUtils.isNotEmpty(input))
> > > {
> > > if (ParserUtils.getUrlFolding() != ParserUtils.URL_CASE_FOLDING_NONE)
> > > {
> > > tmp = input.toLowerCase();
> > >
> > > // Chop off suffixes (for image type)
> > > tmp = (tmp.endsWith(".x") || tmp.endsWith(".y"))
> > > ? tmp.substring(0, tmp.length() - 2)
> > > : tmp;
> > >
> > > tmp = tmp.substring(BUTTON_LENGTH + METHOD_NAME_LENGTH);
> > >
> > > tmp = METHOD_NAME_PREFIX + StringUtils.capitalise(tmp);
> > > }
> > > else
> > > {
> > > tmp = input.substring(BUTTON_LENGTH);
> > > }
> > > }
> > > return tmp;
> > > }
> > >
> > > Regards
> > > Henning
Regards,
Peter
--
Peter Courcoux <pe...@courcoux.biz>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: cvs commit:
Posted by Henning Schmiedehausen <hp...@intermeta.de>.
Hi,
the idea is "if folding is none, don't change anything", else fold
the method names to lowercase (because folding uppercase would give
you method names like doFOOBAR which are ugly (and discouraged in the
Sun Coding Style)).
So
input case result
eventSubmit_doBlaFooBar none doBlaFooBar
eventSubmit_doBlaFooBar lower doBlafoobar
eventSubmit_doBlaFooBar upper doBlafoobar
if I understand you correctly, you want the behaviour of lower/upper
for none, too, yes?
Regards
Henning
On Thu, 2003-03-20 at 12:01, Peter Courcoux wrote:
> On Thu, 2003-03-20 at 10:44, Henning P. Schmiedehausen wrote:
> > Peter Courcoux <pe...@courcoux.biz> writes:
> >
> > >Quinton,
> >
> > >Why do you only need to format the string if case folding != 'none'? I
> > >have a situation where I have user defined field names. If users include
> > >uppercase characters I need to have case folding set to 'none' to read
> > >them accurately. Then using these in forms I need to retrieve them and
> > >also have the event_submit_... correctly formatted or my image buttons
> > >don't work. I posted a note about this 6 months ago and still have to
> > >patch ActionEvent to get my app to work.
> >
> >
> > >My version below :-
> >
> > >protected final String formatString(String input)
> > >{
> > > String tmp = input.toLowerCase();
> > > if ((tmp.length() != 0) && (tmp != null))
> >
> > That test is silly. :-) If tmp == null, you will have an NPE before you
> > get to the 2nd test.
>
> True -- wake up Peter :-(
>
> but why does the setting for case folding matter. Unless case folding is
> 'lower' convert it every time then chop the .x and .y. I'm missing
> something. ( I do realize that I can work round this but ...)
>
> >
> > I think, Quinton got it almost right. I'd propose the following (Please test)
> >
> > protected final String formatString(String input)
> > {
> > String tmp = null;
> >
> > if (StringUtils.isNotEmpty(input))
> > {
> > if (ParserUtils.getUrlFolding() != ParserUtils.URL_CASE_FOLDING_NONE)
> > {
> > tmp = input.toLowerCase();
> >
> > // Chop off suffixes (for image type)
> > tmp = (tmp.endsWith(".x") || tmp.endsWith(".y"))
> > ? tmp.substring(0, tmp.length() - 2)
> > : tmp;
> >
> > tmp = tmp.substring(BUTTON_LENGTH + METHOD_NAME_LENGTH);
> >
> > tmp = METHOD_NAME_PREFIX + StringUtils.capitalise(tmp);
> > }
> > else
> > {
> > tmp = input.substring(BUTTON_LENGTH);
> > }
> > }
> > return tmp;
> > }
> >
> > Regards
> > Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org