1 Reply Latest reply on Feb 7, 2008 4:03 AM by ron_sigal

    How to transmit client context info (eg username, host) with

    cusidevelopment

      Hello everybody,

      We do have a small problem, which we couldn't find a proper solution for within the docu or the forums?

      We are using JBoss Remoting (JBR) within our Eclipse RCP Client Application with Socket transportation to communicate with one of our server processes.

      We found already out, that JBR is internally working with a kind of session mechanism.

      The behaviour we want to achieve is, that once at the beginning of the communication or with every call client "context" information (username, host, ...) can be transmitted to the server.

      Is there a way to retrieve the sessionId on the server side, where we use a socket based TransportServer?

      In the forum we found a hint that we can get the used sessionId from ServerInvokerCallbackHandler. The question is how to retrieve it from our TransportServer?

      Any help or pointers into the right directions are highly appreciated

      kind regards
      CusiDev Team

        • 1. Re: How to transmit client context info (eg username, host)
          ron_sigal

          Each instance of org.jboss.remoting.Client is associated with a unique sessionId, which is transmitted with each invocation. In particular, if you call Client.invoke(), the invocation is wrapped in an instance of org.jboss.remoting.InvocationRequest, which carries the sessionId to the server, where it is passed to org.jboss.remoting.ServerInvocationHandler.invoke().

          If you want to add additional application information, you can pass an arbitrary map. E.g.,

          Map metadata = new HashMap();
          metadata.put("user", "monkeyman");
          Object o = ... ;
          client.invoke(o, metadata);
          


          and your ServerInvocationHandler can retrieve the map as follows:

           public Object invoke(InvocationRequest invocation) throws Throwable
           {
           Map metadata = invocation.getRequestPayload();
           System.out.println("user: " + metadata.get("user");
           ...
           }