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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.