9 Application Development
9.1 Application Programs & User Interfaces
- Client-server-architecture - a personal directory communicates w/a shared databases
two big drawbacks:
1. Security risks b/c user machines had direct access to database 2. any changes/updates to app/database required all copies of the app to be updated
\[\\[.1cm]\]
- 2 approaches to avoid client-server architecture problems:
- web browsers
- application programs installed on individual (usual mobile) devices
9.2 Web Fundamentals
WEB BROWSERS
= de facto standard user interface to database b/c…- they allow large num. of users to access database anywhere
- avoid the need to download/install specialized code while also providing a good GUI
\[\\[.1cm]\]
- HTTP protocol is connectionless
- connectionless means that once the server replies to a request, the server closes the connection w/the client and forgets all about the requests
- in contrast, Unix logins and JDBC/ODBC connections stay connected until the client disconnects; this retains user authentication & other info.
- connectionless reduces load on server since operating systems have tight limits on num. of open connections on a machine
\[\\[.1cm]\]
- Info. services like user authentication needs session info.
- authentication should be done only once per session
- the solution is to use a cookie \[\\[.1cm]\]
COOKIE
- a small piece of text containing identifying info.- sent by server to browser on first interaction to identify session
- the text is part of the HTTP protocol that creates the cookie on further interactions
- server saves info. about the cookie it issued, & uses it when serving a request like authentication info and displaying user preferences from same machine
\[\\[.1cm]\]
- Cookies can be stored permanently or for a limited time
9.3 Servlets
SERVLETS
- defines an application programming interfaces for communication btw the web/application servers and application programEx. Methods to get parameter values from web forms & to send HTML text back to client
\[\\[.1cm]\]
- Application programs (aka servlet) is loaded into the server
- each request spawns a new thread in the server & the thread is closed once the request is serviced
- programmer creates a class that from Http servlet and overrides methods like doGet, doPost
\[\\[.1cm]\]
- Servlet API supports handling of sessions
- sets a cookie on first interaction w/browser & uses it to identify further session
\[\\[.1cm]\]
- servlets run inside application servers such as Apache Tomcat, Glassfish, JBoss, BEA Weblogic, IBM websphere, & Oracle Application Servers
- these app. servers support deployment & monitoring of servlets
- some can even support objects, parallel processing across multiple application servers, etc.