CS4273: Distributed System Technologies and Programming Lecture 13: Review Final Exam 1. When and where? 2. Exam Type? – Close book exam. No teaching materials are allowed. 3. What are the questions? – 2 hours work (the length of your answer should match the marks of the question). – 5 questions (mostly programming questions). Answer all the questions. – Write your answers on the exam paper (use back side if extra space is needed). 4. How to prepare? – Understanding teaching materials, assignments, and tutorial questions. 2 WWW and Java programming • HTTP protocol – Operations of the HTTP protocol • GUI – – Event handling model Programming of simple event handling • Java applets – – – – Applet life cycle, Applet methods and applet programming format, Parameter passing, Inter-applet communication. 3 Java Multi-thread Programming • Thread definition & creation – Thread methods – Multi-threaded applets & servers • Thread mutual exclusion – Using keyword “synchronized” • Thread coordination – Using wait() / notify() or notifyAll for thread coordination and threadexecution control – Thread programming with coordination and mutual exclusion 4 Socket Communication • Client-server communication using sockets • Stream socket (connection oriented) and UDP socket (connectionless) • Applet and server communication using sockets 5 Web Searching • • • • • • Structure of web searching Spider operations (HTTP protocol) Web digraph Back links and backlink applications Page ranking Building inverted file for searching 6 CGI Programming • CGI life cycle • Applet and CGI servers (applet invokes CGI server) • Data exchange between applets & CGI servers (input /output of applets & CGI) • Design and execution of CGI servers 7 JDBC • JDBC fundamentals • 2-tier structure: Communication and data flow between – applet and DBMS • 3-tier structure: Communication and data-flow between – applet and CGI, – CGI and DBMS • Servlet with JDBC for database access 8 Java Servlet • Fundamental concepts of Java Servlet – Invocation of a servlet (servlet life cycle) – Communication between servlet and applet / browser (HTML forms) • HTTP Servlet Programming – – – – Get / Post methods Input / Output of servlets Servlet cookies Servlet sessions • Servlets as a middle tier of systems (DBMS, mail-server, etc.) 9 Security Programming • Fundamentals of security – Authentication, secure data transmission, and access control – SSL and https – Certificates, their applications and verification • Declarative security – Security configurations for authentication, servlets – BASIC method and FORM-based authentication – Switch to https • Combined declarative and program security – Authentication by declarative method and access control by programming method • Pure program security – Authentication, access control and switch to https – Session tracking for authenticated users 10 JSP • Fundamental concepts of JSP – – – • Why JSP How is a jsp program executed How to start a jsp program Be able to understand and write simple JSP programs – – – Inclusion of “Java” code Parameter passing Use of library or Java beans 11 Remote Method Invocation (RMI) • What is RMI (why to use RMI)? • Programming by using RMI: – – – – Interface definition Client side programming Server side programming Client – Server binding • Steps of constructing, compiling, and executing clients & servers • Applet and Server interaction by using RMI 12 An Example of Past Exam Question 3. [25 marks] Write a Java servlet that collects the order from clients and requests the mail server by using SMTP protocol to send the order to supplier@mailorder.com as an email. Suppose the mail server is on machine “mail.cityu.edu.hk” and its port number is 25. The following HTML form (the display image is given below) is used to take the mail orders from clients: <HTML><HEAD><TITLE>Mail Order Form </TITLE></HEAD> <BODY><H1> Mail Order (please complete the order form) <FORM ACTION="http://sus16.cs.cityu.edu.hk/js/servlet/MailOrder" METHOD="POST"> Name <input name="customer" size=47> <p> Postal-Address <input name="address" size=40> <p> Product-Name <input name="product" size=40> <p> Quantity <input name="quantity" size=40> <p> <INPUT TYPE="submit" VALUE="Submit Your Order"> </FORM></BODY></HTML> The servlet needs to reply the client after he/she submits the order, by displaying: Your order is under processing The email sent to the supplier should be in the form of: The following order has been received: Customer-name Product-name: Quantity 13