









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










37 cs420 Fall 2010
CGI Based Webserver
CGI Based Webserver
Request CGI1 (^) Child for CGI CGI Based Webserver
Servlet Based Webserver
JVM
Request CGI1 (^) Child for CGI
Request Servlet
CGI Based Webserver
Servlet Based Webserver
JVM
Servlet
Request CGI1 (^) Child for CGI
Request CGI
Request Servlet
CGI Based Webserver
Child for CGI
Servlet Based Webserver
JVM
Servlet
Request CGI1 (^) Child for CGI
Request CGI
Request Servlet
Request Servlet
CGI Based Webserver
Child for CGI
Servlet Based Webserver
JVM
Servlet
Servlet
Request CGI1 (^) Child for CGI
Request CGI
Request CGI
Request Servlet
Request Servlet
CGI Based Webserver
Child for CGI
Child for CGI
Servlet Based Webserver
JVM
Servlet
Servlet
Request CGI1 (^) Child for CGI
This picture shows difference between CGI and servletโbased model. In CGI, for every HTTP request, a new process has to be created while in servlet model, it is the thread that gets created in the same Java VM (Virtual Machine) and that thread can stay there for serving other requests.
What is JSP Technology?
38 cs420 Fall 2010
Presentation is in the form of HTML or XML/XSLT Business logic is implemented as Java Beans or custom tags ` Better maintainability, reusability
JSP, Java Server Pages, was introduced as a follow โ on technology to the Servlet. Even though the Servlet solves many problems associated with CGI for dynamic contents generation, it has one downside. The downside is that, under Servlet, the presentation, typically HTML pages, has to be generated as part of the servlet Java code, for example, using printf statement. What this means is that whenever you have to make some change to the presentation, the Java code has to be changed and then recompiled, redeployed. This in turn result in maintenance problem of your applications. Also it makes web โ page prototyping effort rather a difficult task.
JSP is designed to address of this shortcoming of the Servlet while maintaining all the benefits of Servlet. That is, it provides a clear separation between the presentation and business logic code. That is, the presentation will be designed by Web page designers in the form of either HTML or XML or JSP page while the business logic will be implemented by Java programmers either in the form of Java Beans or custom tags. This separation will result in a better maintainability of both presentation pages and business code. And because the business logic is encapsulated into Java beans or custom tags, it increased re โ usability of the code as well.
I mentioned about custom tags. Custom tags are basically specialized Java beans which encapsulate the application โ specific business logic. The functionality of enterprise applications can be extended by building more custom tags.
Finally, JSP technology is built over servlet. In fact, JSP pages when deployed get converted into servlet first. Because it is built over servlet, it maintains all the benefits of servlet. For example, all the ready โ to โ use objects in a servlet such as session objects can be also available to JSP page designers and custom tag developers.
40 cs420 Fall 2010
What is EJB? In short, it is a server โ side component technology, which enable the easy development and deployment of Java โ based enterprise applications in the form of components that have to be enterprise โ quality, meaning they are transactional, distributed, multi โ tier, portable, scalable, secure, and reliable, and the list can go on.
41 cs420 Fall 2010
` Container provides system services
Over different J2EE-compliant servers Over different operational environments
` Deployment descriptor
Why EJB? By providing a standard component model on the server side, it leverages all the benefits that are inherent in component technology, for example, simplified development and deployment and reuse of the code.
Another key benefit of EJB is the separation of business logic from system code. That is, the EJB server platform provides all the system services such as resource management, transaction coordination and persistence management. Since the system services are provided by the server platform itself, you, as a developer, can now focus your development effort to building business logic components rather than system code.
Because EJB is built around industry โ standard component framework, because it is based on Java, it allows portability of your components. That is, the business logic components you build will be portable across different vendorsโ server platforms as well as different operational environments without any change in your code or without even recompiling. It is truly binary portability we are talking about.
Now you might want to ask? How do these components adapt themselves to the different operational environments? That is, different operational environments have different requirements on security policy, they have different databases in place , different transactional model maybe have to be used. How do you instruct your business components to a different behavior without actual change of code? It is done by what is called deployment descriptor. The deployment descriptor is essentially an XML file that specifies the runtime behavioral characteristics of your business component. And it gets constructed or changed at the time of deployment not at the time of code development.
Enterprise JavaBeans
43 cs420 Fall 2010
Enterprise JavaBeans
Entity Bean Message-Driven Bean
Synchronous communication Asynchronous communication
Stateless (^) Stateful
Bean managed Persistence (BMP)
Container managed Persistence (CMP)
Session Bean
Now EJB has three bean type โ session bean, entity bean, and message driven bean. And session bean can be either stateful or stateless session bean. And entity bean can be either bean managed or container managed.
And you as a developer choose which bean type to use depending on the needs and requirements of your application. For example, you use session bean when you have to have a client session and you use entity beans to reflect persistent data and you use message driven bean to receive messages in an asynchronous fashion. And we will talk about these bean types and their usage in gory detail later in this course.
44 cs420 Fall 2010
Messaging systems (MOM) provide De-coupled communication Asynchronous communication Plays a role of centralized post office Benefits of Messaging systems Flexible, Reliable, Scalable communication systems Point-to-Point, Publish and Subscribe JMS defines standard Java APIs to messaging systems
MOM: message Oriented Middleware
46 cs420 Fall 2010
JAAS: Authentication
47 cs420 Fall 2010
Userid/password Smartcard Kerberos Biometric
JAAS provides authentication scheme independent API Authentication schemes are specified Login configuration file, which will be read by JAAS
JAAS addresses both authentication and authorization. So let's talk about authentication aspect of JAAS first.
JAAS provides pluggable authentication framework. It is expected that different business organizations would employ different authentication schemes. Examples of authentication schemes they might use include userid/password based authentication, smartcard, Kerberos, or Biometric authentication.
The idea of JAAS pluggable authentication framework is to allow Java application that performs the authentication to be portable regardless of the underlying authentication schemes. So JAAS provides authentication scheme independent API that can be used by the Java application. There is also login configuration file that contains information on the authentication schemes that are deployed for a particular operational environment. And this login configuration file will be read by JAAS runtime.
JAAS: Authorization
49 cs420 Fall 2010
Without JAAS, Java platform security are based on Where the code originated _Who signed the code_ The JAAS API augments this with _Whoโs running the code_ User-based authorization is now possible
In terms of authorization, JAAS now adds the concept of โwho is running the codeโ to the matrix of access control. Before JAAS, the access control is based on two things: where the code originated and who signed the code. Now with JAAS, the access control is based on three things: where the code come from, who signed the code, and who is running the code. So with JAAS, userโbased authorization is finally possible.
JNDI
50 cs420 Fall 2010
Java Naming and Directory Interface Utilized by J2EE applications to locate resources and objects in portable fashion Applications use symbolic names to find object references to resources via JNDI The symbolic names and object references have to be configured by system administrator when the application is deployed.
JNDI stands for Java naming and directory interface and it is a common method for locating resources or objects under J2EE framework.
JNDI is utilized by J2EE applications to locate resources and objects in a portable fashion. That is, in your application, you are using a symbolic name to refer an object assuming that symbolic name has been configured to real object reference or resource by the system administrator. Because the system administrator can configure the association of the symbolic name and actual object at the time of deployment, the code portability is still assured.