1 / 36

J2EE Overview

J2EE Overview. Cohen Tzahi J2EE Technical Product Manager. J2EE Overview - Objectives. At the end of this session you will be able to: Understand the most common J2EE components. Understand the J2EE Application Server. Understand the J2EE terms. What Is J2EE…?.

hagop
Télécharger la présentation

J2EE Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. J2EE Overview Cohen Tzahi J2EE Technical Product Manager

  2. J2EE Overview - Objectives At the end of this session you will be able to: • Understand the most common J2EE components. • Understand the J2EE Application Server. • Understand the J2EE terms.

  3. What Is J2EE…? • The Java 2 Platform Enterprise Edition(J2EE) • Defines the standard for developing multitier enterprise applications. J2EE simplifies enterprise applications by basing them on standardized, modular components, by providing a complete set of services to those components, and by handling many details of application behavior automatically, without complexprogramming. http://java.sun.com/j2ee/overview.html

  4. J2EE For Enterprise Solutions • J2EE Technologies • Web • JSPs, Servlets, XML… • Middle Tier • EJBs, JDBC, JCA, JTA ... • Security • JAAS. • Name and Directory Server • JNDI. • Message Server • JMS. • And Many More…

  5. What Is J2EE Application Server The runtime portion of a J2EE product. A J2EE server provides EJB and Web containers

  6. Servlets • Request response model. • Web server receives request from clients and sends content as a response • Servlets are the Java platform technology. • Extending and enhancing Web servers. • Servlets provide a component-based, platform-independent method for building Web-based applications. • Servlets are server- and platform-independent. • Servlets have access to the entire family of Java APIs. • Servlets are Java classes running in Application Servers.

  7. Servlets public class HelloWorld extends HttpServlet { private static final String CONTENT_TYPE = "text/html; charset=windows-1252"; public void init(ServletConfig config) throws ServletException { super.init(config); } public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { response.setContentType(CONTENT_TYPE); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<head><title>HelloWorld</title></head>"); out.println("</html>"); out.close(); } }

  8. Servlets

  9. Servlets Application Server Client Web Server Response HTML http://localhost:7001/demoApplication/myServlet Servlet engine MyServlet

  10. HTTP Session • Session • A repository where Servlets can store per-client information. • Web servers and Servlets within them serve many clients. • Beside the Session, no client’s resources are kept on the web server. • Session is used to • keep information thatspans more than a single request/response.

  11. HTTP Session • Session is created upon a specific request. • HttpSession mySession = request.getSession() • Session’s Life Time: • Timeout expires. • Invalidation request. • Session Configuration • Available in the web.xml descriptor • Cache size. • Timeout. • Persistence store type. • Cookie enabled.

  12. Servlets Application Server Client Web Server Response HTML http://localhost:7001/demoApplication/myServlet Servlet engine MyServlet Session

  13. Cookies • Cookie…? • Small unit of data sent from a web server. • Name and Value pair. • Cookies are saved on the clients machine by the web browser. • Cookie mechanism enable to maintain state over HTTP.

  14. Http Session - Demo

  15. JSPs • Java Server Pages • Text scripts containing HMTL content embedded with Java code. • JSPs are built on Sun’s Servlet technology. • Dynamic content generators, using the Request – Response model. • Every JSP translated to a Servlet when its first requested.

  16. JSPs <H1 claiss="style4 style5">&nbsp;</H1> <H1 class="style4 style5">Search Results</H1> <table cellspacing="2" cellpadding="3" border="1" width="100%"> <tr> <td class="style4">First Name</td> <td class="style4">Last Name</td> <td class="style4">Email</td> <td class="style4">Phone</td> <td class="style4">Street</td> <td class="style4">City</td> <td class="style4">Country</td> <td class="style4">Zip</td> </tr> <% for (int i=0;i<contactsVec.size();i++) { contact = (ContactBean)contactsVec.elementAt(i);%> <tr> <td class="style4"><%=contact.getFirstName()%></td> <td class="style4"><%=contact.getLastName()%></td> <td class="style4"><%=contact.getEmail()%></td> <td class="style4"><%=contact.getPhoneNumber()%></td> <td class="style4"><%=contact.getStreet()%></td> <td class="style4"><%=contact.getCity()%></td> <td class="style4"><%=contact.getCountry()%></td> <td class="style4"><%=contact.getZip()%></td> </tr> <%}%> </table>

  17. JSPs VS. Servlets

  18. Web Container Application Server Web Server Servlet engine MyServlet Response HTML Client Session http://localhost:7001/demoApplication/myJSP JSP engine MyJSP

  19. Middle Tier Technologies • JDBC • JMS • JCA • JAAS • JMX • JSF • MBeans • EJBs • And Many More……

  20. JNDI • JNDI • An API for accessing Naming and Directory services. • Provides interface for looking up, searching, binding and unbinding objects. • Clients connecting to the Name Manager the client gets an InitialContext object. • The LookUp method returns an object that is bound to the name in the directory service

  21. EJBs Application Server Client Name Server EJB Container Web Server Response HTML http://localhost:7001/demoApplication/myServlet Servlet engine MyServlet Session Obj JSP engine MyJSP Client

  22. EJBs • Enterprise JavaBeans (EJB) • Server-side component architecture for the J2EE Platform. • EJBs are standard component architecture for building distributed object-oriented business applications in Java. • EJB technology enables rapid and simplified development of distributed, transactional, secure and portable applications based on Java technology.(http://java.sun.com) • An EJB can be developed once and then deployed on multiple platforms without recompilation or source code modification.

  23. EJB Container • EJB Container • Responsible for managing EJBs. • Performs resource management behind the scene, without the client awareness. • The EJBHome is implemented by the container. • Clients do not access EJBs directly, instead, the EJB container provides them with a layer of indirection, which enables rich functionalities such as scalability and high availability. This layer is provided by EJBRemote objects which the client use to perform operations on EJBs.

  24. EJBs Application Server Client Name Server EJB Container Web Server Response HTML http://localhost:7001/demoApplication/myServlet ContactEJB Servlet engine MyServlet MsgEJB Session Obj FlighsEJB PaymentEJB JSP engine MyJSP Client Client Client

  25. EJB Types EJB Session MDB EJB Stateless Stateful Bean Managed Container Managed

  26. Session EJBs • Models a business process. • Executes on behalf of a single client at any given time. • Can update shared data in an underlying database, but does not directly represent it. • Is relatively short-lived. • Is removed when the EJB Container crashes. • There are two kinds of Session EJBs: Stateless and Stateful

  27. Stateless Session EJBs • Single use service. • Does not maintain state on behalf of a client. • Does not survive server crashes. • All instances of a Stateless Session Bean are identical.

  28. Stateful Session EJBs • Represents a conversational service. • May be described as the client’s representative within the server. • Stores state on behalf of a client. • Does not survive server crashes. • Short lived. • Two instances of a Stateful Session EJB will never be identical

  29. Stateless VS. Stateful

  30. Entity EJBs • Provides an object view of data in a database. • It does not maintain state on behalf of a client. • Is Identified by a unique Primary-Key object. • Can be long-lived. (lives as long as the data in the database exists).

  31. MDB • Activated by the container when a JMS message arrives. • Similar to Stateless Session Bean – no state is kept on behalf of a client. • Is never explicitly activated by the client. JMS Client MDB Send onMessage() EJB Container

  32. J2EE Packaging • Zip format archive files are used to package components which comprise a J2EE application. • EJBs are packaged in JAR files. • Web components and web content are packaged in WAR files. • WAR and JAR files are packaged into EAR file. • EAR files represent J2EE applications. • The archive files contains both classes and configuration information. • The configuration information is written in deployment descriptors files.

  33. J2EE Packaging SE Training Demo J2EE Application WAR file structure

  34. J2EE Packaging SE Training Demo J2EE Application JAR file structure

  35. J2EE Packaging SE Training Demo J2EE Application EAR file structure

  36. The Big Picture

More Related