You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by JOSE L MARTINEZ-AVIAL <jl...@gmail.com> on 2016/03/01 20:14:51 UTC

Change ACCEPTED_PATTERN in CookieInterceptor

Hello,
   I have an issue with Strus 2.3.24.1 where my cookies are not being
accepted and populated to the action because the regular expression for the
values does not admit the character %. I'm trying to override the regular
expression, but is not clear how that can be done thorugh the configuration
file. The only option seems to be extending the interceptor. Is that
correct?

  Thanks

JL

Re: Change ACCEPTED_PATTERN in CookieInterceptor

Posted by Lukasz Lenart <lu...@apache.org>.
There is still few issues to resolve but it should be soon
https://issues.apache.org/jira/issues/?jql=project%20%3D%20WW%20AND%20fixVersion%20%3D%202.3.25%20AND%20resolution%20%3D%20Unresolved%20ORDER%20BY%20due%20ASC%2C%20priority%20DESC%2C%20created%20ASC

2016-03-02 8:46 GMT+01:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
> Ah!!!, perfect, thanks!!!!. Any idea when that version will be available?
>
> thanks
>
> JL
>
> 2016-03-02 2:19 GMT-05:00 Lukasz Lenart <lu...@apache.org>:
>
>> Ah... it's resolved ;-)
>>
>> See https://issues.apache.org/jira/browse/WW-4563
>> and https://issues.apache.org/jira/browse/WW-4560
>>
>> basically you must wait for 2.3.25
>>
>> 2016-03-02 8:17 GMT+01:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
>> > Hello Lukasz,
>> >    Actually, the issue I have is with isAcceptableValue for the cookie
>> > value, not with the name. For reasons the name of the cookie I'm
>> interested
>> > in is variable, so I use CookieAware, and then lookup in the map for the
>> > cookie I'm interested in. The name of the cookie is plain, and it goes
>> > through isAcceptableName without issue, but the value does not pass the
>> > isAcceptableValue, since the regular expression does not allow for %.
>> And I
>> > would like to change that behaviour, but without affecting
>> > ParametersInterceptor.
>> >
>> >   So far, what I've done is to extend the interceptor and change the
>> > regular expression by doing:
>> >
>> > private static final String ACCEPTED_PATTERN =
>> > "[a-zA-Z0-9\\.\\]\\[_'\\s%]+";
>> >     @Inject
>> >     public void setAcceptedPatternsChecker(AcceptedPatternsChecker
>> > acceptedPatternsChecker) {
>> >         super.setAcceptedPatternsChecker(acceptedPatternsChecker);
>> >         acceptedPatternsChecker.setAcceptedPatterns(ACCEPTED_PATTERN);
>> >     }
>> >
>> > So I override the default ACCEPTED_PATTERN with my own. But I really
>> would
>> > like to be able to do the override by configuration, and not have to
>> extend
>> > the class. And would be great to be able to do it separately for names
>> and
>> > values.
>> >
>> > JL
>> >
>> > 2016-03-02 1:28 GMT-05:00 Lukasz Lenart <lu...@apache.org>:
>> >
>> >> 2016-03-01 20:14 GMT+01:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
>> >> > Hello,
>> >> >    I have an issue with Strus 2.3.24.1 where my cookies are not being
>> >> > accepted and populated to the action because the regular expression
>> for
>> >> the
>> >> > values does not admit the character %. I'm trying to override the
>> regular
>> >> > expression, but is not clear how that can be done thorugh the
>> >> configuration
>> >> > file. The only option seems to be extending the interceptor. Is that
>> >> > correct?
>> >>
>> >> You are right, it isn't documented but you must investigate the code :\
>> >>
>> >> You have two options, use the below constants (the naming is obvious),
>> >> they accept comma separated RegExs
>> >>
>> >> struts.override.excludedPatterns
>> >> struts.override.acceptedPatterns
>> >>
>> >> struts.additional.excludedPatterns
>> >> struts.additional.acceptedPatterns
>> >>
>> >> but setting these constants will also affect ParametersInterceptor
>> >> which can be dangerous as you want to allow %.
>> >>
>> >> Second option is to use 'acceptCookieNames' parameter (as well comma
>> >> separated RegExs) but this probably won't be enough as you cannot
>> >> override excluded patterns in the same way. What about defining
>> >> 'excludeCookieNames' parameter to override exclude patterns? Then it
>> >> will be available in 2.3.25
>> >>
>> >>
>> >> Regards
>> >> --
>> >> Łukasz
>> >> + 48 606 323 122 http://www.lenart.org.pl/
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Change ACCEPTED_PATTERN in CookieInterceptor

Posted by JOSE L MARTINEZ-AVIAL <jl...@gmail.com>.
Ah!!!, perfect, thanks!!!!. Any idea when that version will be available?

thanks

JL

2016-03-02 2:19 GMT-05:00 Lukasz Lenart <lu...@apache.org>:

> Ah... it's resolved ;-)
>
> See https://issues.apache.org/jira/browse/WW-4563
> and https://issues.apache.org/jira/browse/WW-4560
>
> basically you must wait for 2.3.25
>
> 2016-03-02 8:17 GMT+01:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
> > Hello Lukasz,
> >    Actually, the issue I have is with isAcceptableValue for the cookie
> > value, not with the name. For reasons the name of the cookie I'm
> interested
> > in is variable, so I use CookieAware, and then lookup in the map for the
> > cookie I'm interested in. The name of the cookie is plain, and it goes
> > through isAcceptableName without issue, but the value does not pass the
> > isAcceptableValue, since the regular expression does not allow for %.
> And I
> > would like to change that behaviour, but without affecting
> > ParametersInterceptor.
> >
> >   So far, what I've done is to extend the interceptor and change the
> > regular expression by doing:
> >
> > private static final String ACCEPTED_PATTERN =
> > "[a-zA-Z0-9\\.\\]\\[_'\\s%]+";
> >     @Inject
> >     public void setAcceptedPatternsChecker(AcceptedPatternsChecker
> > acceptedPatternsChecker) {
> >         super.setAcceptedPatternsChecker(acceptedPatternsChecker);
> >         acceptedPatternsChecker.setAcceptedPatterns(ACCEPTED_PATTERN);
> >     }
> >
> > So I override the default ACCEPTED_PATTERN with my own. But I really
> would
> > like to be able to do the override by configuration, and not have to
> extend
> > the class. And would be great to be able to do it separately for names
> and
> > values.
> >
> > JL
> >
> > 2016-03-02 1:28 GMT-05:00 Lukasz Lenart <lu...@apache.org>:
> >
> >> 2016-03-01 20:14 GMT+01:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
> >> > Hello,
> >> >    I have an issue with Strus 2.3.24.1 where my cookies are not being
> >> > accepted and populated to the action because the regular expression
> for
> >> the
> >> > values does not admit the character %. I'm trying to override the
> regular
> >> > expression, but is not clear how that can be done thorugh the
> >> configuration
> >> > file. The only option seems to be extending the interceptor. Is that
> >> > correct?
> >>
> >> You are right, it isn't documented but you must investigate the code :\
> >>
> >> You have two options, use the below constants (the naming is obvious),
> >> they accept comma separated RegExs
> >>
> >> struts.override.excludedPatterns
> >> struts.override.acceptedPatterns
> >>
> >> struts.additional.excludedPatterns
> >> struts.additional.acceptedPatterns
> >>
> >> but setting these constants will also affect ParametersInterceptor
> >> which can be dangerous as you want to allow %.
> >>
> >> Second option is to use 'acceptCookieNames' parameter (as well comma
> >> separated RegExs) but this probably won't be enough as you cannot
> >> override excluded patterns in the same way. What about defining
> >> 'excludeCookieNames' parameter to override exclude patterns? Then it
> >> will be available in 2.3.25
> >>
> >>
> >> Regards
> >> --
> >> Łukasz
> >> + 48 606 323 122 http://www.lenart.org.pl/
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Change ACCEPTED_PATTERN in CookieInterceptor

Posted by Lukasz Lenart <lu...@apache.org>.
Ah... it's resolved ;-)

See https://issues.apache.org/jira/browse/WW-4563
and https://issues.apache.org/jira/browse/WW-4560

basically you must wait for 2.3.25

2016-03-02 8:17 GMT+01:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
> Hello Lukasz,
>    Actually, the issue I have is with isAcceptableValue for the cookie
> value, not with the name. For reasons the name of the cookie I'm interested
> in is variable, so I use CookieAware, and then lookup in the map for the
> cookie I'm interested in. The name of the cookie is plain, and it goes
> through isAcceptableName without issue, but the value does not pass the
> isAcceptableValue, since the regular expression does not allow for %. And I
> would like to change that behaviour, but without affecting
> ParametersInterceptor.
>
>   So far, what I've done is to extend the interceptor and change the
> regular expression by doing:
>
> private static final String ACCEPTED_PATTERN =
> "[a-zA-Z0-9\\.\\]\\[_'\\s%]+";
>     @Inject
>     public void setAcceptedPatternsChecker(AcceptedPatternsChecker
> acceptedPatternsChecker) {
>         super.setAcceptedPatternsChecker(acceptedPatternsChecker);
>         acceptedPatternsChecker.setAcceptedPatterns(ACCEPTED_PATTERN);
>     }
>
> So I override the default ACCEPTED_PATTERN with my own. But I really would
> like to be able to do the override by configuration, and not have to extend
> the class. And would be great to be able to do it separately for names and
> values.
>
> JL
>
> 2016-03-02 1:28 GMT-05:00 Lukasz Lenart <lu...@apache.org>:
>
>> 2016-03-01 20:14 GMT+01:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
>> > Hello,
>> >    I have an issue with Strus 2.3.24.1 where my cookies are not being
>> > accepted and populated to the action because the regular expression for
>> the
>> > values does not admit the character %. I'm trying to override the regular
>> > expression, but is not clear how that can be done thorugh the
>> configuration
>> > file. The only option seems to be extending the interceptor. Is that
>> > correct?
>>
>> You are right, it isn't documented but you must investigate the code :\
>>
>> You have two options, use the below constants (the naming is obvious),
>> they accept comma separated RegExs
>>
>> struts.override.excludedPatterns
>> struts.override.acceptedPatterns
>>
>> struts.additional.excludedPatterns
>> struts.additional.acceptedPatterns
>>
>> but setting these constants will also affect ParametersInterceptor
>> which can be dangerous as you want to allow %.
>>
>> Second option is to use 'acceptCookieNames' parameter (as well comma
>> separated RegExs) but this probably won't be enough as you cannot
>> override excluded patterns in the same way. What about defining
>> 'excludeCookieNames' parameter to override exclude patterns? Then it
>> will be available in 2.3.25
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Change ACCEPTED_PATTERN in CookieInterceptor

Posted by JOSE L MARTINEZ-AVIAL <jl...@gmail.com>.
Hello Lukasz,
   Actually, the issue I have is with isAcceptableValue for the cookie
value, not with the name. For reasons the name of the cookie I'm interested
in is variable, so I use CookieAware, and then lookup in the map for the
cookie I'm interested in. The name of the cookie is plain, and it goes
through isAcceptableName without issue, but the value does not pass the
isAcceptableValue, since the regular expression does not allow for %. And I
would like to change that behaviour, but without affecting
ParametersInterceptor.

  So far, what I've done is to extend the interceptor and change the
regular expression by doing:

private static final String ACCEPTED_PATTERN =
"[a-zA-Z0-9\\.\\]\\[_'\\s%]+";
    @Inject
    public void setAcceptedPatternsChecker(AcceptedPatternsChecker
acceptedPatternsChecker) {
        super.setAcceptedPatternsChecker(acceptedPatternsChecker);
        acceptedPatternsChecker.setAcceptedPatterns(ACCEPTED_PATTERN);
    }

So I override the default ACCEPTED_PATTERN with my own. But I really would
like to be able to do the override by configuration, and not have to extend
the class. And would be great to be able to do it separately for names and
values.

JL

2016-03-02 1:28 GMT-05:00 Lukasz Lenart <lu...@apache.org>:

> 2016-03-01 20:14 GMT+01:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
> > Hello,
> >    I have an issue with Strus 2.3.24.1 where my cookies are not being
> > accepted and populated to the action because the regular expression for
> the
> > values does not admit the character %. I'm trying to override the regular
> > expression, but is not clear how that can be done thorugh the
> configuration
> > file. The only option seems to be extending the interceptor. Is that
> > correct?
>
> You are right, it isn't documented but you must investigate the code :\
>
> You have two options, use the below constants (the naming is obvious),
> they accept comma separated RegExs
>
> struts.override.excludedPatterns
> struts.override.acceptedPatterns
>
> struts.additional.excludedPatterns
> struts.additional.acceptedPatterns
>
> but setting these constants will also affect ParametersInterceptor
> which can be dangerous as you want to allow %.
>
> Second option is to use 'acceptCookieNames' parameter (as well comma
> separated RegExs) but this probably won't be enough as you cannot
> override excluded patterns in the same way. What about defining
> 'excludeCookieNames' parameter to override exclude patterns? Then it
> will be available in 2.3.25
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Change ACCEPTED_PATTERN in CookieInterceptor

Posted by Lukasz Lenart <lu...@apache.org>.
2016-03-01 20:14 GMT+01:00 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
> Hello,
>    I have an issue with Strus 2.3.24.1 where my cookies are not being
> accepted and populated to the action because the regular expression for the
> values does not admit the character %. I'm trying to override the regular
> expression, but is not clear how that can be done thorugh the configuration
> file. The only option seems to be extending the interceptor. Is that
> correct?

You are right, it isn't documented but you must investigate the code :\

You have two options, use the below constants (the naming is obvious),
they accept comma separated RegExs

struts.override.excludedPatterns
struts.override.acceptedPatterns

struts.additional.excludedPatterns
struts.additional.acceptedPatterns

but setting these constants will also affect ParametersInterceptor
which can be dangerous as you want to allow %.

Second option is to use 'acceptCookieNames' parameter (as well comma
separated RegExs) but this probably won't be enough as you cannot
override excluded patterns in the same way. What about defining
'excludeCookieNames' parameter to override exclude patterns? Then it
will be available in 2.3.25


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org