1 Reply Latest reply on Mar 17, 2006 10:26 AM by Thomas Termin

    Input the data into context in Swing

    khairul anwar Newbie

      Hi,

      I'm currently working on EJB's Interceptor. Whats a problem now is how can I input the data (say, userID) into the context, at the client side, so that it can be accessed using .getContextData(); ? The client is a Swing application. I don't want the client to be passed to the server side as a parameter.

      To make it clear, it's like this

      Swing apps
      ->input userID into context
      -------------

      V
      V

      In Server-side
      Interceptorclass(InvocationContext ctx){
      HashMapObject = (HashMap) ctx.getContextData();
      }
      -------------

      Thanks, a total newbie here.

        • 1. Re: Input the data into context in Swing
          Thomas Termin Newbie

          Hello,

          you should explain the problem a little bit more detailed.

          You can insert a value in a client interceptor and access it in the server interceptor.

          client interceptor:

          public Object invoke(Invocation invocation)
          {
           HashMap hm = new HashMap();
           invocation.setValue("key", hm);
          }


          server interceptor:
          public Object invoke(Invocation invocation)
          {
           HashMap hm = (HashMap)invocation.getValue("hm");
          }



          But I guess you have the problem then to get the data from the client-application accessible in the client interceptor. You could do this under some cirumstances with the ThreadLocal functionality.

          But I'm not sure if this is your problem.

          Thomas