w-b pt1 v2 Flashcards

1
Q

What was the original idea behind web access?

A

Access-to and display of distributed hyper-linked files

  • Online documents only
  • Only really designed for distribution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What type of protocol is HTTP?

A

It is a request-response protocol

Which means it is stateless

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How is the request line formatted?

A

3 space separated parts

methodName localPath HTTPVersion

Methods:

  • Are all caps
  • commnon = GET, POST, HEAD
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a URI?

A

Uniform Resource Identifier

A URI can be further classified as a locator, a name, or both. The term “Uniform Resource Locator” (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network “location”). The term “Uniform Resource Name” (URN) has been used historically to refer to both URIs under the “urn” scheme [RFC2141], which are required to remain globally unique and persistent even when the resource ceases to exist or becomes unavailable, and to any other URI with the properties of a name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the 3 parts of a response line?

A

3 Space separated parts

HTTPVersion responseStatusCode reasonPhrase

Examples:

* HTTP/1.0 200 OK

* HTTP/1.0 404 Not Found

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In general what are header lines and what are they for?

A

They provide information about request and response OR about object sent in the message body

In this format:

Header1: value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How many headers and which are REQUEIRED:

* HTTP 1.0

* HTTP 1.1

What SHOULD you always include?

A

HTTP 1.0 - 16 headers (none required)

HTTP 1.1 - 46 (Host: is required)

From: email address of requesting user

User-Agent: the program making the request

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the “Server” header do?

A

Return the server fotware in the form:

“Program-name/x.xx”

“Server: Apache/1.2b3-dev”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the “Last-modified” header do?

A

Specificies the modification date of the resource that is returned.

Used in web caching

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In a request and response, what is the message body for?

A

Request:

  • this is where user-entered data or uploaded files are sent to the server

Response:

  • This is where the requested resource is returned to the client (or perhaps explanatory text if an error occurs)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What headers are usually included if a HTTP message includes a body?

A

Content-Type: Gives the MIME-type of the data in the body

MIME = Muli-purpose Internet Mail Extensions” specifying the type of data that is encoded

Content-length: specifies the number of bytes of data in the body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the request and repsonse look like for the following:

A

Request:

  1. browser opens a stream socket to host www.cs.umanitoba.ca on port 80
  2. browser sends something like this HTTP over the socket

GET /path/f.html HTTP/1.0

From:

User-agent: HTTPTool/1.0

[blank line]

Response:

The server responses (on the same socket) with the following HTTP:

HTTP/1.0 200 OK

Date:

Content-Type: text/html

Content-Length: 1354

[conent of HTML file]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a HEAD request?

A

It ask the server to return only the response headers, not the actual resouce.

  • Useful to determine the characteristics of a resource without actually downloading it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the POST request used for?

A

It is used to send (i.e. “post”) data to the server for processing

* to a CGI (Common Gateway Interface) script

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In what ways is a POST request different from a GET request?

A
  1. There is a block of data sent with the request in its message body
  2. The request URI is not a resource to retieve but is instead a program (a script) that will process the data being sent
    - the response back is normally program output(HTML), not just a static file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the most common use of POST and what does it’s Content-type and Content-lenth header?

A

Most common use of POST is to submit HTML form data to server side script

  • Java Server Pages (JSPs), Active Server Pages (ASPs), PHP script

Content-Type: application/x-www-form-urlencoded

Content-length: length of URL-encoded form data

17
Q

When post calls a server script, where does it recieve the message body from?

What would an example POST form submission look like?

A

It recieves the message body from its’ “Standard Input”

18
Q

What needs to be done for POST to request to send any data?

A

As long as the sender and the recieving program agre eon the format of what is sent

19
Q

If GET is used to send form data as well, what is it’s format and what does it look like?

A

The form data is said to be “URL-encoded” and is appended to the request URI

GET /path/script.cgi?field1=value1&field2=value2 HTTP/1.0

20
Q

If all we are doing is dealing with static content then the keuy roles of the web server and broswer are well defined (using HTTP and HTML)

A

Browser: parse and displa HTML document provided by the server and enable users to click links and enter URLs in the address bar

Server: Accept HTTP GET request from clients via socket stream, fetch the resource and return in a HTTP response, then close the socket

21
Q

What is the order in which an HTTP request and response is processed?

A
22
Q

If we are using HTTP and HTML to build a distributed application what are the roles of the Browser and Server?

A

Browser: parse HTML, execute any code sent by the web server, display HTML documents and enable users to clieck on links and enter URLs

Server: Accept HTTP GET/POST request from clients via stream socket connection, execute code specific to the web app suing data from the client to dynamically generate HTML then return it in HTTP response and close the socket.

23
Q

What would be the order of processing for dynamic web app?

A
24
Q

At it’s most basic level, what does a server need to do to be a an application?

A

The ability to create HTML that is specific to a given user, their request and activities

  • This is done via HTTP POST

This is the root of dynamic content generation

25
Q

What is the browser’s role in distributed web application?

A
  • Originally repsonable for interpreting HTML return by web servers and decided how to display it
  • They process HTML forms provided by the server to gather user input
  • Also support client-side processing via JavaScript

Therefore the server is always the source of the entire applicaiton

26
Q

What is the server’s role in distributed web application?

A
  • Server either returns static HTML page or executes a script associated with an HTML form to do some applicaiton processing that produce HTML that is return to the browser
  • The HTML returned could also contain some client-side code to be execure there.
27
Q

At it’s most basic level, what does a web app consist of, and what makes that unusual?

A

Normally Socket/RMI acts as a tradition app where method calls are caled remotely.

However, with web apps we have a group of related web page that act as the UI and associated scripts (that are mostly at the server, but some in the browser as well)

28
Q

Basic HTML input requires two separate parts, what are they?

A
  1. The HTML code that specifies the form and it’s appearance (on the client/browser)
  2. A corresponding script that processes the data entered into the form (at the server) once it is uploaded
29
Q

In general how do HTML forms work with their corresponding scripts?

A

!/user/local/bin/perl

<form></form>

First Name: <input></input>

<form></form>

In between we have different tags for different types of input.

<input></input>

Is then used to send the information to the corresponding server script

The corresponding script /cgi-bin/prog.pl might look like

$fn=$fields{‘fname}’;

which can then be used to manipulate and display information.

30
Q

What can/should be implement on the client side when filling out an HTML form?

A

Sometimes we need information from the database (on the server) so we can’t verify it client side.

In other cases you could and should use client-side processing to reduce delays

31
Q

What does DOM stand for?

What is it and what is it’s diagram of heirarchy?

A

Document Object Model

HTML has a hierarchical structure induced by the tags

32
Q

For the DOM, where does the hierarchical structure come from?

What does it provide?

A

It is determined by the server and provided by the broswer.

The DOM provides a model for HTML pages used for program-based manipulation of HTML

In this model each HTML element (heading, table, form) is an object.

The DOM defined methods, properites and events associated with each type of HTML element.

33
Q

What is the most commonly used DOM method>?

A

getElementById which is used to get a reference to a particular HTML element base on its associated id

  • <input></input>ID=”xxx”>