You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alireza Fattahi <af...@yahoo.com.INVALID> on 2015/01/19 14:02:19 UTC
OGNL Static Method call wrapper
As the OGNL static method will be disabled soon ... we could use a wrapper to call those static methods
Do you think it is a good idea to add a method ActionSupport for calling the static methods
So instead of @foo.bar@isValidAmount(amount)
we can use callStaticMethod("foo.bar.isValidAmount",amount)
In this way there will be no need to add different method wrappers every time we want to call static method and we can update the code lot easier, The callStaticMethod (String methodName, String... Parameters) can use reflection to call static methods
Please review http://stackoverflow.com/questions/28018861/struts-2-refactoring-code-to-avoid-ognl-static-method-access
~Regards,
~~Alireza Fattahi
Re: OGNL Static Method call wrapper
Posted by Lukasz Lenart <lu...@apache.org>.
2015-01-19 14:02 GMT+01:00 Alireza Fattahi <af...@yahoo.com.invalid>:
> As the OGNL static method will be disabled soon ... we could use a wrapper to call those static methods
> Do you think it is a good idea to add a method ActionSupport for calling the static methods
>
> So instead of @foo.bar@isValidAmount(amount)
> we can use callStaticMethod("foo.bar.isValidAmount",amount)
>
> In this way there will be no need to add different method wrappers every time we want to call static method and we can update the code lot easier, The callStaticMethod (String methodName, String... Parameters) can use reflection to call static methods
>
> Please review http://stackoverflow.com/questions/28018861/struts-2-refactoring-code-to-avoid-ognl-static-method-access
We want to drop access to static methods because of potential security
issues, but maybe with the latest extensions of security mechanism
this isn't a valid point anymore - we will see :)
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: OGNL Static Method call wrapper
Posted by Alireza Fattahi <af...@yahoo.com.INVALID>.
The problem of static methods was not the issue I was talking about.
Static methods are there you can use them or not, OGNL supports calling static methods.The struts team decided to disable this feature.Lots of framework users, use this feature ( may be they have set -Xmx .. parameters or not) But they are using it. Let them decide if they should use static method or not.
Now:
If some one decide to use static method call in validators or JSPs)
Is it good to have a method in Action Supports which can be used to help faster integration and mean while enable users to call static method envocation in action and JSPs ?!
~Regards,
~~Alireza Fattahi
From: Martin Gainty <mg...@hotmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Monday, 19 January 2015, 17:00
Subject: RE: OGNL Static Method call wrapper
No
*Unless* you configure app to implement max heap -Xmx2048M -XX:PermSize=2048M -XX:MaxPermSize=2048m
dont declare any entity Static anything .statics are notorious for parking in Permgen
where of course the accumulation of other statics will eventually cause OOM
http://stackoverflow.com/questions/8387989/where-is-a-static-method-and-a-static-variable-stored-in-java-in-heap-or-in-sta
read this q&a on how variables and methods and classes declared statically essentially violate OOP
http://stackoverflow.com/questions/7026507/why-are-static-variables-considered-evil
Martin
______________________________________________
> Date: Mon, 19 Jan 2015 13:02:19 +0000
> From: afattahi@yahoo.com.INVALID
> To: user@struts.apache.org
> Subject: OGNL Static Method call wrapper
>
> As the OGNL static method will be disabled soon ... we could use a wrapper to call those static methods
> Do you think it is a good idea to add a method ActionSupport for calling the static methods
>
> So instead of @foo.bar@isValidAmount(amount)
> we can use callStaticMethod("foo.bar.isValidAmount",amount)
>
> In this way there will be no need to add different method wrappers every time we want to call static method and we can update the code lot easier, The callStaticMethod (String methodName, String... Parameters) can use reflection to call static methods
>
> Please review http://stackoverflow.com/questions/28018861/struts-2-refactoring-code-to-avoid-ognl-static-method-access
>
> ~Regards,
> ~~Alireza Fattahi
RE: OGNL Static Method call wrapper
Posted by Martin Gainty <mg...@hotmail.com>.
No
*Unless* you configure app to implement max heap -Xmx2048M -XX:PermSize=2048M -XX:MaxPermSize=2048m
dont declare any entity Static anything .statics are notorious for parking in Permgen
where of course the accumulation of other statics will eventually cause OOM
http://stackoverflow.com/questions/8387989/where-is-a-static-method-and-a-static-variable-stored-in-java-in-heap-or-in-sta
read this q&a on how variables and methods and classes declared statically essentially violate OOP
http://stackoverflow.com/questions/7026507/why-are-static-variables-considered-evil
Martin
______________________________________________
> Date: Mon, 19 Jan 2015 13:02:19 +0000
> From: afattahi@yahoo.com.INVALID
> To: user@struts.apache.org
> Subject: OGNL Static Method call wrapper
>
> As the OGNL static method will be disabled soon ... we could use a wrapper to call those static methods
> Do you think it is a good idea to add a method ActionSupport for calling the static methods
>
> So instead of @foo.bar@isValidAmount(amount)
> we can use callStaticMethod("foo.bar.isValidAmount",amount)
>
> In this way there will be no need to add different method wrappers every time we want to call static method and we can update the code lot easier, The callStaticMethod (String methodName, String... Parameters) can use reflection to call static methods
>
> Please review http://stackoverflow.com/questions/28018861/struts-2-refactoring-code-to-avoid-ognl-static-method-access
>
> ~Regards,
> ~~Alireza Fattahi