Miscellaneous topics in OGNL

Back
November 21, 2013

We are coming to the end of this series on the basics of OGNL.

 

As mentioned in my first article, Introduction to OGNL, I'm using the OGNL Language Guide as my rough outline for the topics to cover in the series. In earlier posts, I covered examples showing some of the features that you could use in your own PingFederate implementations to solve the problem of providing the proper identity information in Federation connections.

 

The remaining items in the Language Guide are reasonably well coveref in the Guide itself so I will just mention them here for completion.

 

One of the things that we used often in past articles is Collections, for example discussing curly braces and looping in my earlier posts OGNL: What about those curly braces and also Looping in OGNL and Looping in OGNL take 2. Since Collections don't follow the JavaBean pattern, certain methods such as size() or iterator() are exposed as pseudo-properties. This means that you can reference then by simply using the name, for example:

 

someMap.size

Refer to Pseudo-Properties for Collections in the OGNL Language Guide for more details

 

We have talked about some of the Operators that differ from Java's operators such as the comma, as I described in Declaring variables in OGNL. Reviewing the Language Guide is always a good source when you are trying to solve a problem using OGNL.

 

One of the challenges with working with OGNL is understanding what object you have and we saw how to find out in my post A continuing look at #this variable in OGNL.

 

Sometimes just knowing what we have is not enough so you may want to review Coercing Objects to Types in the OGNL Language Guide, which describes how OGNL interprets (coerces) objects as various types, such as booleans, numbers, integers, and collections.

 

Let me know of any additional topics on OGNL you would like to see by posting comments to this article. Follow me on Twitter.

 

*************************

 

OGNL Blog Series:

 

  1. Introduction to OGNL
  2. A simple OGNL expression
  3. Declaring variables in OGNL
  4. Method calls in OGNL
  5. Arrays in OGNL
  6. OGNL: What about those curly braces?
  7. Looping in OGNL
  8. Looping in OGNL take 2
  9. So what exactly is #this in OGNL?
  10. A continuing look at #this variable in OGNL
  11. Functions in OGNL
  12. Misc Topics in OGNL

 

John DaSilva develops training and solutions at Ping Identity.