[Quick start] Building a todo list app with qbit
[detailed tutorial] Building a todo list app with qbit
reading about servlets....
-----------------------------------------------------------
Todo List app
Todo list app is working now with qbit and todoservice check out the code here [todo list app].
The todo list app is simple you can add your todo items via a text box and hitting enter. once they are added you can check the box for the item to draw a line through the todo item, and you can delete an item by double clicking it here is a picture of the app:

Once get the code for it build it and run it on your machine you can access the app on your localhost:
http://localhost:9999/ui/index.html
The app is coded in html, css and javascript. TodoService is the controller for this example it will generate the id element for the items listed. this id will be used to add, delete, and draw a line trough them.
[Quick Start] Building a Todo List application with qbit.
This is done you can check it out here on this link https://github.com/advantageous/qbit/wiki/%5BQuick-Start%5D-Building-a-single-page;-Todo-List-Application-with-QBit
This is done you can check it out here on this link https://github.com/advantageous/qbit/wiki/%5BDetailed-Tutorial%5D-Building-a-single-page;-Todo-List-Application-with-QBit
Reading about servlets
how a browse talks to a web server?
-type a url in the browser or click on a link
-browser sends a get or a post request to the server
how a browse talks to a web server?
-type a url in the browser or click on a link
-browser sends a get or a post request to the server
- if its a get request the browser appends the values from various form fields to the end of the requested URL, this info is called a query string.
-the query strong is URL encoded; a ? separates the requested URL from the query string
-the main web server interprets anthing after the ? symbol as a query string
-multipe name and values are seperated by a & symbol.
-spaces are replaced by + signs
-if we have a post request the browser still encodes the form fields in values but this time it won't append it to the end of the requested URL as in the get request, it may set a special content length header field whose value is the number of bytes that follow in the request body.
-after sending all the header fields, the browser then sends all the encoded texts as the body of the request.
-after the web server readds all the headers of the request, it will read the body, possibly knowing how many bytes to read from the content length header
-a GET request sent by the browser will look like something of this nature:
GET /cgi-bin/runApp/p1?name=your+name&....... HTTP/1.0
Accept:*/*
Connection: keep-Alive
Host: www.w3.org
User-Agent: Generic
-blank line at the end of the header to tell the serve that headers are finished. there is no body for the get request since the query string is attache to the end of the URL.
-a post request sent by the browser will something like this:
POST /cgi-bin/runApp/p1 HTTP/1.0
Accept:*/*
Connection: keep-Alive
Host: www.w3.org
User-Agent: Generic
name=your+name&......
-name= is the request body like a form submision for example, content length is not required in requests.
-a server response sent to the browser will like this:
HTTP/1.1 200 OK
Date: 1 jan 2015 10:30:33 GMT
Server: Apache/1.3
Last-Modified: Mon, 2 Dec 2014 10:30:33 GMT
Etag: "
Accept-Ranges:bytes
Content-Length: 10343
Connection: Keep-Alive
Keep-Alive: timeout=15
Content-Type: text/html; charset=iso-8895-1
<HTML><HEAD><TITLE>...</TITLE></HEAD>
<BODY>. . .</BODY>
</HTML>
-Normally you will have to only set the Content-Type in your application, the web server will put in the other headers.
-the browser access the web server at the default port which is port number 80 for http requests 21 for FTP requests you can also specify the port number.
-any computer called by any website can have up to 64000 port numbers; up to 1024 port numbers are usually reserved for wel known protocols.
-The receiving computer checks which port number the request came in on and passes it to the corresponding process . after start up th main web server process runs constantly in the background and listens on for example port number 80 for incoming requests.
-when the incoming request is detected the main web server will start a separate thread or process to serve that request, connects the incoming stream to it, and goes back to listening for more requests. so there could be a huge number of server threads or processes running at the same time processing different requests on busy sites. each thread or process is essentially the same as the main web server and is referred to as the main web server.
-the main web server sets several standard environment variables related to a request. these variables have been standardized by the CGI (common Gateway Interface)
No comments:
Post a Comment