prof simon pietro romano
play

Prof. Simon Pietro Romano Universit degli Studi di Napoli Federico - PowerPoint PPT Presentation

Corso di Applicazioni Telematiche A.A. 2010-11 Prof. Simon Pietro Romano Universit degli Studi di Napoli Federico II Facolt di Ingegneria Simon Pietro Romano AT 2011 1 Some background: what is a servlet ? Suns definition: A


  1. Corso di Applicazioni Telematiche A.A. 2010-11 Prof. Simon Pietro Romano Università degli Studi di Napoli Federico II Facoltà di Ingegneria Simon Pietro Romano – AT 2011 1

  2. Some background: what is a servlet ? Sun‟s definition: “A Java program that runs as part of a network service, typically an HTTP server and responds to requests from clients” Note well: “typically” an HTTP server…this leaves space to other types of servers! Simon Pietro Romano – AT 2011 2

  3. HTTP Servlets • Used for developing Web Applications • Servlets process HTTP Requests • Responses are sent back to the client as HTTP responses containing web pages • To provide custom functionality: – developers just override the doGet() and doPost() methods of the HTTP Servlet class • HTTP Servlets, together with their deployment descriptor (e.g. web.xml file) are: – packaged into a WAR (Web ARchive) file by the developer – deployed to the server by administrators • Container manages servlet‟s life cycle, replication of Session state, fail-over, authentication, security Simon Pietro Romano – AT 2011 3

  4. HTTP Servlet API Client Servlet Methods Web Container init() HTTP servlet service() Rules Request destroy() doGet() HTTP HTTP HTTP doPost() Response Response Response doPut() Error Error Response Response Simon Pietro Romano – AT 2011 4

  5. Why extending the Servlets model for SIP? • Servlets API is an open standard supported by multiple vendors • Containers manage Servlet‟s life cycle, session‟s state, fault-tolerance, scalability, security • Application‟s developers can focus solely on their application • HTTP Servlets are widely used in Web development – large community of developers already familiar with the concepts of the Servlets API • New Services developed as Servlets can interact with existing components, like HTTP Servlets or EJBs (Enterprise Java Beans) – converged applications!! Simon Pietro Romano – AT 2011 5

  6. SIP servlet goals • Application composition – one servlet can be called right after another servlet completes (execution chain…) • Converged applications – implementing applications that are both HTTP- and SIP- enabled • Caveats: – Neither application composition nor converged applications are well defined in JSR (Java Specification Request), yet: • JSR 116 (SIP servlet v1.0): – http://jcp.org/aboutJava/communityprocess/final/jsr116/index.html • JSR 289 (SIP servlet v1.1 Final Release, August 1 2008) – http://jcp.org/aboutJava/communityprocess/final/jsr289/index.html – Different SIP containers may act differently with respect to the above features… Simon Pietro Romano – AT 2011 6

  7. SIP Servlet Programming model • SIP Servlet API : – a specification developed by the communication industry in an attempt to standardize and speed up the development of services in SIP networks – Similar to the HTTP Servlet API, it is based on two key figures: • the SIP Servlet container • the SIP servlet Simon Pietro Romano – AT 2011 7

  8. SIP Servlet container • An Application Server (AS) with a built in SIP stack that: – is placed in a SIP network – listens to incoming SIP messages • When an incoming message arrives, the AS triggers one or more applications, which: – deal with the signalling – implement a certain service • Applications include, among other resources, SIP Servlets Simon Pietro Romano – AT 2011 8

  9. SIP servlets • Like HTTP servlets, SIP servlets are pieces of java code contained and managed by the SIP Servlet Container • They perform SIP signalling, by: – either answering incoming requests – or proxying them – or even creating new ones • This is a key difference with the HTTP Servlet API: – HTTP servlets can only answer HTTP requests Simon Pietro Romano – AT 2011 9

  10. SIP Servlet API Client SIP Container SIP Servlet Methods init() servlet service() destroy() Rules doInvite() SIP Message doAck() doOptions() doCancel() doRegister() doRequest() doPrack() Create doInfo() Request() doNotify() doMessage() SIP Message Create doSubscribe() Response() doProvisionalResponse() doSuccessResponse() doResponse() doErrorResponse() doRedirectResponse() Simon Pietro Romano – AT 2011 10

  11. HTTP servlets vs SIP servlets: differences SIP HTTP • HTTP signaling less complex • SIP signaling is much more complex – Only handles requests and – generates responses Handle and generate requests and responses, Session management, Proxying  HTTP servlets - the • SIP servlets - response can be doService() method is generated asynchronously expected to send a response within the same method call • Servlet mapping for SIP servlets is done by a set of rules evaluated at  HTTP request contains the runtime. Client applications are name of the Servlet to invoke not aware of applications installed in the request URI on the server Simon Pietro Romano – AT 2011 11

  12. HTTP servlets vs SIP servlets: similarities • Servlets invocation is triggered by events: – request  response • The container: – hides the low level protocol – exposes high level API – selects the appropriate servlet to invoke – manages servlet‟s life -cycle and session state • Developers: – override methods in the servlet‟s base class – provide specific implementation • Servlets are: – grouped into applications: web archive (“. war” ), sip archive (“. sar” ) – deployed with a deployment descriptor (“ web.xml” for HTTP , “sip.xml” for SIP) Simon Pietro Romano – AT 2011 12

  13. SIP Servlet Abstractions ServletRequest ServletResponse javax.servlet SipServletMessage javax.servlet.sip SipServletRequest SipServletResponse • SIP Servlet API: – several abstractions in the form of classes and interfaces • Pattern: – SipServlet extends GenericServlet as a SIP specialization – SipServletRequest extends ServletRequest – SipServletResponse extends ServletResponse – SipServletMessage extends ServletMessage Simon Pietro Romano – AT 2011 13

  14. Servlet Context • A sandbox inside the container where applications are executed • Every application has its own context where all its servlets run • Every context has its own class loader: – the isolation between applications is guaranteed – servlets of an application use the context primarily as a mechanism for communication between them Simon Pietro Romano – AT 2011 14

  15. SipServlet • The base class that developers „subclass‟ to implement their own servlets • Defines: – the lifecycle methods: • init,destroy – the message handling methods: • doRequest, doResponse, ... • Implements the default behaviour of the methods above Simon Pietro Romano – AT 2011 15

  16. Other classes • SipServletRequest and SipServletResponse: – encapsulate SIP requests and response messages, respectively – both provide access to: • relevant request and response information • handy methods for their process: – createResponse, createACK, createCancel, getProxy, send • SipServletMessage : – defines a number of methods which are common to SipServletRequest and SipServletResponse • e.g.: setters and getters for message headers and content • SipSession – SipSessions are used to maintain dialog state – every message belongs to a SipSession, i.e. the representation of the SIP dialog or call leg the message is engaged in Simon Pietro Romano – AT 2011 16

  17. SipApplicationSession • In many SIP applications (e.g. B2BUA) an incoming message sets up a dialog that leads to the initiation of other dialogs, each of them represented by their own SipSession: – such SipSessions are independent, yet related to the same execution of the service – we could think of them as an „application instance‟ • SipApplicationSession: – the above identified application instance – holds references to all the SipSessions (as well as HttpSessions in the case of converged applications) – provides methods to store application instance data Simon Pietro Romano – AT 2011 17

  18. Factory and Proxy • SipFactory – used to create new application sessions, requests, addresses and URI objects – servlets obtain a reference to it through a ServletContext attribute: • javax.servlet.sip.SipFactory • Proxy – represents a proxy operation – offers methods to configure several proxy aspects • whether it should be stateless or stateful, parallel or sequential, record routed or not, etc. – setting the proxy supervision flag configures how controlling servlet is to be invoked for subsequent events related to this proxying transaction: • incoming responses, CANCELs and ACKs Simon Pietro Romano – AT 2011 18

  19. SIP Servlet life cycle Simon Pietro Romano – AT 2011 19

  20. SIP Servlet methods Simon Pietro Romano – AT 2011 20

  21. SipSessions and Dialogs • SipSession: – can be roughly considered as the representation of a SIP dialog • it maintains dialog state • can be used to create subsequent requests inside a dialog via its createRequest(method) Simon Pietro Romano – AT 2011 21

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend