Skip to main content

SipFactory injection for converged JEE SIPServlet

3 replies [Last post]
hsmi
Offline
Joined: 2007-10-30

Hello

I was just taking a look at the click2call Sip servlet example.
One question if you please

it gets the sipfactory doing a JNDI lookup on its component environment , but on the SipFactory field I dont see @Resource annotation.... So how does it work ?

Can you point me to that binds the depency..

Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
deruelle_jean
Offline
Joined: 2003-06-24

There is 3 ways of getting the SipFactory :

through the JNDI context as seen in click to dial

through the @Resource annotation (which under the covers also look in the JNDI) as you can see here http://code.google.com/p/mobicents/source/browse/trunk/servers/sip-servl...

through the ServletContext in using
SipFactory sipFactory = (SipFactory) getServletContext().getAttribute(SIP_FACTORY);

Best regards,
Jean Deruelle

hsmi
Offline
Joined: 2007-10-30

I see, thanks , so how in fact does the SipFactory object get bound into the component environment ?

deruelle_jean
Offline
Joined: 2003-06-24

This is done internally in Tomcat extended classes. If an application has a sip.xml deployment descriptor or sip servlet annotations it will use the SipStandardContext (which extends Tomcat standard class StandardContext) which will bind the sip factory among other sip servlet utilities to the JNDI context.

You can take a look at http://code.google.com/p/mobicents/source/browse/trunk/servers/sip-servl... for Tomcat deployments or http://code.google.com/p/mobicents/source/browse/trunk/servers/sip-servl... for jboss deployments

Best regards
Jean