Allow to specifiy a method to retrieve context.

Add the possibility to retrieve the context
by a method.