Search This Blog

Wednesday 27 November 2013

Spring Security And Authorization

In a Java Web application, where authorization is involved, roles come into the picture. If a request is authorized to access a particular resource, then only will the Servlet Container allow it to work with the resource. How is the authorization decision made ?

Friday 22 November 2013

Remember Me... Spring Security

Login page in most web applications have a small check-box that says "Remember Me". Nothing new there. The cool part is spring security comes with this functionality ready made.
I decided to use the default login form to test the feature:

Sunday 17 November 2013

The Identity Hash Map

If we work with Maps in java than the keys need to implement equals and hashcode - Right ? Actually Wrong.

Tuesday 12 November 2013

Enums as the key in Map

In the previous post we saw how EnumSet is an optimized collection built for use with Enums. While I genuinely struggled to come up with scenarios where I could need a set of enums, I have often come across and used Enums as keys in my maps. Java has come up with an optimized collection for the above use case too - EnumMap.

Saturday 9 November 2013

A Set of Enums

Why would I need a collection Of Enums? Consider that we do have a simple enum:
public enum Rating {
Now if I want to get all the values I would call the Rating.values method. This would give me an array of Enums. Any reason why I would want a set of the same ?

Tuesday 5 November 2013

Components in JPA

We have used components in Hibernate. They provide a very good technique for code reuse. They are also useful if we do now want to represent a particular table as Entity and give them their own separate life cycle. JPA also provides support for components.

Friday 1 November 2013

Repeating and Delaying Tasks

The ExecutorService Interface is not the end of Executors. The package provides another specialized interface ScheduledExecutorService which is capable of executing tasks after a certain delay, or repeating tasks at fixed intervals.
I decided to test the interface.