Web Technology for IE 20 November ISE 582: Information Technology for Industrial Engineering

Size: px
Start display at page:

Download "Web Technology for IE 20 November ISE 582: Information Technology for Industrial Engineering"

Transcription

1 ISE 582: Information Technology for Industrial Engineering Instructor: Elaine Chew University of Southern California Department of Industrial and Systems Engineering Lecture 11 JAVA Cup 10: Making Connections Winston & Narasimhan: Chapt Project: Submitting + Presenting Send icon and short description ASAP. By Thu, Dec 4, 12noon, send link to: source code, short description (classes, purpose, structure) introduction and user guide. Presentation, Dec 4, 6:30-9:10pm. Each team has 5 minutes. Powerpoint slides optional, no more than 5 slides. 20 November 2003 Web Technology for IE 2

2 JAVA Cup 10 JAR files for distribution Activating Remote Computations Servlets: Collecting Information 20 November 2003 Web Technology for IE 3 JAR Files for Distribution JAR stands for Java ARchive The Manifest File JAR-ing Class Files JAR-ing Packages JAR-ing Image Files Runing Applications from JAR files More on Manifest Files 20 November 2003 Web Technology for IE 4

3 Description JAR stands for Java ARchive Reasons to use JAR files: Simplifies program distribution Saves space and time Provides version management Enables security 20 November 2003 Web Technology for IE 5 The Manifest File Needs to be created before JAR file Minimally, needs one line to identify the starting application class: Main-Class: <application-starting class> Main-Class: MovieApplicationTestor Save file as, say, manifest.txt 20 November 2003 Web Technology for IE 6

4 The Command-line Jar Assume current directory contains all class files needed by your application The jar command is: jar -cmf <manifest-filename> <jar-filename>.jar *.class c = create a new JAR file m = use the following manifest file f = use the file name supplied jar -cmf manifest.txt MovieApplication.jar *.class 20 November 2003 Web Technology for IE 7 Jar-ing Packages Suppose your application is divided into packages (subdirectories): application model view The appropriate jar command is: jar -cmf manifest.txt MovieApplication.jar application model view 20 November 2003 Web Technology for IE 8

5 Including Image Files If images are in the image subdirectory:??? If images are in current directory:??? 20 November 2003 Web Technology for IE 9 Application Running the Application Command to start application from a jar file: java -jar <jar-filename>.jar java -jar MovieApplication.jar 20 November 2003 Web Technology for IE 10

6 More on the Manifest File Main-Class: MovieApplicationTestor Class-Path: Entertainment.jar package jar file used by application Name: application/ Specification-Title: "Application specifications" Specification-Version: "3.141" Specification-Vendor: "XYZ, Inc." Implementation-Title: "Application implementation" Implementation-Version: "Build 2.718" Implementation-Vendor: "XYZ, Inc." description Name: model/... Name: view/ November 2003 Web Technology for IE 11 Activating Remote Computations Why use remote computations? RMIs: Description and Example What the Server needs What the Client needs Server-side registry and compilation Client-side modifications Testing the code 20 November 2003 Web Technology for IE 12

7 Why Use Remote Computations? client server 20 November 2003 Web Technology for IE 13 Example of Remote Computations Search for extraterrestrials - or extra cash Users let home PCs crunch scientific data in down time By Doug Bedell / The Dallas Morning News (12/02/99) Humans use only a fraction of their brain power, and the Internet is no different. The millions of often-idle computers connected to the Net are, in the eyes of some researchers, a wasted resource of criminal proportion. Recently, several groups have developed small programs that can take advantage of idle home and office units, putting them to work on worldwide projects for fun and profit. And the response from the public has been incredible. The Search for Extraterrestrial Intelligence, or SETI, for example, began doling out chunks of radio telescope data to volunteer computers in May. By October, spurred by the success of the movie Contact, it had enlisted more than 1.4 million "volunteer computers" worldwide in the organization's quest to isolate signals emanating from beyond our galaxy 20 November 2003 Web Technology for IE 14

8 RMIs: Description RMI stands for Remote Method Invocation RMIs enables a client computer to run a method on a server computer server-side instance is method target client-side instance is argument 20 November 2003 Web Technology for IE 15 RMIs: Example public class RatingServer { public int serverrating (Movie m) { System.out.println("RatingServer asked for a rating"); int s = m.getscript(); int a = m.getacting(); int d = m.getdirection(); return 3 * Math.max(Math.max(s, a), d); 20 November 2003 Web Technology for IE 16

9 Substituting the new rating server-side instance is method target client-side instance is argument movie.rating() becomes (new RatingServer()).serverRating(movie) 20 November 2003 Web Technology for IE 17 import java.rmi.*; import java.math.*; Test Program public class ClientStub { public static void main(string args[]) { Movie movie = new Movie(2, 3, 8, Lord of the Rings"); RatingServer ratingserver = new RatingServer(); int rating = ratingserver.serverrating(movie); System.out.println("The server returned a rating of " + rating); --- Result --- RatingServer asked for a rating The server returned a rating of November 2003 Web Technology for IE 18

10 What the Server needs RatingServer needs to know all the methods and method signatures for the Movie class. where can this be found? Introduce serializability in Movie classes why do you think this is necessary? 20 November 2003 Web Technology for IE 19 What the Server needs: E.g. import java.io.*; public interface MovieInterface extends Serializable { // Setters public abstract void setscript (int i) ; public abstract void setacting (int i) ; public abstract void setdirection (int i) ; // Getters public abstract int getscript () ; public abstract int getacting () ; public abstract int getdirection () ; public abstract String gettitle () ; public abstract String getposter () ; // Miscellaneous methods public abstract int rating () ; public abstract void changed () ; 20 November 2003 Web Technology for IE 20

11 What the client needs ClientStub needs to know that serverrating exists in ServerRating class where can this information be found? Introduce the Remote interface informs compiler that method is to be called by a client and run on a server 20 November 2003 Web Technology for IE 21 What the client needs: E.g. import java.io.*; import java.rmi.*; public interface RatingServerInterface extends Remote { public abstract int serverrating(movieinterface m) throws RemoteException ; 20 November 2003 Web Technology for IE 22

12 Modified RatingServer import java.rmi.*; public class RatingServer implements RatingServerInterface { public int serverrating (MovieInterface m) throws RemoteException { System.out.println("RatingServer asked for a rating"); int s = m.getscript(); int a = m.getacting(); int d = m.getdirection(); return 3 * Math.max(Math.max(s, a), d); 20 November 2003 Web Technology for IE 23 Modified ClientStub import java.rmi.*; import java.math.*; public class ClientStub { public static void main(string args[]) throws RemoteException { Movie movie = new Movie(2, 3, 8, Lord of the Rings"); RatingServerInterface ratingserver = new RatingServer(); int rating = ratingserver.serverrating(movie); System.out.println("The server returned " + rating); 20 November 2003 Web Technology for IE 24

13 Further Modifications import java.rmi.*; import java.rmi.server.*; public class RatingServer extends UnicastRemoteObject implements RatingServerInterface, Serializable { public RatingServer () throws RemoteException { super(); public int serverrating (MovieInterface m) throws RemoteException { System.out.println("RatingServer asked for a rating"); int s = m.getscript(); int a = m.getacting(); int d = m.getdirection(); return 3 * Math.max(Math.max(s, a), d); 20 November 2003 Web Technology for IE 25 The Registry Clients / servers communicate via a registry running on the server. Need a connection with server s registry program to create a RatingServer instance that can receive method calls from a client. Connect via Naming.rebind( //<hostname>/<name>, <remotely-accessible-instance> ) host-identifier usually is localhost Rebind and RatingServer constructors throw exceptions. Call using try-catch statements. 20 November 2003 Web Technology for IE 26

14 In RatingServer Class yada yada yada public static void main(string[] args) { try { Naming.rebind("//localhost/ratingService", new RatingServer()); System.out.println("Rating server connected to server"); catch (Exception e) { System.err.println("RatingServer exception: " + e.getmessage()); e.printstacktrace(); yada yada yada 20 November 2003 Web Technology for IE 27 Server-side Compilation Compile the java program on the server side twice using: javac RatingServer.java rmic RatingServer 20 November 2003 Web Technology for IE 28

15 Client-side modifications Client-side program now needs to access the remote instance of the RatingServer class Naming.lookup(//<hostname>/<name>) Use try-catch to deal with thrown exceptions Compile with javac 20 November 2003 Web Technology for IE 29 In ClientStub yada yada yada public static void main(string args[]) { Movie movie = new Movie(2, 3, 8, Lord of the Rings"); try { String computer = "whitney.ai.mit.edu"; System.out.println( Client asking, +computer+",for rating"); RatingServerInterface ratingserver=(ratingserverinterface) (Naming.lookup("//" + computer +"/ratingservice")); int rating = ratingserver.serverrating(movie); System.out.println(computer+ returned "+rating); catch (Exception e) { System.err.println("Rating client exception: " + e.getmessage()); e.printstacktrace(); yada yada yada 20 November 2003 Web Technology for IE 30

16 Testing the Code Client start ClientStub using java ClientStub Server start registry on window1 using rmiregistry command start server program on win2 using java RatingServer 20 November 2003 Web Technology for IE 31 Description Calling a servlet from an HTML link Servlet Startup Defining a Servlet How a Servlet gets Form values Managing Multiple Requests Servlets Storing Information on Client Computer 20 November 2003 Web Technology for IE 32

17 Servlets: Description A servlet is a program activated by a client browser and run on a servlet server How is this different from an applet? Servlet stands for server+applet, a little server-side application Two ways to call a servlet: Specify servlet name in an HTML link Use HTML forms 20 November 2003 Web Technology for IE 33 Calling servlets from an HTML link Click on link, A file, servlets.properties, contains a table that relates servlet names to class names: E.g. startcritic.code=getcriticformservlet Servlet server looks up startcritic in file to find GetCriticFormServlet A GetCriticFormServlet instance is constructed The init() method is called The doget() method is called HTML-decorated text is returned to browser 20 November 2003 Web Technology for IE 34

18 Servlet Communication Diagram Browser Servlet name identified in location field Servlet Server Servlet doget method servlets.properties file 20 November 2003 Web Technology for IE 35 Servlet Startup Where you put your servlets and servlets.properties file depends on the servlet server you happen to use The ritual to start up the servlet server also depends on your server. Example: startserver stopserver 20 November 2003 Web Technology for IE 36

19 Extend the HttpServlet class Defining a Servlet Define a shadowing doget() method. Method has two parameters: request (information about the request) response (information to return to browser) Servlet returns information contained in response instance to client 20 November 2003 Web Technology for IE 37 Servlet Example import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class GetCriticFormServlet extends HttpServlet { public void doget (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setcontenttype("text/html"); PrintWriter output = response.getwriter(); output.println( <HTML><HEAD><TITLE> "); output.println( Movie Vote! "); output.println( </TITLE></HEAD><BODY> "); output.println( </BODY></HTML> "); output.flush(); 20 November 2003 Web Technology for IE 38

20 How a Servlet gets Form values Form has to specify: < form method=get action=<servlet> > < input type=? name=?? value=??? > Servlet deploys the getparameter method, for example: String title = request.getparameter( title ); String script = request.getparameter( script ); String action = request.getparameter( action ); 20 November 2003 Web Technology for IE 39 Managing Multiple Requests If your servlet writes info to a file, what if one client s work is underway when another arrives? Avoid multiple-thread toe stomping by having your servlets implement SingleThreadModel interface 20 November 2003 Web Technology for IE 40

21 Storing Info on Client Computer To store information on a client computer, you have your servlet establish cookies on the client computer Cookies have names and values (Strings) Cookie cookie = new Cookie( votes, 0 ); Add cookie to the response instance response.addcookie(cookie); // do before accessing writer Cookie size is limited (a few kilobytes) Cookies die when they get too old cookie.setmaxage(60*60*24*365); 20 November 2003 Web Technology for IE 41 Accessing Cookies Cookies [] cookies = request.getcookies(); for (int i = 0; i < cookies.length; ++i) { if("votes".equals(cookies[i].getname())) {... cookies[i].getvalue()... Same name can have multiple values E.g. One user can evaluate many movies Browsers are not obliged to store an indefinite number of movies To be safe, do not store more than 10 Cookies are not servlet-specific Can be used to communicate among servlets Cookies are URL-specific 20 November 2003 Web Technology for IE 42

22 What Have You Learnt How to create your homepage How to create HTML forms The basics of UML notation What it means to be object-oriented Encapsulation, inheritance, polymorphism 20 November 2003 Web Technology for IE 43 What Have You Learnt How to create classes, instances and methods, including: get / set methods constructors How to create programs that solve problems. Techniques include: Loops, recursion, conditional statements How to work with basic data structures: Characters and Strings stressed Arrays and Vectors desserts 20 November 2003 Web Technology for IE 44

23 What Have You Learnt Good programming practices Enforcing abstraction using private and public variables Enforcing requirements using abstract methods and classes Documenting programs using interfaces Modularizing programs using compilation units and packages Use JAR files for program distribution 20 November 2003 Web Technology for IE 45 What Have You Learnt How to read / write from / to files using Input / output streams Buffers / tokenizers How to create GUIs Drawing lines in windows Writing text in windows Creating forms that fire events Creating choice lists Incorporating images 20 November 2003 Web Technology for IE 46

JAVA RMI. Remote Method Invocation

JAVA RMI. Remote Method Invocation 1 JAVA RMI Remote Method Invocation 2 Overview Java RMI is a mechanism that allows one to invoke a method on an object that exists in another address space. The other address space could be: On the same

More information

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Enterprise Edition Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Beans Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 2 Java Bean POJO class : private Attributes public

More information

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http?

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http? What are Servlets? Servlets1 Fatemeh Abbasinejad abbasine@cs.ucdavis.edu A program that runs on a web server acting as middle layer between requests coming from a web browser and databases or applications

More information

03 Remote invocation. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI

03 Remote invocation. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI 03 Remote invocation Request-reply RPC Coulouris 5 Birrel_Nelson_84.pdf RMI 2/16 Remote Procedure Call Implementation client process Request server process client program client stub procedure Communication

More information

Java WebStart, Applets & RMI

Java WebStart, Applets & RMI Java WebStart, Applets & RMI 11-13-2013 Java WebStart & Applets RMI Read: Java Web Start Tutorial Doing More with Rich Internet Applications Java Web Start guide Exam#2 is scheduled for Tues., Nov. 19,

More information

Advanced Internet Technology Lab # 4 Servlets

Advanced Internet Technology Lab # 4 Servlets Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 4 Servlets Eng. Doaa Abu Jabal Advanced Internet Technology Lab # 4 Servlets Objective:

More information

JAVA SERVLET. Server-side Programming INTRODUCTION

JAVA SERVLET. Server-side Programming INTRODUCTION JAVA SERVLET Server-side Programming INTRODUCTION 1 AGENDA Introduction Java Servlet Web/Application Server Servlet Life Cycle Web Application Life Cycle Servlet API Writing Servlet Program Summary 2 INTRODUCTION

More information

CS 5523 Operating Systems: Remote Objects and RMI

CS 5523 Operating Systems: Remote Objects and RMI CS 5523 Operating Systems: Remote Objects and RMI Instructor: Dr. Tongping Liu Thank Dr. Dakai Zhu and Dr. Palden Lama for providing their slides. Outline Distributed/Remote Objects Remote object reference

More information

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR Installing a Web Server 1. Install a sample web server, which supports Servlets/JSPs. A light weight web server is Apache Tomcat server. You can get the server from http://tomcat.apache.org/ 2. Follow

More information

Web based Applications, Tomcat and Servlets - Lab 3 -

Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta The Basic Web Server CMPUT 391 Database Management

More information

Java4570: Session Tracking using Cookies *

Java4570: Session Tracking using Cookies * OpenStax-CNX module: m48571 1 Java4570: Session Tracking using Cookies * R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0 Abstract

More information

To follow the Deitel publishing program, sign-up now for the DEITEL BUZZ ON-

To follow the Deitel publishing program, sign-up now for the DEITEL BUZZ ON- Ordering Information: Advanced Java 2 Platform How to Program View the complete Table of Contents Read the Preface Download the Code Examples To view all the Deitel products and services available, visit

More information

Remote Objects and RMI

Remote Objects and RMI Outline Remote Objects and RMI Instructor: Dr. Tongping Liu Distributed/Remote Objects Remote object reference (ROR) Remote Method Invocation (RMI) Case study and example: Java RMI Other issues for objects

More information

********************************************************************

******************************************************************** ******************************************************************** www.techfaq360.com SCWCD Mock Questions : Servlet ******************************************************************** Question No :1

More information

Remote Method Invocation

Remote Method Invocation Remote Method Invocation A true distributed computing application interface for Java, written to provide easy access to objects existing on remote virtual machines Provide access to objects existing on

More information

Servlet Basics. Agenda

Servlet Basics. Agenda Servlet Basics 1 Agenda The basic structure of servlets A simple servlet that generates plain text A servlet that generates HTML Servlets and packages Some utilities that help build HTML The servlet life

More information

CSci Introduction to Distributed Systems. Communication: RPC In Practice

CSci Introduction to Distributed Systems. Communication: RPC In Practice CSci 5105 Introduction to Distributed Systems Communication: RPC In Practice Linux RPC Language-neutral RPC Can use Fortran, C, C++ IDL compiler rpgen N to generate all stubs, skeletons (server stub) Example:

More information

Advanced Java Programming

Advanced Java Programming Advanced Java Programming Length: 4 days Description: This course presents several advanced topics of the Java programming language, including Servlets, Object Serialization and Enterprise JavaBeans. In

More information

5.4. Events and notifications

5.4. Events and notifications 5.4. Events and notifications Distributed event-based systems extend local event model Allowing multiple objects at diff. locations to be notified of events taking place at an object Two characteristics:

More information

Servlet Fudamentals. Celsina Bignoli

Servlet Fudamentals. Celsina Bignoli Servlet Fudamentals Celsina Bignoli bignolic@smccd.net What can you build with Servlets? Search Engines E-Commerce Applications Shopping Carts Product Catalogs Intranet Applications Groupware Applications:

More information

RMI. Remote Method Invocation. 16-Dec-16

RMI. Remote Method Invocation. 16-Dec-16 RMI Remote Method Invocation 16-Dec-16 The network is the computer Consider the following program organization: method SomeClass call AnotherClass returned object computer 1 computer 2 If the network is

More information

Written by: Dave Matuszek

Written by: Dave Matuszek RMI Remote Method Invocation Written by: Dave Matuszek appeared originally at: http://www.cis.upenn.edu/~matuszek/cit597-2003/ 28-May-07 The network is the computer * Consider the following program organization:

More information

1 interface TemperatureSensor extends java.rmi.remote 2 { 3 public double gettemperature() throws java.rmi.remoteexception; 4 public void

1 interface TemperatureSensor extends java.rmi.remote 2 { 3 public double gettemperature() throws java.rmi.remoteexception; 4 public void 1 interface TemperatureSensor extends java.rmi.remote 2 { 3 public double gettemperature() throws java.rmi.remoteexception; 4 public void addtemperaturelistener ( TemperatureListener listener ) 5 throws

More information

CS506 Web Design & Development Final Term Solved MCQs with Reference

CS506 Web Design & Development Final Term Solved MCQs with Reference with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar

More information

Contents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A

Contents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A Contents Java RMI G53ACC Chris Greenhalgh Java RMI overview A Java RMI example Overview Walk-through Implementation notes Argument passing File requirements RPC issues and RMI Other problems with RMI 1

More information

SERVLETS INTERVIEW QUESTIONS

SERVLETS INTERVIEW QUESTIONS SERVLETS INTERVIEW QUESTIONS http://www.tutorialspoint.com/servlets/servlets_interview_questions.htm Copyright tutorialspoint.com Dear readers, these Servlets Interview Questions have been designed especially

More information

Remote Method Invocation in Java

Remote Method Invocation in Java Remote Method Invocation in Java Ajay Khatri Senior Assistant Professor,Department IT Acropolis Institute of Technology & Research ajay.acropolis@gmail.com What is RMI RMI is an API that provides a mechanism

More information

Distributed Systems. Distributed Object Systems 2 Java RMI. Java RMI. Example. Applet continued. Applet. slides2.pdf Sep 9,

Distributed Systems. Distributed Object Systems 2 Java RMI. Java RMI. Example. Applet continued. Applet. slides2.pdf Sep 9, Distributed Object Systems 2 Java RMI Piet van Oostrum Distributed Systems What should a distributed system provide? Illusion of one system while running on multiple systems Transparancy Issues Communication,

More information

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark Network Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark jbb@ase.au.dk Outline Socket programming If we have the time: Remote method invocation (RMI) 2 Socket Programming Sockets

More information

The Servlet Life Cycle

The Servlet Life Cycle The Servlet Life Cycle What is a servlet? Servlet is a server side component which receives a request from a client, processes the request and sends a content based response back to the client. The Servlet

More information

Outline. Chapter 4 Remote Procedure Calls and Distributed Transactions. Remote Procedure Call. Distributed Transaction Processing.

Outline. Chapter 4 Remote Procedure Calls and Distributed Transactions. Remote Procedure Call. Distributed Transaction Processing. Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

The UNIVERSITY of EDINBURGH. SCHOOL of INFORMATICS. CS4/MSc. Distributed Systems. Björn Franke. Room 2414

The UNIVERSITY of EDINBURGH. SCHOOL of INFORMATICS. CS4/MSc. Distributed Systems. Björn Franke. Room 2414 The UNIVERSITY of EDINBURGH SCHOOL of INFORMATICS CS4/MSc Distributed Systems Björn Franke bfranke@inf.ed.ac.uk Room 2414 (Lecture 3: Remote Invocation and Distributed Objects, 28th September 2006) 1 Programming

More information

Last Class: Network Overview. Today: Distributed Systems

Last Class: Network Overview. Today: Distributed Systems Last Class: Network Overview =>Processes in a distributed system all communicate via a message exchange. Physical reality: packets Abstraction: messages limited size arbitrary size unordered (sometimes)

More information

IBD Intergiciels et Bases de Données

IBD Intergiciels et Bases de Données IBD Intergiciels et Bases de Données RMI-based distributed systems Fabien Gaud, Fabien.Gaud@inrialpes.fr Overview of lectures and practical work Lectures Introduction to distributed systems and middleware

More information

Introduction to Servlets. After which you will doget it

Introduction to Servlets. After which you will doget it Introduction to Servlets After which you will doget it Servlet technology A Java servlet is a Java program that extends the capabilities of a server. Although servlets can respond to any types of requests,

More information

AJP. CHAPTER 5: SERVLET -20 marks

AJP. CHAPTER 5: SERVLET -20 marks 1) Draw and explain the life cycle of servlet. (Explanation 3 Marks, Diagram -1 Marks) AJP CHAPTER 5: SERVLET -20 marks Ans : Three methods are central to the life cycle of a servlet. These are init( ),

More information

Chapter 4 Remote Procedure Calls and Distributed Transactions

Chapter 4 Remote Procedure Calls and Distributed Transactions Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

Communication and Distributed Processing

Communication and Distributed Processing Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

IJESRT. http: //

IJESRT. http: // IJESRT [Monika,1(4): Jun., 2012] INTERNATIONAL JOURNAL OF ENGINEERING SCIENCES & RESEARCH TECHNOLOGY Innovative Techniquee of Message Passing In Loosely Coupled System Monika Arya* Department of Computer

More information

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call 4.3 Remote procedure calls RPC flow Client process Server process Program i = sum (3,7); Procedure sum (j,k) int j,k; {return j+k; Client stub Program Return Call Unpack Pack result para s Invisible to

More information

Remote Procedure Call

Remote Procedure Call Remote Procedure Call Suited for Client-Server structure. Combines aspects of monitors and synchronous message passing: Module (remote object) exports operations, invoked with call. call blocks (delays

More information

Object Interaction. Object Interaction. Introduction. Object Interaction vs. RPCs (2)

Object Interaction. Object Interaction. Introduction. Object Interaction vs. RPCs (2) Introduction Objective To support interoperability and portability of distributed OO applications by provision of enabling technology Object interaction vs RPC Java Remote Method Invocation (RMI) RMI Registry

More information

Chapter 17. Web-Application Development

Chapter 17. Web-Application Development Chapter 17. Web-Application Development Table of Contents Objectives... 1 17.1 Introduction... 1 17.2 Examples of Web applications... 2 17.2.1 Blogs... 2 17.2.2 Wikis... 2 17.2.3 Sakai... 3 17.2.4 Digital

More information

Communication and Distributed Processing

Communication and Distributed Processing Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University CS 555: DISTRIBUTED SYSTEMS [RMI] Frequently asked questions from the previous class survey Shrideep Pallickara Computer Science Colorado State University L21.1 L21.2 Topics covered in this lecture RMI

More information

presentation DAD Distributed Applications Development Cristian Toma

presentation DAD Distributed Applications Development Cristian Toma Lecture 8 S4 - Core Distributed Middleware Programming in JEE presentation DAD Distributed Applications Development Cristian Toma D.I.C.E/D.E.I.C Department of Economic Informatics & Cybernetics www.dice.ase.ro

More information

Distributed Systems. 5. Remote Method Invocation

Distributed Systems. 5. Remote Method Invocation Distributed Systems 5. Remote Method Invocation Werner Nutt 1 Remote Method Invocation 5.1 Communication between Distributed Objects 1. Communication between Distributed Objects 2. RMI 2 Middleware Middleware

More information

Desarrollo de Aplicaciones en Red RMI. Introduction. Considerations. Considerations. RMI architecture

Desarrollo de Aplicaciones en Red RMI. Introduction. Considerations. Considerations. RMI architecture session Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano RMI Remote Method Invocation Introduction Java RMI let s work calling remote methods. Underneath it works with

More information

Introduction to Java Servlets. SWE 432 Design and Implementation of Software for the Web

Introduction to Java Servlets. SWE 432 Design and Implementation of Software for the Web Introduction to Java Servlets James Baldo Jr. SWE 432 Design and Implementation of Software for the Web Web Applications A web application uses enabling technologies to 1. make web site contents dynamic

More information

RMI (Remote Method Invocation) Over the year, there have been 3 different approaches to application development:

RMI (Remote Method Invocation) Over the year, there have been 3 different approaches to application development: RMI (Remote Method Invocation) History: Over the year, there have been 3 different approaches to application development: 1. the traditional approach. 2. the client / server approach and 3. the component-

More information

Session 20 Data Sharing Session 20 Data Sharing & Cookies

Session 20 Data Sharing Session 20 Data Sharing & Cookies Session 20 Data Sharing & Cookies 1 Reading Shared scopes Java EE 7 Tutorial Section 17.3 Reference http state management www.ietf.org/rfc/rfc2965.txt Cookies Reading & Reference en.wikipedia.org/wiki/http_cookie

More information

RMI Case Study. A Typical RMI Application

RMI Case Study. A Typical RMI Application RMI Case Study This example taken directly from the Java RMI tutorial http://java.sun.com/docs/books/tutorial/rmi/ Editorial note: Please do yourself a favor and work through the tutorial yourself If you

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:

More information

Bharati Vidyapeeth s Institute of Computer Applications and Management A-4, Paschim Vihar, New Delhi-63.

Bharati Vidyapeeth s Institute of Computer Applications and Management A-4, Paschim Vihar, New Delhi-63. Bharati Vidyapeeth s Institute of Computer Applications and Management A-4, Paschim Vihar, New Delhi-63. MCA III rd Semester Second Internal: Java Programming (MCA-205) Note: All the questions are compulsory.

More information

JdbcResultSet.java. import java.sql.*;

JdbcResultSet.java. import java.sql.*; 1)Write a program to display the current contents of the tables in the database where table name is Registration and attributes are id,firstname,lastname,age. JdbcResultSet.java import java.sql.*; public

More information

Using Java servlets to generate dynamic WAP content

Using Java servlets to generate dynamic WAP content C H A P T E R 2 4 Using Java servlets to generate dynamic WAP content 24.1 Generating dynamic WAP content 380 24.2 The role of the servlet 381 24.3 Generating output to WAP clients 382 24.4 Invoking a

More information

Component-Based Software Engineering

Component-Based Software Engineering Component-Based Software Engineering Remote Method Invocation Paul Krause Introduction to RMI Lecture 11 - RMI Simple Example - DivideServer Demo of this example Review a more complex example - StudentEnrollment

More information

Distributed Systems. 02r. Java RMI Programming Tutorial. Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017

Distributed Systems. 02r. Java RMI Programming Tutorial. Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017 Distributed Systems 02r. Java RMI Programming Tutorial Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017 1 Java RMI RMI = Remote Method Invocation Allows a method to be invoked that resides

More information

Grid Computing. Java Remote Method Invocation (RMI) RMI Application. Grid Computing Fall 2006 Paul A. Farrell 9/5/2006

Grid Computing. Java Remote Method Invocation (RMI) RMI Application. Grid Computing Fall 2006 Paul A. Farrell 9/5/2006 Grid Computing Paradigms for Distributed Computing 2 RMI Fall 2006 Traditional paradigms for distributed computing The Grid: Core Technologies Maozhen Li, Mark Baker John Wiley & Sons; 2005, ISBN 0-470-09417-6

More information

Session 8. Introduction to Servlets. Semester Project

Session 8. Introduction to Servlets. Semester Project Session 8 Introduction to Servlets 1 Semester Project Reverse engineer a version of the Oracle site You will be validating form fields with Ajax calls to a server You will use multiple formats for the

More information

Advanced Web Technology

Advanced Web Technology Berne University of Applied Sciences Dr. E. Benoist Winter Term 2005-2006 Presentation 1 Presentation of the Course Part Java and the Web Servlet JSP and JSP Deployment The Model View Controler (Java Server

More information

Lab 2 : Java RMI. request sayhello() Hello interface remote object. local object. response "Hello world"

Lab 2 : Java RMI. request sayhello() Hello interface remote object. local object. response Hello world Lab 2 : Java RMI 1. Goals In this lab you will work with a high-level mechanism for distributed communication. You will discover that Java RMI provides a mechanism hiding distribution in OO programming.

More information

JAC444 - Lecture 11. Remote Method Invocation Segment 2 - Develop RMI Application. Jordan Anastasiade Java Programming Language Course

JAC444 - Lecture 11. Remote Method Invocation Segment 2 - Develop RMI Application. Jordan Anastasiade Java Programming Language Course JAC444 - Lecture 11 Remote Method Invocation Segment 2 - Develop RMI Application 1 Remote Method Invocation In this lesson you will be learning about: Designing RMI application Developing distributed object

More information

Distributed Systems COMP 212. Lecture 10 Othon Michail

Distributed Systems COMP 212. Lecture 10 Othon Michail Distributed Systems COMP 212 Lecture 10 Othon Michail RMI: Remote Method Invocation Allows an object running in one Java virtual machine to invoke methods on an object running in another Java virtual machine.

More information

Session 9. Introduction to Servlets. Lecture Objectives

Session 9. Introduction to Servlets. Lecture Objectives Session 9 Introduction to Servlets Lecture Objectives Understand the foundations for client/server Web interactions Understand the servlet life cycle 2 10/11/2018 1 Reading & Reference Reading Use the

More information

RMI Example RMI. CmpE 473 Internet Programming RMI

RMI Example RMI. CmpE 473 Internet Programming RMI CmpE 473 Internet Programming Pınar Yolum pinar.yolum@boun.edu.tr Department of Computer Engineering Boğaziçi University RMI Examples from Advanced Java: Internet Applications, Art Gittleman Remote Method

More information

ServletConfig Interface

ServletConfig Interface ServletConfig Interface Author : Rajat Categories : Advance Java An object of ServletConfig is created by the web container for each servlet. This object can be used to get configuration information from

More information

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Welcome To PhillyJUG 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Web Development With The Struts API Tom Janofsky Outline Background

More information

Servlets. An extension of a web server runs inside a servlet container

Servlets. An extension of a web server runs inside a servlet container Servlets What is a servlet? An extension of a web server runs inside a servlet container A Java class derived from the HttpServlet class A controller in webapplications captures requests can forward requests

More information

CS193k, Stanford Handout #12. Threads 4 / RMI

CS193k, Stanford Handout #12. Threads 4 / RMI CS193k, Stanford Handout #12 Spring, 99-00 Nick Parlante Threads 4 / RMI Semaphore1 Semaphore1 from last time uses the count in a precise way to know exactly how many threads are waiting. In this way,

More information

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4 CMPUT 391 Database Management Systems The Basic Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems

More information

CSS 533 Program 3: Mobile-Agent Execution Platform Professor: Munehiro Fukuda Due date: see the syllabus

CSS 533 Program 3: Mobile-Agent Execution Platform Professor: Munehiro Fukuda Due date: see the syllabus CSS 533 Program 3: Mobile-Agent Execution Platform Professor: Munehiro Fukuda Due date: see the syllabus 1. Purpose This assignment implements a mobile-agent execution platform that is in general facilitated

More information

Sockets and RMI. CS151 Chris Pollett Dec. 5, 2005.

Sockets and RMI. CS151 Chris Pollett Dec. 5, 2005. Sockets and RMI CS151 Chris Pollett Dec. 5, 2005. Outline Echo Server with Multiple Clients Client pull/server push Remote Method Invocation Proxy Pattern Echo Server with Multiple Clients public class

More information

Distributed Computing

Distributed Computing Distributed Computing Computing on many systems to solve one problem Why? - Combination of cheap processors often more cost-effective than one expensive fast system - Flexibility to add according to needs

More information

Servlets and JSP (Java Server Pages)

Servlets and JSP (Java Server Pages) Servlets and JSP (Java Server Pages) XML HTTP CGI Web usability Last Week Nan Niu (nn@cs.toronto.edu) CSC309 -- Fall 2008 2 Servlets Generic Java2EE API for invoking and connecting to mini-servers (lightweight,

More information

Remote Method Invocation

Remote Method Invocation Remote Method Invocation RMI Dr. Syed Imtiyaz Hassan Assistant Professor, Deptt. of CSE, Jamia Hamdard (Deemed to be University), New Delhi, India. s.imtiyaz@jamiahamdard.ac.in 1 Agenda Introduction Creating

More information

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2 Java Servlets Adv. Web Technologies 1) Servlets (introduction) Emmanuel Benoist Fall Term 2016-17 Introduction HttpServlets Class HttpServletResponse HttpServletRequest Lifecycle Methods Session Handling

More information

Servlets by Example. Joe Howse 7 June 2011

Servlets by Example. Joe Howse 7 June 2011 Servlets by Example Joe Howse 7 June 2011 What is a servlet? A servlet is a Java application that receives HTTP requests as input and generates HTTP responses as output. As the name implies, it runs on

More information

Java Servlets. Preparing your System

Java Servlets. Preparing your System Java Servlets Preparing to develop servlets Writing and running an Hello World servlet Servlet Life Cycle Methods The Servlet API Loading and Testing Servlets Preparing your System Locate the file jakarta-tomcat-3.3a.zip

More information

Servlet and JSP Review

Servlet and JSP Review 2006 Marty Hall Servlet and JSP Review A Recap of the Basics 2 JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Java Server Pages (JSP) Dr. Basem Suleiman Service Oriented Computing Group, CSE, UNSW Australia Semester 1, 2016, Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442

More information

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01 Introduction & RMI Basics CS3524 Distributed Systems Lecture 01 Distributed Information Systems Distributed System: A collection of autonomous computers linked by a network, with software to produce an

More information

Information Technology for Industrial Engineers 15 November ISE 582: Information Technology for Industrial Engineers

Information Technology for Industrial Engineers 15 November ISE 582: Information Technology for Industrial Engineers ISE 582: Information Technology for Industrial Engineers University of Southern California Department of Industrial and Systems Engineering Lecture 10 JAVA Cup 9: Images, Interactive Forms Handouts & Announcements

More information

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests What is the servlet? Servlet is a script, which resides and executes on server side, to create dynamic HTML. In servlet programming we will use java language. A servlet can handle multiple requests concurrently.

More information

Distributed object component middleware I - Java RMI

Distributed object component middleware I - Java RMI Prof. Dr. Claudia Müller-Birn Institute for Computer Science, Networked Information Systems Distributed object component middleware I - Java RMI Nov 15th, 2011 Netzprogrammierung (Algorithmen und Programmierung

More information

Backend. (Very) Simple server examples

Backend. (Very) Simple server examples Backend (Very) Simple server examples Web server example Browser HTML form HTTP/GET Webserver / Servlet JDBC DB Student example sqlite>.schema CREATE TABLE students(id integer primary key asc,name varchar(30));

More information

&' () - #-& -#-!& 2 - % (3" 3 !!! + #%!%,)& ! "# * +,

&' () - #-& -#-!& 2 - % (3 3 !!! + #%!%,)& ! # * +, ! "# # $! " &' ()!"#$$&$'(!!! ($) * + #!,)& - #-& +"- #!(-& #& #$.//0& -#-!& #-$$!& 1+#& 2-2" (3" 3 * * +, - -! #.// HttpServlet $ Servlet 2 $"!4)$5 #& 5 5 6! 0 -.// # 1 7 8 5 9 2 35-4 2 3+ -4 2 36-4 $

More information

Distributed object component middleware I - Java RMI

Distributed object component middleware I - Java RMI Prof. Dr. Claudia Müller-Birn Institute for Computer Science, Networked Information Systems Distributed object component middleware I - Java RMI Nov 15th, 2011 Netzprogrammierung (Algorithmen und Programmierung

More information

CS433 Technology Overview

CS433 Technology Overview CS433 Technology Overview Scott Selikoff Cornell University November 13, 2002 Outline I. Introduction II. Stored Procedures III. Java Beans IV. JSPs/Servlets V. JSPs vs. Servlets VI. XML Introduction VII.

More information

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC)

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC) Session 8 JavaBeans 1 Reading Reading & Reference Head First Chapter 3 (MVC) Reference JavaBeans Tutorialdocs.oracle.com/javase/tutorial/javabeans/ 2 2/27/2013 1 Lecture Objectives Understand how the Model/View/Controller

More information

10/8/2018 Programming Data Structures. class diagram for assignment 08 review: polymorphism review: exception new: File I/O

10/8/2018 Programming Data Structures. class diagram for assignment 08 review: polymorphism review: exception new: File I/O 10/8/2018 Programming Data Structures class diagram for assignment 08 review: polymorphism review: exception new: File I/O 1 class diagram (informal) link the parent classes and child classes describe

More information

Lecture 15: Frameworks for Application-layer Communications

Lecture 15: Frameworks for Application-layer Communications Lecture 15: Frameworks for Application-layer Communications Prof. Shervin Shirmohammadi SITE, University of Ottawa Fall 2005 CEG 4183 15-1 Background We have seen previously that: Applications need to

More information

Lecture 15: Frameworks for Application-layer Communications

Lecture 15: Frameworks for Application-layer Communications Lecture 15: Frameworks for Application-layer Communications Prof. Shervin Shirmohammadi SITE, University of Ottawa Fall 2005 CEG 4183 15-1 Background We have seen previously that: Applications need to

More information

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

DISTRIBUTED OBJECTS AND REMOTE INVOCATION DISTRIBUTED OBJECTS AND REMOTE INVOCATION Introduction This chapter is concerned with programming models for distributed applications... Familiar programming models have been extended to apply to distributed

More information

Component Based Software Engineering

Component Based Software Engineering Component Based Software Engineering Masato Suzuki School of Information Science Japan Advanced Institute of Science and Technology 1 Schedule Mar. 10 13:30-15:00 : 09. Introduction and basic concepts

More information

Verteilte Systeme (Distributed Systems)

Verteilte Systeme (Distributed Systems) Verteilte Systeme (Distributed Systems) Karl M. Göschka Karl.Goeschka@tuwien.ac.at http://www.infosys.tuwien.ac.at/teaching/courses/ VerteilteSysteme/ Lecture 3: Communication (Part 2) Remote Procedure

More information

Java servlets CSCI 470: Web Science Keith Vertanen Copyright 2013

Java servlets CSCI 470: Web Science Keith Vertanen Copyright 2013 Java servlets CSCI 470: Web Science Keith Vertanen Copyright 2013 Overview Dynamic web content genera2on (thus far) CGI Web server modules Server- side scrip2ng e.g. PHP, ASP, JSP Custom web server Java

More information

Getting started with Winstone. Minimal servlet container

Getting started with Winstone. Minimal servlet container Getting started with Winstone Minimal servlet container What is Winstone? Winstone is a small servlet container, consisting of a single JAR file. You can run Winstone on your computer using Java, and get

More information

Chapter 29 Servlets: Bonus for Java Developers 1041

Chapter 29 Servlets: Bonus for Java Developers 1041 Chapter 29 Servlets: Bonus for Java Developers 1041 29 Servlets: Bonus for Java Developers Method Description void init( ServletConfig config ) This method is automatically called once during a servlet

More information

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java. [Course Overview] The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming,

More information