1 / 22

Java Server and Servlet

Java Server and Servlet. CS616 Team 9 Kim Doyle, Susan Kroha, Arunima Palchowdhury, Wei Xu. Java Server and Servlet. History What is a Java Server/Servlet Architecture Pros and Cons Existing Java Servers Conclusion. History. Web has undergone rapid changes E-Commerce

ophrah
Download Presentation

Java Server and Servlet

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. Java Server and Servlet CS616 Team 9 Kim Doyle, Susan Kroha, Arunima Palchowdhury, Wei Xu

  2. Java Server and Servlet • History • What is a Java Server/Servlet • Architecture • Pros and Cons • Existing Java Servers • Conclusion

  3. History • Web has undergone rapid changes • E-Commerce • Transition from static to dynamic environment • Birth of Common Gateway Interface (CGI) • CGI languages include • Perl • C, C++ • Visual Basic Script

  4. HTML HTTP Web Server Database CGI bin Browser Process CGI Pros and Cons • Insecure • Platform dependent • Inefficient

  5. CGI vs. Servlet • Servlet is Sun’s solution for CGI • Both generate dynamic contents • Servlet is light • Servlet is secure • Servlet is platform independent • Servlet has better support for reusable component

  6. Java Server Definition • An instance of Java Virtual Machine • One Java Server can support multiple concurrent services • Java Server can start: • administrative services • HTTP services • web proxy services • Services are configured when server process is initiated

  7. Java Servlet Definition • Java class that runs in JVM associated with Server • Java object that conforms to a specific interface defined by the server architecture • Loaded and invoked by services • Multithreading • Extends the functionality of the server

  8. HTML HTTP Web Server Database Servlet Engine Browser Servlets Application Business Log. Server and Servlet Interaction

  9. Demo and Servlet Life Cycle Servlet Engine Init() doGet () HttpResponse Service () PrintWriter doPost () HttpRequest Do… () Destroy() Application Server link to Utopia link to Laptop

  10. Simple Sample (Hello World) import java.io.*; import javax.servlet.*; import javax.servlet.http.*;  public class HelloWorld extends HttpServlet {  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html><head><title>"); out.println("Hello World!</title>"); out.println("</head><body>"); out.println("<h1>Hello World!</h1>"); out.println("</body></html>"); }}

  11. Servlet Functions • Reads data sent by user • Looks up information from HTTP request • Connects to database • Invokes legacy application • Executes RMI or CORBA calls • Executes algorithm • Formats document • Sends document back to clients

  12. HTTP Algorithm Tomcat PANDA Servlets JDBC Project Group Assignment Servlets in Action link to Utopia Link to Laptop

  13. Servlet with Synchronization… public class AlgorithmRequest extends HttpServlet { public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ PrintWriter output; response.setContentType("text/html"); output = response.getWriter(); if(getConnection()){ String SemesterCourse = request.getParameter("SEMESTERCOURSE"); synchronized (this) { AlgorithmControl ac = new AlgorithmControl(SemesterCourse); …………………………………………

  14. Servlet Advantanges • Convenient • Efficient (light weight thread, memory) • Inexpensive • Keep intellectual properties on the server • Portable • Powerful • Secure

  15. Server Advantanges • Efficient • Memory management • Light weight • Platform independent • Thread-safe

  16. Server Considerations • Java is slower than C++ • However, Java server uses threads

  17. Java Servers or Engines • WebSphere from IBM • WebLogic from BEA • 9i Application Server from Oracle • Jrun from Allaire • iPlanet from Sun • Tomcat from Apache

  18. Apache and Tomcat • Industrial strength Web server • Tomcat is a servlet engine that can be plugged in with Apache • Apache and Tomcat can be down loaded from http://jakarta.apache.org • FREE!

  19. Servlet vs. PHP • PHP also free open source • PHP consists of tags in HTML document • Servlet is more widely supported • Servlet is written in Java with extensive API for: • database access • distributed objects • networking

  20. Servlet vs. ASP • ASP is a competing technology from Microsoft • Servlet is portable to • other operating systems • web servers • Servlet is more powerful for complex applications • Better support for reusable components

  21. Conclusion • Java server and servlet are • Economical • Portable • Powerful • Secure

  22. Thank You

More Related