Mod5 SA
Mod5 SA
Overview:
Client/Server systems consist of a server that hosts the core application or services and multiple
clients that request and utilize those services. Communication between clients and the server
typically involves request-response mechanisms.
● we assume that although the client/server systems we build may have multiple clients,
they will have just one server.
● It is not difficult to extend the techniques to multiple servers, so this is not a serious
restriction. Figure shows a system with one server and three clients.
● Each client runs a program that provides a user interface, which may or not be a GUI.
● The server hosts an object-oriented system.
● Like any other client/server system, clients send requests to the server, these requests
are processed by the object-oriented system at the server, and the results are returned.
The results are then shown to end-users via the user interface at the clients.
1. Scalability:
○ New clients can easily be added without significant changes to the server.
2. Centralized Management:
○ Core logic resides on the server, simplifying updates and maintenance.
3. Flexibility:
○ Clients and servers can be developed independently as long as they follow the
agreed communication protocol.
Drawbacks:
Analysis of a Library System Deployed on the World-Wide Web and Its Operations
1. The user must be able to type in a URL in the browser and connect to the library system.
2. Users are classified into two categories: superusers and ordinary members.
3. Some commands can be issued from the library only. These include all of the commands
that only the superuser has access to and the command to issue books.
4. A superuser cannot issue any commands from outside of the library. They can log in, but
5. Superusers have special user ids and corresponding password. For regular members, their
library member id will be their user id and their phone number will be the password.
There are two primary ways in which form data is encoded by the browser: one is GET and
1. GET Method
Usage in SAP: The GET method is commonly used to fetch records, display data from
SAP
Characteristics:
It is idempotent, meaning multiple identical requests will produce the same result
• Example:
2. POST Method
Purpose: Send data to the server to create or update resources.
Usage in SAP: The POST method is used for operations like creating new records in
SAP
Characteristics:
• Example:
Content-Type: application/x-www-form-urlencoded
username=example&password=securepassword
Client-Server Architecture:
● The client is typically a web browser (like Chrome or Firefox), and it shows content to the
user. It takes user input like clicks or form submissions.
● The server hosts the application (the software that does the work), processes the data, and
sends back dynamic content like web pages to the browser.
● Web pages are created using HTML (the language used to structure content on the web).
● When a user interacts with a website (like choosing a flight or making a reservation), dynamic
HTML is generated. This means the server creates custom web pages based on the user's
choices and sends them to the browser.
● Technologies like Java Server Pages (JSP), Java Servlets, PHP, and ASP help create this
dynamic content.
Form Handling:
● Users often fill out forms on websites, like entering their name or choosing a product. These
are created using HTML forms.
● When a form is submitted, the data is sent to the server using two methods:
○ GET: Appends the data to the URL.
○ POST: Sends the data in the body of the request.
● The server processes this data, like checking if a product is available or saving a reservation.
● In an object-oriented system, we treat things like users, products, and reservations as objects.
These objects have attributes (data, like name, price) and methods (actions, like save or check
availability).
● For example, when someone submits a reservation, a reservation object is created on the
server, and its methods are used to process it.
Server-Side Technologies:
● Technologies like Java Servlets, JavaServer Pages (JSP), PHP, and ASP are used on the
server to handle requests, process data, and send back responses (like HTML, JSON, or
images).
● HTTP (HyperText Transfer Protocol) is the communication protocol used between the
browser (client) and the server. The browser sends requests (like a GET request to view a page)
and the server responds with the necessary data (like an HTML page).
● Marshalling is the process of preparing data (like an object) to be sent over the network.
Demarshalling is the reverse process, where the data is turned back into its original object
when it reaches its destination.
● For example, if you're requesting data from a server, marshalling ensures that your request
(including what you want and how to handle it) is properly encoded for transmission.
● Security is important. Authentication ensures that the user is who they say they are, and
authorization ensures that the user has permission to do what they want to do.
● Session management tracks a user's actions across different pages. It helps maintain the user's
state (like if they're logged in) using cookies or tokens.
A servlet receives data from a browser through a HttpServletRequest object. This involves
parameter names and their values, IP address of the user, and so on. For example, when the
form to add book is filled and the Add button is clicked, the servlet‘s doPost method is
invoked. As we have seen earlier, this method has two parameters: a request parameter of
type HttpServletRequest and a response parameter of type HttpServletResponse.
Each command is organised as a combination of one to three servlets. They need a number of
common utility functions during the course of processing. These methods and doPost and
doGet are collected into a class named LibraryServlet. This class has the structure shown in
Fig. 12.14.
1. One group contains methods that store information about the user. This information
includes the user id, the type of terminal from which the user has logged in, etc. and are
stored in attributes associated with the session object. The methods are addAttribute,
2. Methods to validate users and help assess access rights. The validateSuper User method
checks whether the user is a superuser and validateOrdinary Member does the same job for
ordinary members. The method library Invocation returns true if and only if the user has
3. The getFile method reads an HTML file and returns its contents as a String object.
4. The fourth group of methods are used for handling users who may have invoked a
command without actually logging in. The method notLoggedIn returns true if and only if the
user has not currently logged in. The method noLoginError Message returns HTML code that
displays an error message when a person who has not logged in attempts to execute a
command.
5. The final group of commands deal with processing the request and responding to it. The
doGet message calls doPost, which does some minimal processing needed for all commands
and then calls the abstract runmethod, which individual servlets override.
How to deploy the user requirements? Explain the steps involved in it.
Answer:
As in any system, the first task is to determine the system requirements. We will, as has been
the case throughout the book, restrict the functionality so that the system‘s size is
manageable.
1. The user must be able to type in a URL in the browser and connect to the library system.
2. Users are classified into two categories: superusers and ordinary members. Superusers are
essentially designated library employees, and ordinary members are the general public who
borrow library books. The major difference between the two groups of users is that
superusers can execute any command when logged in from a terminal in the library, whereas
ordinary members cannot access some ‗privileged commands‘. In particular, the division is
as follows:
(a) Only superusers can issue the following commands: add a member, add a book, return a
book, remove a book, process holds, save data to disk, and retrieve data from disk.
(b) Ordinary members and superusers may invoke the following commands: issue and renew
(c) Every user eventually issues the exit command to terminate his/her session.
3. Some commands can be issued from the library only. These include all of the commands
that only the superuser has access to and the command to issue books.
4. A superuser cannot issue any commands from outside of the library. They can log in, but
5. Superusers have special user ids and corresponding password. For regular members, their
library member id will be their user id and their phone number will be the password.