[jboss-user] [Remoting] - Re: How to transmit client context info (eg username, host)

ron.sigal@jboss.com do-not-reply at jboss.com
Thu Feb 7 04:03:11 EST 2008


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");
  |        ...
  |     }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127279#4127279

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127279



More information about the jboss-user mailing list