This content has been marked as final.
Show 1 reply
-
1. Re: How to transmit client context info (eg username, host)
ron_sigal Feb 7, 2008 4:03 AM (in response to cusidevelopment)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"); ... }