[ 
http://issues.apache.org/jira/browse/DIRMINA-116?page=comments#action_12357396 
] 

Greg Bodi commented on DIRMINA-116:
-----------------------------------

Yes, putting it as a session attribute would accomplish the same thing.  
However, would it then be possible to expose IoProtocolSession.getIoSession() 
up to the IoSession interface so that I could still access it from a 
ProtocolHandler?  i.e.:

public void messageReceived(ProtocolSession session, Object message) throws 
Exception
{
  ...
  Service service = 
(Service)session.getIoSession().getAttribute(ServiceRegistry.SERVICE); 
  ...
}

Or, would it safe enough to try to cast down (i.e., make an assumption that's 
it not a VmPipeSession)? 

public void messageReceived(ProtocolSession session, Object message) throws 
Exception
{
  // not pretty, but fine if it works
  Service 
service=(Service)((IoProtocolSession)session).getIoSession().getAttribute(ServiceRegistry.SERVICE);
  ...
}

Or maybe is this somehow possible via another mechanism I overlooked?  Thanks!

> Get the Service from which a connection is accepted
> ---------------------------------------------------
>
>          Key: DIRMINA-116
>          URL: http://issues.apache.org/jira/browse/DIRMINA-116
>      Project: Directory MINA
>         Type: Improvement
>     Versions: 0.8
>     Reporter: Paolo Perrucci
>     Assignee: Trustin Lee
>     Priority: Minor
>      Fix For: 0.9

>
> When a new connection is accepted may be usefull to know the related Service.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to