Maybe you know, maybe no — it’s about five years as I’m involved in the Apache Struts project. About two years ago I became a Struts 2 Lead — whatever it means in non-profit organisation working on an opensource project where everyone is equal :-) Nevertheless I like what I’m doing — code and refactor :-) And as there is a plenty of code in the project and most of them need to be improved — I have what to do for the next few years :D

Recently I’ve started working on a new plugin — the MVEL plugin — which will allow to use MVEL instead of OGNL to handle expressions. In theory the task wasn’t too difficult, Struts 2 already provides many extension points where you can hook in with your code. Replacing expression engine require to implement two interfaces — very simple and straightforward. After I did that, I have started testing many possible expression syntaxes which are already present in unit tests.

And then problems show off :/ The main problem is conversion, to give you a hint check the below expression which simple means array in both — MVEL and OGNL


but the problem is how both engines handle such statement (pseudo code):

  • MVEL:
  • new Object[]{Integer, Integer, Integer}
  • OGNL:
  • new ArrayList(){Integer, Integer, Integer}

As you can see the difference is slight but important — the wrapping object is totally different. And then goes conversion logic, as I wanted to get string on output, built-in conversion mechanism do this:

  • MVEL: [1]
  • OGNL: [1,2,3]

Not so good ;-) The problem is that the conversion logic is too narrowed to OGNL. After some internal brainstorming I’ve came up with a plan — to allow other expression engines to work with Struts 2, first I must decouple conversion logic and OGNL :-) So the plan is:

  • extract conversion mechanism to allow replacement of it (another extension point)
  • simplify current logic related to converters created by users
  • implement more common logic to allow handle wide list of results
  • implement MVEL specific conversion
  • implement MVEL plugin :-)

As you see the plan is simple, but as it is with plans — it is good to prepare them, but to follow them is a different story ;-)

Finally, I found something interesting in the latest newsletter from TED — something about attention :-)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.