Skip to Content
author's profile photo Former Member
Former Member

How to get a reference to CallbackHandler?

I'm trying you use code from example in the manual to read Cookie from HttpRequest but it has and error, CallbackHandler is an interface. How can I get reference to CallbackHandler?



HttpGetterCallback getterCallback = new HttpGetterCallback ();



<b>// the string below is not right CallbackHandler is an interface

</b> CallbackHandler.handle(new Callback[] getterCallback});

// Gets the ticket that is in the cookies

Object value = getterCallback.getValue();

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Jul 23, 2004 at 08:22 AM

    Hi Andrei,

    Each implementation of LoginModule interface has an initialize method. This method is called by the LoginContext in order to initialize the LoginModule with the relevant information. One of the parameters passed to this method is the CallbackHandler. What you can do is to use this handler. For example:

    private CallbackHandler callbackHandler = null;

    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {


    this.callbackHandler = callbackHandler;



    And afterwards you can use callbackHandler like you wish:

    HttpGetterCallback getterCallback = new HttpGetterCallback();




    callbackHandler.handle(new Callback[]


    } catch (Exception e) {


    throw new LoginException("Callbacks invokation failed! " + e);


    Object value = getterCallback.getValue();

    Best regards,


    Add comment
    10|10000 characters needed characters exceeded