struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <>
Subject Re: Allowing user to inject his/her specific utility class into OGNL scopes?
Date Fri, 15 Sep 2017 06:04:31 GMT
As I'm not fully grasp the idea behind, you can always use
#application scope (which is basically a ServletContext wrapper).
There is also ApplicationAware interface to allow actions deal with

Another thing would be implementation of ConfigurationProvider which
can deal with the ServletContext and you can use
ServletContextAwareConfigurationProvider in this case.

You can register your custom ConfigurationProvider as below:


The flow is as follow:
- in your ServletContextAwareConfigurationProvider you use
ServletContext#setAttribute to inject whatever tool you need
- in actions implementing ApplicationAware you can inject an action
specific tools/values into #application scope
- in JSPs you can call #application['myTool'].doStuff

+ 48 606 323 122

2017-09-08 23:49 GMT+02:00 Yasser Zamani <>:
> Good morning,
> If we suppose "is this OGNL access is an attack?" as our test, adding
> packages to exclusions may have false positives (test is positive but
> it's not an attack). Some issues occur in these false positives.
> I spotted such issues for 5 users [1], [2], [3], [4] and myself.
> I'll research for a cleaner solution but by now, what's your idea about
> importing something like [5] to Struts2. i.e. allowing user to inject
> his/her specific utility class into OGNL scopes when his/her primitive
> info (e.g. a simple String) is not accessible because of our exclusions?
> I can work on that and required documentations on site.
> [1]
> [2]
> [3]
> [4]
> [5]

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message