O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.


  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto


  1. 1. <ul><li>WEB BASICS </li></ul>
  2. 2. URI(Unified Resource Identifier) <ul><li>Uniform Resource Identifier is a general term for identifying resources on the internet or private intranet. </li></ul><ul><li>URI's were originally defined as two types: </li></ul><ul><li>a) Uniform Resource Locators (URLs ) which are addresses with network locations, </li></ul><ul><li>Syntax of URL: </li></ul><ul><li>protocol://host[:port]/url-path </li></ul><ul><li>Ex of URL : </li></ul><ul><li>http://www.javafasttrack.com/index.html </li></ul><ul><li>Uniform Resource Names (URNs), which are persistent names that are </li></ul><ul><li>address independent.URN is basically used for aliasing URL. </li></ul><ul><li>2 types of URL </li></ul><ul><li>Absolute URL designates the protocol,host,path and name of a resource. </li></ul><ul><li>Ex: <A HREF=“ http://www,awl.com/index.html ”> Absolute URL to AWL</A> </li></ul><ul><li>Relative URL not fully qualified but rather it inherits the protocol,host and path information from parent documentation. </li></ul><ul><li>Ex: <A HREF=“link.html”>Relative URL to document called link.html </A> </li></ul>Definitions
  3. 3. URL Encoding <ul><li>URL encoding involves replacing all unsafe and non printable characters with a percent sign followed by 2 hexadecimal digits corresponding to the character’s ASSCI value. </li></ul><ul><li>Unsafe characters are those that may be altered by network hardware or software. </li></ul><ul><li>Assume that we would like to reference a source called sun’s java.html stored in the server java.sun.com. According to the rule (‘) apostrophe and the space are unsafe and must be encoded. The encoded URL look like this </li></ul><ul><li>http;//java.sun.com/sun%27s+java.html </li></ul><ul><li>What characters need to be encoded and why? </li></ul><ul><li>ASCII Control characters     </li></ul><ul><li>Why: These characters are not printable. </li></ul><ul><li>Non-ASCII characters     </li></ul><ul><li>Why: These are by definition not legal in URLs since they are not in the ASCII set. </li></ul>Definitions
  4. 4. <ul><li>&quot; Reserved characters “ </li></ul><ul><li>Why: URLs use some characters for special use in defining their syntax. When these characters are not used in their special role inside a URL, they need to be encoded. </li></ul>concepts
  5. 5. concepts &quot;Unsafe characters” Why :Some characters present the possibility of being misunderstood within URLs for various reasons. These characters should also always be encoded.
  6. 6. <ul><li>How are characters URL encoded? </li></ul><ul><li>URL encoding of characters are consist of “%” symbols followed by 2 digit hexadecimal symbol. </li></ul><ul><li>Ex: </li></ul><ul><li>Space= 32 in decimal code point. </li></ul><ul><li>32 decimal= 20 in hexadecimal. </li></ul><ul><li>The URl encoded representation will be “%20” </li></ul>concepts
  7. 7. <ul><li>Web Browser </li></ul><ul><li>A web browser lets the user request something on the server and shows the user the result of the request. Browser software interprets the markup of files in HTML, formats them into Web pages, and displays them to the user </li></ul><ul><li>Currently 2 web browsers are widely used (a) MozillaFireFox (b) Microsoft Internet Explorer </li></ul>Definition
  8. 8. Web Server <ul><li>A web server is essentially a computer program which is responsible for handling HTTP requests. A browser request to view a page the server then accepts the request and displays the page. </li></ul><ul><li>From a general point of view we consider web servers as the storage area for files which are available on the web. So in order for any page to be viewable on the web it must be loaded on to the web server. A web server is usually a dedicated piece of hardware and software used to allow a website to be displayed on the net. </li></ul><ul><li>Some of the web servers are : </li></ul><ul><li>a) Microsoft Internet Information Server. </li></ul><ul><li>Apache Web Server. </li></ul><ul><li>Macromedia JRun Web Server. </li></ul>Definitions
  9. 9. Browser/Server Communication <ul><li>The message passed from the browser to the web server is known as an HTTP request. When the web server receives this request, it checks its stores to find the appropriate page. If the web server finds the page, it parcels up the HTML contained within (using TCP), addresses these parcels to the browser (using HTTP), and sends them back across the network. If the web server cannot find the requested page, it issues a page containing an error message (e.g. Error 404: Page Not Found) – and it parcels up and dispatches that page to the browser. The message sent from the web server to the browser is known as the HTTP response. </li></ul>concepts
  10. 10. <ul><li>Browser / Server Communication </li></ul>Diagram
  11. 11. Common Gateway Interface(CGI) <ul><li>The Common Gateway Interface (CGI) is a specification defined by the World Wide Web Consortium rW3C), defining how a program interacts with a Hyper Text Transfer Protocol(HTTP) server. The Common Gateway Interface (CGI) provides the middleware between WWWservers and external databases and information sources. CGI applications perform specific information processing, retrieval, and formatting tasks on behalf of WWW servers. </li></ul><ul><li>CGI is the older version of servlet . The draw back of CGI is that it takes separate process space for each request so memory cosumption is more. </li></ul>concepts
  12. 12. HTTP <ul><li>HTTP is the protocol used for information exchange on the WWW . HTTP defines how messages are formatted and transmitted, and what actions a HTTP Server and an HTTP Client (which in most cases is a Browser ) should take in response to various messages. HTTP uses a reliable, connection-oriented transport service such as the TCP . HTTP is a stateless Protocol , where each request is interpreted independently, without any knowledge of the requests that came before it.HTTP protocol follows request/response model . In the communication between browser and server, the client makes the request and server responds to the request and the connection to be closed. There is 4 steps 4 simple Web transaction : </li></ul><ul><li>1. The client opens the connection to rhe server . The client opens the TCP/IP connection to the server.Since TCP/IP connection is established down in the transport layer of the protocol stack. There is not of much HTTP activity in this stage. </li></ul><ul><li>2. The Client makes request to the server. This is where we get first HTTP syntax. </li></ul><ul><li>Lets assume that the web browser makes a very basic request to retrive the HTML file.. The URL entered into the URL might look like: </li></ul><ul><li>http://www.awl.com/index.html . The HTTP request sent by the browser to the server would look something like this: </li></ul><ul><li>GET /index.html HTTP/1.0 </li></ul><ul><li>This request can be broken into 3 parts: the request method , the source name and the protocol. GET is a HTTP method requesting a server to send the file. </li></ul>concepts
  13. 13. <ul><li>GET /index.html HTTP/1.0 </li></ul><ul><li>This request can be broken into 3 parts: the request method , the source name and the protocol. GET is a HTTP method requesting a server to send the file. </li></ul><ul><li>The server responds to the request . The server respond with the status code ,various header fields and if possible, the content of the requested file. </li></ul><ul><li>If the file requested in step 2 is available and the client has proper authorization </li></ul><ul><li> the server response may something look like this : </li></ul><ul><li>HTTp/1.0 200 OK </li></ul><ul><li>Server: Netscape-Enterprise/2.01 </li></ul><ul><li>Content-Typetext/html </li></ul><ul><li>Content-length: 87 </li></ul><ul><li>The first line of the response indicates the server’s protocol and returns a status code stating that the request was fulfilled sucessfully.The OK message on this line provide the human readable description of the human code 200. </li></ul><ul><li>The connection is closed . The TCP connection may be either closed by server or clientUsually, it’s a server who terminates the connection after the response has been sent </li></ul>
  14. 14. <ul><li>Connectionless Protocol </li></ul><ul><li>Using a connection less protocol, client opens the connection with the server ,sends the request , recieves the response and close the connection . </li></ul><ul><li>Connectionless describes communication between two network end points in which a message can be sent from one end point to another without prior arrangement. The device at one end of the communication transmits data to the other, without first ensuring that the recipient is available and ready to receive the data. The device sending a message simply sends it addressed to the intended recipient. As such there are more frequent problems with transmission than with connection-oriented protocols and it may be necessary to resend the data several times. </li></ul><ul><li>Advantage of connectionless protocol is : </li></ul><ul><li>- It holds the connection open only long enough to service the request, very few server resources required to service. </li></ul><ul><li>The drawback of connectionless protocol is that connection has to be establised with every request. </li></ul>
  15. 15. Stateless Protocol <ul><li>A protocol is said to be stateless if it has no memory of prior connections and cannot distinguish request of one client from that of another. HTTP is a stateless protocol. Due to stateless nature of HTTP protocol it consumes less resources of server and can support more simultaneous users since there are no client credentials and connection to maintain… </li></ul><ul><li>This does not require the user to start an instance of the application as all access to the application is via a web browser. The application, which is running under a web server, knows nothing about any particular client until it receives an HTTP request. When it receives a request the following happens: </li></ul><ul><li>The web server creates and activates a child process to deal with the request, or it may reactivate an existing process which is currently &quot;sleeping&quot;. </li></ul><ul><li>The child process deals with the request and generates a response, which the web server will send back to the client device. </li></ul><ul><li>The child process then dies, or puts itself in a &quot;sleep&quot; condition. </li></ul>definations
  16. 16. <ul><li>The GET method </li></ul><ul><li>The GET method is so called because the browser uses the HTTP GET command to submit the data. The GET command sends a URL to the Web server. If the form's data is sent to the Webserver using the GET command, the browser must include all data in the URL.The key features of the GET method of data submission are as follows:The values of all the fields are concatenated and passed to the URL. The example of get method is as folloes: </li></ul><ul><li>GET /login.html?username=dustin&password=servlets HTTP/1.0 </li></ul><ul><li> User-Agent: Mozilla/4.02[en](Win95;) </li></ul><ul><li>Accept: image/gif, image/jpeg, image/pipeg </li></ul><ul><li>- The first line of the example implies that GET method is requesting login.htmlfile using HTTP/1.0 protocoland passes two parameter called username and password with values of dustin and servlets. </li></ul><ul><li>- The User-Agent header field conveys the type of browser that initiated the request. In this case , the browser is the english version of Mozilla Firefox 4.02 running on Windows 95. </li></ul><ul><li>- The Accept header field indicates the file types supported by the client . </li></ul><ul><li>The information Can be passed to the server by manually appending the query string to the URLor by an HTML form. The above GET request request may be generated by the browser in response to the user requesting the URL ; </li></ul><ul><li>http://www.sourcestream.com/login.html?username=dustin&password=servlets. </li></ul>
  17. 17. The POST method <ul><li>In the POST method of data submission, the Web browser uses the POST command to submit the data to the server and includes the form's data in the body of that command. The POST method can handle any amount of data, because the browser sends the data as a separate stream.The POST method should be used to send potentially large amounts of data to a web server. A post method typically generated by the browser in response to the user clicking the submit button on HTML form that utilize the POST method. The POST method looks like following : </li></ul><ul><li>POST /login.html HTTP/1.0 </li></ul><ul><li>User-Agent: Mozilla/4.02 [en] (win 95;i) </li></ul><ul><li>Accept: image/gif, image/jpeg, */* </li></ul><ul><li>Content-Length: 34 </li></ul><ul><li>username=dustin&passwords=servlets </li></ul><ul><li>Here the user name and password is passed in the body of the request rather than the method statement. This is the primary difference between GET and POSt method. </li></ul>concepts
  18. 18. <ul><li>MIME(Multipurpose Internet Mail Extension) </li></ul><ul><li>MIME is an extensionto the electronic mail format . MIME provides 3 internet services : </li></ul><ul><li>Provides the standard mechanism for encoding binary data into the ASCII format </li></ul><ul><li>Define the standard for specifying the type of content stored in the body of message. </li></ul><ul><li>Descibe the standard method for defining the multipart mail message containing heterogeneous body part </li></ul>concepts
  19. 19. HTML Forms <ul><li>HTML Form provide a simple way to prompt user for tnput via. Formatted HTML page and allow user to submit information to the server.Forms are first mechanism to allow true way interaction on the web. </li></ul><ul><li><form> tag </li></ul><ul><li>The form element creates a form for user input. A form can contain textfields, checkboxes, radio-buttons and more. Forms are used to pass user-data to a specified URL. </li></ul><ul><li>Syntax </li></ul><ul><li>form action=&quot;actionpage.cfm&quot; method=&quot;post&quot;> ... </form > </li></ul><ul><li>The method attribute </li></ul><ul><li>The two possible methods are GET and POST </li></ul>concepts
  20. 20. <ul><li>The action attribute </li></ul><ul><li>The action attribute specifies the action that is to be performed whem the user submit the form.Usually the action attributes indicates the URL of script or servlet that will process the user’s input. </li></ul><ul><li>Ex : </li></ul><ul><li><FORM METHOD= “POST” ACTION= mailto:callaway@sourcestream.com > </li></ul><ul><li><INPUT> tag </li></ul><ul><li>The <input> tag defines the start of an input field where the user can enter data </li></ul><ul><li><form action=&quot;form_action.asp“ method=&quot;get&quot;> First name: <input type=&quot;text&quot; name=&quot;fname“ value=&quot;Mickey&quot; /> <br /> Last name: <input type=&quot;text&quot; name=&quot;lname&quot; value=&quot;Mouse&quot; /> <br /> <input type=&quot;submit&quot; value=&quot;Submit&quot; /> </form> </li></ul>concepts
  21. 21. <ul><li>The <TEXTAREA. Tag </li></ul><ul><li>This tag displays a multiline textbox that is useful for collecting large amounts of text from the client. </li></ul><ul><li>Syntax: </li></ul><ul><li><TEXTAREA NAME=“name” COLS=“x” ROWS=“y”> Default Text </TEXTAREA> </li></ul>concepts