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 covered 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:
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:
- Introduction to OGNL
- A simple OGNL expression
- Declaring variables in OGNL
- Method calls in OGNL
- Arrays in OGNL
- OGNL: What about those curly braces?
- Looping in OGNL
- Looping in OGNL take 2
- So what exactly is #this in OGNL?
- A continuing look at #this variable in OGNL
- Functions in OGNL
- Misc Topics in OGNL
John DaSilva develops training and solutions at Ping Identity.