Client-Server Applications in Java

Total Page:16

File Type:pdf, Size:1020Kb

Client-Server Applications in Java PACE UNIVERSITY Thesis Master of Science in Computer Science Client-Server Applications in Java by Jasmine J. Ahuja Advisor Dr. Howard Blum December 1997 CONTENTS 1. Introduction 2. Overview of Concepts 2.1 Distributed Applications 2.2 The Java Language 2.3 World Wide Web 2.4 Client-Server 3. Java vs. C++ 4. Communication between Client and Server using sockets and Java Server application 4.1 Client as Java Application (Non Web) 4.2 Client as Web Browser (using Telnet Applet) 4.3 Client as Web Browser (using Java Applet) 5. Sample Applications Client as Java Application (Non Web) Client as Web Browser (using Telnet Applet) Client as Web Browser (using Java Applet) 6. Some other methods of communication between Client and Server 5.1 CGI Scripts 5.2 Remote Method Invocation 7. Miscellaneous Concerns 8. Recommendations for future studies 9. Bibliography Appendix A. Code for Version 1- Client as a Java Application A.1 Client A.2 Server B. Code for Version 2- Client as a Web Browser (Telnet Applet) B.1 Client B.2 Server C. Code for Version 3- Client as a Web Browser (Java Applet) C.1 Client C.2 Server Client-Server Applications in Java 1. Introduction During the first two decades of their existence, computer systems were highly centralized. A computer was usually placed within a large room and the information to be processed had to be taken to it. This had two major flaws, a) the concept of a single large computer doing all the work and b) the idea of users bringing work to the computer instead of bringing the computer to the user. This was followed by ‘stand alone PCs’ where the complete application had to be loaded on to a single machine. Each user had his/her own copy of the software. The major problems were a) sharing information and b) redundancy. These two concepts are now being balanced by a new concept called computer networks. In computer networking a large number of separate but interconnected computers work together. An application that requires two or more computers on the network is called a network application. The client–server model is a standard model for network applications. A server is a process that is waiting to be contacted by a client process so that the server can do something for it. A client is a process that sends a request to the server. The idea behind a network application is to offload some utilities like the Graphical User Interface (GUI) and in some cases, some processing, from the server to the client. As a result the GUI can be elaborate, thus making the application more user friendly. The other issues involved in client-servers are inter-process communication, security, maintenance and requirement for special software to run the client. In a ‘conventional’ client–server model, a copy of the client process lies on every client machine and the client sends a request to the server through a socket to the port that the server is listening on. This model is popular as it offers improved graphical user interface. However, it has the following disadvantages: a) a copy of the client process has to be installed on every user’s machine and b) any modification or update to the client process needs to be distributed and installed on every client machine. In a new, modified view, there is no preinstalled client on the client machine. The client process is loaded onto the client machine each and every time the user initiates a request through his/her web browser using the server’s URL/IP address. This ‘web oriented view’ does not require the user to have a special software to run the application. Moreover maintenance is much easier. The server’s administrator can ensure that the users always download the latest version of the client. In this paper, attempt has been made to study the basic issues and requirements for design and development of web oriented client-server applications and to examine the Java language in the context of these requirements. This paper especially concentrates on the inter-process communication and the user interface. The paper starts with an overview of concepts commonly used in networking. It goes on to discuss communications using sockets in detail and three alternative Java based examples of client-server implementation. The first example is a conventional client-server in which the client as well as the server are applications. The second example is web based, where the client is the web browser and the server is an application and they use HTML and a Telnet applet to communicate. The third example is also web based, but uses a Java applet along with the HTML. The paper also discusses other methods of communication like Remote Method Invocation and CGI scripts in brief. Finally a discussion on applet security is followed by ideas for further studies in this field. 1 2. Overview of Concepts 2.1 Distributed Applications The term distributed applications, is used for applications that require two or more autonomous computers or processes to cooperate in order to run them. Thus, the distributed system considered in this paper, involves three resources, processing, data and user interface. Both processing and data can be distributed over many computers. The user interface is usually local to the user so that the graphical interface, which consumes high bandwidth, does not have to be transmitted from one location to another. A Typical Distributed Application Scenario Internet/LAN Modem Workstation Client Server In distributed computing, the computer network is used to support the execution of program units, called processes, that cooperate with one another to work towards a common goal. This approach has become popular due to a number of developments like: ü Increase in the number of personal computers ü Low cost of establishing computer networks with the advancement of technology ü Computer manufacturers now offer networking software as a part of the basic operating system ü Computer networks are now an established way of disseminating information 2.2 The Java Language [22] Java is a new programming language invented by Sun Microsystems. Sun’s goal was to allow programmers to create one copy of a program that users could run on almost any computer and operating system. This capability was designed to make Java a vital component of programmability on the Web. 2 The Java Language (contd.) Programs written in Java are translated into their own native architecture, in a format called bytecodes. In order to run a Java program, the user needs another program that can interpret the Java program and provide it with the environment and services it needs. The software layer, the Java Virtual Machine (JVM), makes just about any hardware and software platform look the same to the Java program. In effect, a JVM is a device driver for Java programs. Running a Java program with a JVM is currently slower than running an equivalent C program, but JVM technology is improving at a rapid pace. Java does not support pointers to memory and so Java programs cannot corrupt a computer’s memory. It also ensures all array and string references are within each item’s bound. It performs automatic garbage collection, which frees up unused memory, so Java programs cannot leak resources. Java’s potential of platform-independent bytecodes and a language designed to go hand in hand with the Internet is enormous. However, it is still a new language and has not been tested on very large projects where applications can migrate over many platforms. It is only when its tools are tested thoroughly will businesses be willing to adopt it as ‘the’ programming language of the future. 2.3 World Wide Web [15] The World Wide Web can be briefly described as a global, interactive, dynamic, cross-platform, distributed, graphical hypertext information system that runs over the Internet. The primary concept behind the World Wide Web is hypertext – i.e. instead of reading text in a rigid, linear structure (e.g. a book), the user can easily skip from one point to another using available links. The Web is not limited to any one kind of machine, it can be accessed using an application called a browser like Netscape’s Navigator. It is successful in providing so much information because information is distributed globally across thousands of sites. The users do not have to install anything, they can go to a particular site to view information and when they are done their system reclaims the disk space. Information on the Web can be updated any time as it is contained on the site that published it and thus is accessible to the administrator of the site. No single entity “owns” the World Wide Web. Given the enormous number of independent sites that supply information to the Web, it is impossible for any single organization to set rules or guidelines. There is however, a World Wide Web (W3) Consortium, based at MIT (USA) and INRIA (Europe). The Consortium is a congregation of individuals and organizations interested in supporting and defining the languages and protocols that make the Web (HTTP, HTML etc). The W3 Consortium also provides products (browsers, server and so on) that are freely available to anyone who wants to use them. 2.4 Client-Server The client–server model is a standard model for network applications. A server is a process that is continuously running and waiting to be contacted by a client process. A client process initiates contact with the server by connecting to it at a specified port. 3 Client–Server (contd.) The following is a typical scenario: a) The server process is started on a computer system.
Recommended publications
  • Cross-Platform System of Medical Documents Protection Through Digital Signatures
    CROSS-PLATFORM SYSTEM OF MEDICAL DOCUMENTS PROTECTION THROUGH DIGITAL SIGNATURES Fernando Guilherme Ferreira Sousa Project/Dissertation developed under supervising of José Magalhães Cruz (PhD) in Glintt - Healthcare Solutions, S.A. 1. Motivation documents, which are then sent to the server and, consequently, validated and stored in the database. Due to the extreme information sensibility in the Subsequent to this process, each time a document is health area, it is really necessary to be absolutely sure opened to be viewed, for example, a check is made of about who performs certain medical transactions. It a possible change to the same document, in order to must have permission and authority to do so, i.e. be ensure that recurrently its integrity. Through really the right person to do this transaction. In areas cryptography-based security methods of public keys, involving health treatments, marking of exams or it is verified if someone tampered the document or even surgeries and new prescriptions, there must be made it invalid in some way. an extremely effective control to verify effectively that all transactions must be properly carried out, Each platform that the doctor use should read his without any type of deception or illegality. digital certificate, which is contained in a Smart Card and is installed on the machine, once inserted in a One of the biggest motivations is that the patient, in suitable card reader. Then, the digital signature is the future, might be aware that there is a control in performed with the certificate’s associated private the preparation of their medical documents. All key, which certificates the medical document.
    [Show full text]
  • Applets, Servlets and JSP
    Java Programming : applets, servlets and JSP. SR03 Dritan Nace A summary of Java Java is a language developed by Sun, which is designed to be object oriented and Simple, robust and secure, independent of hardware architectures and Multitasking. Object oriented and simple : Simpler than C++, transparent memory managment… Robust et secure : Data typing is extremely strict. For applets, it is in principle impossible to access the resources of the host machine. Independant of hardware architectures : The compiler generates a universal code : the « byte-code ». An interpreter which is specific to the host machine, « virtual machine », executes the programs. Multitasking : Java seemingly allows execution of several processes. In reality, a time slot is given to each process on the processor (Multithreaded). J2SE versus J2EE J2SE (standard edition) contains the basic usable components from both the client and server side, – GUI, AWT/Swing for applications (client) or applets. Currently J2SE v1.6 (ou V6) J2EE (enterprise edition), is in a certain sense an extension of SE, designed for server side programming – Servlets, JSP, EJB, etc. • Currently J2EE v1.4 Java and object oriented programming • Classes, and objects – The objects include data and processing for the data. Communication is done via messages (methods). – A class corresponds to an abstract model for object construction. A class is made up of: • attributes (static part) • Methods (dynamic part), which define the behaviour. – Inheritance : the « is a » relationship : a car is a vehicule, – Polymorphism : the same message can be recognised by several objects and entail different behaviour. Portability: JVM The compiler compiles the java source in byte code : javac car.java => car.class Then, java is the name of the program which will interpret the generated byte code.
    [Show full text]
  • Abstract Window Toolkit Overview
    In this chapter: • Components • Peers 1 • Layouts • Containers • And the Rest • Summary Abstract Window Toolkit Overview For years, programmers have had to go through the hassles of porting software from BSD-based UNIX to System V Release 4–based UNIX, from OpenWindows to Motif, from PC to UNIX to Macintosh (or some combination thereof), and between various other alternatives, too numerous to mention. Getting an applica- tion to work was only part of the problem; you also had to port it to all the plat- forms you supported, which often took more time than the development effort itself. In the UNIX world, standards like POSIX and X made it easier to move appli- cations between different UNIX platforms. But they only solved part of the prob- lem and didn’t provide any help with the PC world. Portability became even more important as the Internet grew. The goal was clear: wouldn’t it be great if you could just move applications between different operating environments without worr yingabout the software breaking because of a different operating system, win- dowing environment, or internal data representation? In the spring of 1995, Sun Microsystems announced Java, which claimed to solve this dilemma. What started out as a dancing penguin (or Star Trek communicator) named Duke on remote controls for interactive television has become a new paradigm for programming on the Internet. With Java, you can create a program on one platform and deliver the compilation output (byte-codes/class files) to ever yother supported environment without recompiling or worrying about the local windowing environment, word size, or byte order.
    [Show full text]
  • Apache Harmony Project Tim Ellison Geir Magnusson Jr
    The Apache Harmony Project Tim Ellison Geir Magnusson Jr. Apache Harmony Project http://harmony.apache.org TS-7820 2007 JavaOneSM Conference | Session TS-7820 | Goal of This Talk In the next 45 minutes you will... Learn about the motivations, current status, and future plans of the Apache Harmony project 2007 JavaOneSM Conference | Session TS-7820 | 2 Agenda Project History Development Model Modularity VM Interface How Are We Doing? Relevance in the Age of OpenJDK Summary 2007 JavaOneSM Conference | Session TS-7820 | 3 Agenda Project History Development Model Modularity VM Interface How Are We Doing? Relevance in the Age of OpenJDK Summary 2007 JavaOneSM Conference | Session TS-7820 | 4 Apache Harmony In the Beginning May 2005—founded in the Apache Incubator Primary Goals 1. Compatible, independent implementation of Java™ Platform, Standard Edition (Java SE platform) under the Apache License 2. Community-developed, modular architecture allowing sharing and independent innovation 3. Protect IP rights of ecosystem 2007 JavaOneSM Conference | Session TS-7820 | 5 Apache Harmony Early history: 2005 Broad community discussion • Technical issues • Legal and IP issues • Project governance issues Goal: Consolidation and Consensus 2007 JavaOneSM Conference | Session TS-7820 | 6 Early History Early history: 2005/2006 Initial Code Contributions • Three Virtual machines ● JCHEVM, BootVM, DRLVM • Class Libraries ● Core classes, VM interface, test cases ● Security, beans, regex, Swing, AWT ● RMI and math 2007 JavaOneSM Conference | Session TS-7820 |
    [Show full text]
  • Migrating from Java Applets to Plugin-Free Java Technologies
    Migrating from Java Applets to plugin-free Java technologies An Oracle White Paper January, 2016 Migrating from Java Applets to plugin-free Java technologies Migrating from Java Applets to plugin-free Java technologies Disclaimer The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. Migrating from Java Applets to plugin-free Java technologies Executive Overview ........................................................................... 4 Browser Plugin Perspectives ............................................................. 4 Java Web Start .................................................................................. 5 Alternatives ....................................................................................... 6 Native Windows/OS X/Linux Installers ........................................... 6 Inverted Browser Control ............................................................... 7 Detecting Applets .............................................................................. 7 Migrating from Java Applets to plugin-free Java technologies Executive Overview With modern browser vendors working to restrict or reduce the support of plugins like
    [Show full text]
  • Installing Open Java Development Kit – Ojdkbuild for Windows
    Installing Open Java Development Kit – ojdkbuild for Windows © IZUM, 2019 IZUM, COBISS, COMARC, COBIB, COLIB, CONOR, SICRIS, E-CRIS are registered trademarks owned by IZUM. CONTENTS 1 Introduction ......................................................................................................... 1 2 OpenJDK distribution .......................................................................................... 1 3 Removing Oracle Java ......................................................................................... 2 4 Installing OJDK – 32bit or 64bit, IcedTea Java .................................................. 3 5 Installing the COBISS3 interface ........................................................................ 7 6 Launching the COBISS3 interface .................................................................... 11 7 COBISS3 interface as a trusted source in IcedTea ojdkbuild ........................... 11 © IZUM, 16. 7. 2019, VOS-NA-EN-380, V1.0 i VOS Installing Open Java Development Kit – ojdkbuild for Windows 1 Introduction At the end of 2018 Oracle announced a new business policy for Java SE which entered into force in April 2019. That is why when you install Java a notification and warning window appears. All versions of Java from 8 u201 onwards not intended for personal use are payable. For this reason, we suggest you do not update Java 8 to a newer version for work purposes. If you want a newer version of Java 8, install OpenJDK 8 and IcedTea. Also, do not install Java 8 on new computers (clients), but install OpenJDK 8 with IcedTea support. 2 OpenJDK distribution OpenJDK 1.8. build for Windows and Linux is available at the link https://github.com/ojdkbuild/ojdkbuild. There you will find versions for the installation. The newest version is always at the top, example from 7 May 2019: © IZUM, 16. 7. 2019, VOS-NA-EN-380, V1.0 1/11 Installing Open Java Development Kit – ojdkbuild for Windows VOS 3 Removing Oracle Java First remove the Oracle Java 1.8 software in Control Panel, Programs and Features.
    [Show full text]
  • Before the Web There Was Gopher
    Before the Web There Was Gopher Philip L. Frana Charles Babbage Institute The World Wide Web, universally well known today, was preceded by an efficient software tool that was fondly named Gopher. The Internet Gopher, much like the Web, enabled users to obtain information quickly and easily. Why, then, did it disappear but the Web did not? Gopher faded into obscurity for two main reasons: hypertext and commerce. Before the Web there was Gopher, a nearly anymore, despite the efforts of a handful of defunct Internet application protocol and asso- individuals to revitalize the protocol. Why did ciated client and server software.1 In the early Gopher fail? Many Gopher aficionados have a 1990s, Gopher burrowed a crucial path ready answer: pretty pictures. For them, the through a perceived bottleneck on the Web won and Gopher lost because the Web Information Superhighway. Internet Gopher could display vibrant images of, for example, passed away as a technological and social phe- hand-woven Turkish rugs, animated glyphs of nomenon quickly: Its inventors released mice stuffing email into virtual mailboxes, and Gopher in 1991. Within three years, the World blinking advertising banners. Clearly, the Wide Web had bypassed it. Most people who “Gopher faithful”—as they are often called— surf the Web today have no idea what Gopher are right about the importance of pictures. is, but in the 1990s it helped usher in a new age People get serious when money is at stake, and of user-friendly access to a rapidly growing uni- in the early 1990s lots of people came to accept verse of online information.
    [Show full text]
  • Home Java Plugin Detector Java (Using <Applet> And/Or <Object> Tag
    22/05/12 Java plugin detection with PluginDetect Home Java Plugin Detector Java (using <applet> and/or <object> tag) installed & enabled: true Highest Installed Java Version: 1,6,0,31 Java 1,6,0,10 or higher (using <applet> and/or <object> tag) is installed & enabled. Java detection: completed ON THE FLY (OTF) Deployment Toolkit browser plugin installed & enabled: false Next-Generation Java Plugin2 installed & enabled: true Java vendor: Sun Microsystems Inc. Java plugin name: Java(TM) Platform SE 6 U31 Java plugin description: Next Generation Java Plug-in 1.6.0_31 for Mozilla browsers navigator.javaEnabled(): true [This detector is capable of OTF & NOTF Java detection. Detection occurs before window.onload event has fired.] [window.onload event has fired successfully.] [ The plugin detector(s) in this web page use the following: PluginDetect_Java.js, detectJava_OTF_NOTF.js, getJavaInfo.jar ] Download PluginDetect and the jarfile here... In order to do Java detection, you will need 2 things: 1) download the getJavaInfo.jar applet along with a few Java detection examples. The jarfile (Java ARchive file) is used by PluginDetect in order to accomplish Java detection. 2) download the PluginDetect script itself. The PluginDetect script generator will allow you to customize the PluginDetect script to include whatever features you desire. That being said, I would still recommend that you read thru most of this page before creating your own Java detection code. A brief introduction to Java detection PluginDetect uses a number of different methods when trying to detect Java in your browser. These Java detection methods can be divided into 2 groups: a) the non-applet methods and b) the applet methods.
    [Show full text]
  • Here Comes Everybody by Clay Shirky
    HERE COMES EVERYBODY THE POWER OF ORGANIZING WITHOUT ORGANIZATIONS CLAY SHIRKY ALLEN LANE an imprint of PENGUIN BOOKS ALLEN LANE Published by the Penguin Group Penguin Books Ltd, 80 Strand, London we2R ORL, England Penguin Group IUSA) Inc., 375 Hudson Street, New York, New York 10014, USA Penguin Group ICanada), 90 Eglinton Avenue East, Suite 700, Toronto, Ontario, Canada M4P 2Y3 la division of Pearson Penguin Canada Inc.) Penguin Ireland, 25 St Stephen's Green, Dublin 2, Ireland la division of Penguin Books Ltd) Penguin Group IAustralia), 250 Camberwell Road, Camberwell. Victoria 3124. Austra1ia (a division of Pearson Australia Group Pty Ltd) Penguin Books India Pvt Ltd, II Community Centre, Panchsheel Park. New Delhi - 110 017, India Penguin Group INZ), 67 Apollo Drive, Rosedale, North Shore 0632, New Zealand la division of Pearson New Zealand Ltd) Penguin Books ISouth Africa) IPty) Ltd, 24 Sturdee Avenue, Rosebank, Johannesburg 2196, South Africa Penguin Books Ltd, Registered Offices: 80 Strand, London we2R ORL, England www.penguin.com First published in the United States of America by The Penguin Press, a member of Penguin Group (USA) Inc. 2008 First published in Great Britain by Allen Lane 2008 Copyright © Clay Shirky, 2008 The moral right of the author has been asserted AU rights reserved Without limiting the rights under copyright reserved above, no part of this publication may be reproduced, stored in or introduced into a retrieval system, or transmitted, in any form or by any means (electronic, mechanical, photocopying, recording or otherwise). without the prior written permission of both the copyright owner and the above publisher of this book Printed in Great Britain by Clays Ltd, St Ives pic A CI P catalogue record for this book is available from the British Library www.greenpenguin.co.uk Penguin Books is committed (0 a sustainable future D MIXed Sources for our business, our readers and our planer.
    [Show full text]
  • People Rachel Andrew Ravenblack's Perch Music Ani Difranco Alisha's
    People Rachel Andrew Ravenblack’s Perch Music Ani Difranco Alisha’s Attic Geek El Reg Sluggy Freelance User Friendly Think Geek Kuro5hin Every OS Sucks Well hi there Thank you for downloading another fine quality comedy product from Three dead trolls in a baggie and your friends at mp3.com Good for you Of course, if you’ve downloaded this from napster, screw you, you know what, free isn’t good enough for you, your gotta rip us of, thats okay, I will find you and I will kill you ha, ha, ha You see, I come from a time in the nineteen hundred and seventies when computers where used for two things too either go to the moon or play pong and nothing inbetween, you see and You didn’t need a fancy operating system to play pong and the men who went to the moon, god bless them did it with no mouse and a plain text only black and white screen and thiry−two kilobytes of ram but then round about the late seventies home computers started to do a little bit more than play pong very little more why computers started to play games and balance check books why, you could play zakon on you apple II or write a book all with a computer that had thirty−two kilobytes of ram It was enough to go to the moon it was enought for you it was a golden time a time before windows a time before mouses a time before the internet and bloatware and a time before every OS sucked ahhh mmm Well way back in the olden times my computer worked for me I’d laugh and play all night and day on zork one, two and three the amiga, vic 20 and sinclair two, the trs 80 and the apple II they
    [Show full text]
  • A New Storytelling Era: Digital Work and Professional Identity in the North American Comic Book Industry
    A New Storytelling Era: Digital Work and Professional Identity in the North American Comic Book Industry By Troy Mayes Thesis submitted for the degree of Doctor of Philosophy in the Discipline of Media, The University of Adelaide January 2016 Table of Contents Abstract .............................................................................................. vii Statement ............................................................................................ ix Acknowledgements ............................................................................. x List of Figures ..................................................................................... xi Chapter One: Introduction .................................................................. 1 1.1 Introduction ................................................................................ 1 1.2 Background and Context .......................................................... 2 1.3 Theoretical and Analytic Framework ..................................... 13 1.4 Research Questions and Focus ............................................. 15 1.5 Overview of the Methodology ................................................. 17 1.6 Significance .............................................................................. 18 1.7 Conclusion and Thesis Outline .............................................. 20 Chapter 2 Theoretical Framework and Methodology ..................... 21 2.1 Introduction .............................................................................. 21
    [Show full text]
  • Quickspecs HP Cluster Platform Express
    RETIRED: Retired products sold prior to the November 1, 2015 separation of Hewlett-Packard Company into Hewlett Packard Enterprise Company and HP Inc. may have older product names and model numbers that differ from current models. QuickSpecs HP Cluster Platform Express Overview Rack with HP ProLiant BL465c G5 Server Blades Rack with HP ProLiant DL165 G5 Servers An HP Cluster Platform Express configuration examples: Left rack with 32 HP ProLiant BL465c G5 in 2 c-Class enclosures, a 24-port switch and a rackmounted thin monitor. Right rack with 32 HP ProLiant DL165 G5 nodes, two InfiniBand switches, two switches, and a rack mounted thin monitor. DA - 12324 Worldwide — Version 15 — September 14, 2012 Page 1 RETIRED: Retired products sold prior to the November 1, 2015 separation of Hewlett-Packard Company into Hewlett Packard Enterprise Company and HP Inc. may have older product names and model numbers that differ from current models. QuickSpecs HP Cluster Platform Express Overview What's New Support for HP ProLiant BL460c G6, HP ProLiant BL280c G6, HP ProLiant DL380 G6, HP ProLiant DL160 G6 Support for InfiniBand QDR At A Glance Cluster Platform Express is one rack implementations of the HP Cluster Platform 3000 and 4000, with the most commonly selected configuration options The simplified product menu eases configuration and ordering for solutions that require 32 rackmounted server or 48 server blade compute nodes or less, and are using Gigabit Ethernet or InfiniBand as the cluster interconnect Small scale clusters can be deployed faster
    [Show full text]