[SIPForum-discussion] RES: SIP Servlet to HTTP Servlet

Kristine Regis kristine at racequeen.ph
Mon Aug 24 00:27:20 UTC 2009


Hello once again!

I am trying what you said but I really wonder how could I call the HTTP 
servlet from the SIP servlet. I really wonder about it. Hope you could 
help me with this question. Thank you very much..

-Kristine

Giscard Fernandes Faria wrote:
> Kristine,
>
> The SIP Servlet specification stands that both SIP and HTTP application
> must be in the same container... at this way I believe you can access
> them just by using the context (similar way we do in a web app).
> If both applications are packaged in the same war file, and the
> deployment
> Descriptor is OK, this should work.
>
> I believe you have everything working fine (because you can pass data
> from
> http to sip). Try to create a queue object using collections, put this
> queue
> on the ServletContext and exchange data between both http/sip servlet
> using
> this queue.
>
> Something like this:
>
> 	//one servlet create the queue and make it available on the
> context
> 	ArrayBlockingQueue queue = new...
>       ServletContext ctx = getServletContext();
>       ctx.setAttribute("queue", queue);
>
> 	//another servlet get the queue
>       ArrayBlockingQueue queue =
> getServletContext().getAttribute("queue");
>
>       //after keep reading and writing to the queue
>       //remember that this queue may block if there is no element to
> read
>
>
> Below is the text from sip servlet specification (available for free):
>
> 7.1 Relationship with HTTP Servlet Applications
> The directory structure used for SIP servlet applications is very
> similar to the one defined for HTTP servlets, in particular, the
> deployment descriptor, class files, libraries etc. of SIP servlet
> applications exists underneath the WEB-INF/ directory. This allows
> converged HTTP and SIP servlet applications to be packaged in a single
> archive file and deployed as a unit without having any part of the SIP
> application be interpreted as content to be published by the Web server.
>
> 7.2 Relationship to ServletContext
> The servlet container must enforce a one-to-one correspondence between a
> servlet application and a ServletContext. A ServletContext object
> provides a servlet with its view of the application. This is true for
> converged SIP and HTTP applications, also: all servlets within an
> application see the same ServletContext instance.
>
> Hope this can help
> Regards
> 	
> Giscard Fernandes Faria-  Software Engineering Department 
> NEC Brasil S.A.
> Phone +55 11 2166-2713 * Mobile + 55 11 8561-0710
> "There are no 'cookbook' methods that can replace intelligence,
> experience, and good taste in design and programming", Bjarne Stroustrup
>  
> giscardf at nec.com.br
>
>  
>  
>  
>  
>  
>  
> -----Mensagem original-----
> De: discussion-bounces at sipforum.org
> [mailto:discussion-bounces at sipforum.org] Em nome de Kristine Regis
> Enviada em: quinta-feira, 20 de agosto de 2009 00:12
> Para: discussion at sipforum.org
> Assunto: [SIPForum-discussion] SIP Servlet to HTTP Servlet
>
> Hi!
>
> I do not know if this is the right forum to handle my question but since
>
> my question is also related to SIP, I will take this opportunity to ask 
> here.
>
> I would like to know how can I pass a parameter from SIP servlet to HTTP
>
> Servlet. I already know from HTTP servlet going to SIP servlet but I do 
> not know how the vice versa of it. Please help me with this problem.. 
> Thank you very much!
>
> -Kristine
> _______________________________________________
> This is the SIP Forum discussion mailing list
> TO UNSUBSCRIBE, or edit your delivery options, please visit
> http://sipforum.org/mailman/listinfo/discussion
> Post to the list at discussion at sipforum.org
>
>   




More information about the discussion mailing list