SlideShare una empresa de Scribd logo
1 de 42
Chapter 27 HTTP and WWW
27.1  HTTP Transaction Request Message Response Message Headers
HTTP uses the services of TCP on well-known port 80. Note :
Figure 27.1   HTTP transaction
Figure 27.2   Request message
Figure 27.3   Request line
Figure 27.4   URL
Figure 27.5   Response message
Figure 27.6   Status line
Figure 27.7   Header format
Figure 27.8   Headers
Example 1 This example retrieves a document. We use the GET method to retrieve an image with the path /usr/bin/image1. The request line shows the method (GET), the URL, and the HTTP version (1.1). The header has two lines that show that the client can accept images in GIF and JPEG format. The request does not have a body. The response message contains the status line and four lines of header. The header lines define the date, server, MIME version, and length of the document. The body of the document follows the header (see Fig. 27.9, next slide).
Figure 27.9   Example 1
Example 2 This example retrieves information about a document. We use the HEAD method to retrieve information about an HTML document (see the next section). The request line shows the method (HEAD), URL, and HTTP version (1.1). The header is one line showing that the client can accept the document in any format (wild card). The request does not have a body. The response message contains the status line and five lines of header. The header lines define the date, server, MIME version, type of document, and length of the document (see Fig. 27.10, next slide). Note that the response message does not contain a body.
Figure 27.10   Example 2
HTTP version 1.1 specifies a persistent connection by default.  Note :
27.2  World Wide Web Hypertext and Hypermedia Browser Architecture Static Document/HTML Dynamic Document/CGI Active Document/Java
Figure 27.11   Distributed services
Figure 27.12   Hypertext
Figure 27.13   Browser architecture
Figure 27.14   Categories of Web documents
Figure 27.15   Static document
Figure 27.16   Boldface tags
Figure 27.17   Effect of boldface tags
Figure 27.18   Beginning and ending tags
Table 27.1  Common tags  Skeletal Tags </Hn> </TITLE> </BODY> </HEAD> </HTML> Ending  Tag Defines the title of the document <Hn> Defines the title of the document <TITLE> Title and Header Tags Defines the body of the document <BODY> Defines the head of the document <HEAD> Defines an HTML document <HTML> Meaning Beginning Tag
Table 27.1  Common tags (continued)  Superscript </SUP> <SUP> Subscript </SUB> <SUB> Text Formatting Tags </BR> </CENTER> </U> </I> </B> Ending  Tag Line break <BR> Centered <CENTER> Data Flow Tag Underlined <U> Italic <I> Boldface <B> Meaning Beginning Tag
Table 27.1  Common tags (continued)  Executable Contents The document is an applet </APPLET> <APPLET> Hyperlink Tag Defines an address (hyperlink) </A> <A> List Tags </LI> </UL> </OL> Ending  Tag Defines an image <IMG> Image Tag An item in a list <LI> Unordered list <UL> Ordered list <OL> Meaning Beginning Tag
Example 3 This example shows how tags are used to let the browser format the appearance of the text. <HTML> <HEAD> <TITLE>  First Sample Document  </TITLE> </HEAD> <BODY> <CENTER>   <H1><B>   ATTENTION  </B></H1> </CENTER>   You can get a copy of this document by: <UL> <LI>  Writing to the publisher <LI>  Ordering online <LI>  Ordering through a bookstore </UL> </BODY> </HTML>
Example 4 This example shows how tags are used to import an image and insert it into the text. <HTML> <HEAD> <TITLE>  Second Sample Document  </TITLE> </HEAD> <BODY> This is the picture of a book: <IMG SRC=&quot;Pictures/book1.gif&quot;  ALIGN=MIDDLE> </BODY> </HTML>
Example 5 This example shows how tags are used to make a hyperlink to another document. <HTML> <HEAD> <TITLE>  Third Sample Document  </TITLE> </HEAD> <BODY> This is a wonderful product that can save you money and time. To get information about the producer, click on  <A HREF=&quot;http://www.phony.producer&quot;> Producer </A> </BODY> </HTML>
Figure 27.19   Dynamic document
Example 6 Example 6 is a CGI program written in Bourne shell script. The program accesses the UNIX utility (date) that returns the date and the time. Note that the program output is in plain text. #!/bin/sh  # The head of the program echo Content_type: text/plain echo # The body of the program now='date' echo  $now exit 0
Example 7 Example 7 is similar to Example 6 except that program output is in HTML. #!/bin/sh  #  The head of the program echo Content_type: text/html echo #  The body of the program echo <HTML> echo <HEAD><TITLE> Date and Time </TITLE></HEAD> echo <BODY> now='date' echo <CENTER><B> $now </B></CENTER> echo </BODY> echo </HTML> exit 0
Example 8 Example 8 is similar to Example 7 except that the program is written in Perl. #!/bin/perl  #  The head of the program print  &quot;Content_type: text/html&quot;; print &quot;&quot;; #  The body of the program print &quot;<HTML>&quot;; print &quot;<HEAD><TITLE> Date and Time </TITLE></HEAD>&quot;; print &quot;<BODY>&quot;; $now = 'date'; print &quot;<CENTER><B>  $now </B></CENTER>&quot;; print &quot;</BODY>&quot;; print &quot;</HTML>&quot;; exit 0
Figure 27.20   Active document
Figure 27.21   Skeleton of an applet
Figure 27.22   Instantiation of the object defined by an applet
Figure 27.23   Creation and compilation
Figure 27.24   HTML document carrying an applet
Example 9 In this example, we first import two packages, java.awt and java.applet. They contain the declarations and definitions of classes and methods that we need. Our example uses only one publicly  inherited  class called First. We define only one public method, paint. The browser can access the instance of First through the public method paint. The paint method, however, calls another method called drawString, which is defined in java.awt.*.  import java.applet.*; import java.awt.*; public class First extends Applet {   public void paint (Graphics  g)   {   g.drawString (&quot;Hello World&quot;, 100, 100);   } }
Example 10 In this example, we modify the program in Example 9 to draw a line. Instead of method drawString, we use another method called drawLine. This method needs four parameters: the x and y coordinates at the beginning of the line and the x and y coordinates at the end of the line. We use 0, 0 for the beginning and 80, 90 for the end. import java.applet.*; import java.awt.*; public class Second extends Applet {   public void paint (Graphics  g)   {   g.drawLine (0, 0, 80, 90);   } }

Más contenido relacionado

La actualidad más candente (20)

Tm 1st quarter - 1st meeting
Tm   1st quarter - 1st meetingTm   1st quarter - 1st meeting
Tm 1st quarter - 1st meeting
 
Web technology practical list
Web technology practical listWeb technology practical list
Web technology practical list
 
Week 2
Week 2Week 2
Week 2
 
Unit 2.3 Part 1
Unit 2.3 Part 1Unit 2.3 Part 1
Unit 2.3 Part 1
 
WEB PAGE DESIGN USING HTML
WEB PAGE DESIGN USING HTMLWEB PAGE DESIGN USING HTML
WEB PAGE DESIGN USING HTML
 
CSS
CSSCSS
CSS
 
static dynamic html tags
static dynamic html tagsstatic dynamic html tags
static dynamic html tags
 
Intro Html
Intro HtmlIntro Html
Intro Html
 
Htmltag.ppt
Htmltag.pptHtmltag.ppt
Htmltag.ppt
 
Html
HtmlHtml
Html
 
Introduction to html (912 kb)
Introduction to html (912 kb)Introduction to html (912 kb)
Introduction to html (912 kb)
 
Html
HtmlHtml
Html
 
Module 1
Module 1Module 1
Module 1
 
Final by smit parekh
Final  by smit  parekhFinal  by smit  parekh
Final by smit parekh
 
List of html tags
List of html tagsList of html tags
List of html tags
 
Presentation on HTML
Presentation on HTMLPresentation on HTML
Presentation on HTML
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Html
HtmlHtml
Html
 
HTML Basic Tags PDF by CodeHim
HTML Basic Tags PDF by CodeHimHTML Basic Tags PDF by CodeHim
HTML Basic Tags PDF by CodeHim
 
HyperText Markup Language - HTML
HyperText Markup Language - HTMLHyperText Markup Language - HTML
HyperText Markup Language - HTML
 

Destacado (20)

Ch 20
Ch 20Ch 20
Ch 20
 
Ch 31
Ch 31Ch 31
Ch 31
 
Ch 29
Ch 29Ch 29
Ch 29
 
Ch 28
Ch 28Ch 28
Ch 28
 
Ch 24
Ch 24Ch 24
Ch 24
 
Ch 07
Ch 07Ch 07
Ch 07
 
Ch 16
Ch 16Ch 16
Ch 16
 
Ch 12
Ch 12Ch 12
Ch 12
 
Ch 23
Ch 23Ch 23
Ch 23
 
Ch 18
Ch 18Ch 18
Ch 18
 
Ch14
Ch14Ch14
Ch14
 
Ch 26
Ch 26Ch 26
Ch 26
 
Ch 30
Ch 30Ch 30
Ch 30
 
Ch 14
Ch 14Ch 14
Ch 14
 
Ch 25
Ch 25Ch 25
Ch 25
 
Ch 02
Ch 02Ch 02
Ch 02
 
Ch 13
Ch 13Ch 13
Ch 13
 
Ch 19
Ch 19Ch 19
Ch 19
 
Ch 15
Ch 15Ch 15
Ch 15
 
Ch 10
Ch 10Ch 10
Ch 10
 

Similar a Ch 27

Download Workshop Lecture
Download Workshop LectureDownload Workshop Lecture
Download Workshop Lecturewebhostingguy
 
How To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My WebHow To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My Websritikumar
 
Xhtml Part2
Xhtml Part2Xhtml Part2
Xhtml Part2nleesite
 
CIS 451: Introduction to ASP.NET
CIS 451: Introduction to ASP.NETCIS 451: Introduction to ASP.NET
CIS 451: Introduction to ASP.NETwebhostingguy
 
Introduction To ASP.NET MVC
Introduction To ASP.NET MVCIntroduction To ASP.NET MVC
Introduction To ASP.NET MVCAlan Dean
 
HTML (Hyper Text Markup Language) Project
HTML (Hyper Text Markup Language) Project HTML (Hyper Text Markup Language) Project
HTML (Hyper Text Markup Language) Project Ankit Gupta
 
course slides -- powerpoint
course slides -- powerpointcourse slides -- powerpoint
course slides -- powerpointwebhostingguy
 
Web designing using html
Web designing using htmlWeb designing using html
Web designing using htmljulicris021488
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 

Similar a Ch 27 (20)

Before start
Before startBefore start
Before start
 
Download Workshop Lecture
Download Workshop LectureDownload Workshop Lecture
Download Workshop Lecture
 
How To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My WebHow To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My Web
 
HTML
HTMLHTML
HTML
 
Intro to html
Intro to htmlIntro to html
Intro to html
 
Intro to html
Intro to htmlIntro to html
Intro to html
 
Tugas Pw [6]
Tugas Pw [6]Tugas Pw [6]
Tugas Pw [6]
 
Tugas Pw [6] (2)
Tugas Pw [6] (2)Tugas Pw [6] (2)
Tugas Pw [6] (2)
 
Xhtml Part2
Xhtml Part2Xhtml Part2
Xhtml Part2
 
CIS 451: Introduction to ASP.NET
CIS 451: Introduction to ASP.NETCIS 451: Introduction to ASP.NET
CIS 451: Introduction to ASP.NET
 
HTML5
HTML5HTML5
HTML5
 
Introduction To ASP.NET MVC
Introduction To ASP.NET MVCIntroduction To ASP.NET MVC
Introduction To ASP.NET MVC
 
HTML (Hyper Text Markup Language) Project
HTML (Hyper Text Markup Language) Project HTML (Hyper Text Markup Language) Project
HTML (Hyper Text Markup Language) Project
 
course slides -- powerpoint
course slides -- powerpointcourse slides -- powerpoint
course slides -- powerpoint
 
Html
HtmlHtml
Html
 
Web designing using html
Web designing using htmlWeb designing using html
Web designing using html
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 

Más de soumya ranjan mohanty (11)

Ch 22
Ch 22Ch 22
Ch 22
 
Ch 21
Ch 21Ch 21
Ch 21
 
Ch 17
Ch 17Ch 17
Ch 17
 
Ch 11
Ch 11Ch 11
Ch 11
 
Ch 09
Ch 09Ch 09
Ch 09
 
Ch 08
Ch 08Ch 08
Ch 08
 
Ch 06
Ch 06Ch 06
Ch 06
 
Ch 05
Ch 05Ch 05
Ch 05
 
Ch 04
Ch 04Ch 04
Ch 04
 
Ch 03
Ch 03Ch 03
Ch 03
 
Ch 1
Ch 1Ch 1
Ch 1
 

Último

Instruction Manual | ThermTec Hunt Thermal Clip-On Series | Optics Trade
Instruction Manual | ThermTec Hunt Thermal Clip-On Series | Optics TradeInstruction Manual | ThermTec Hunt Thermal Clip-On Series | Optics Trade
Instruction Manual | ThermTec Hunt Thermal Clip-On Series | Optics TradeOptics-Trade
 
Technical Data | ThermTec Wild 650L | Optics Trade
Technical Data | ThermTec Wild 650L | Optics TradeTechnical Data | ThermTec Wild 650L | Optics Trade
Technical Data | ThermTec Wild 650L | Optics TradeOptics-Trade
 
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docxFrance's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docxEuro Cup 2024 Tickets
 
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...Eticketing.co
 
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝soniya singh
 
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样7pn7zv3i
 
Austria vs France David Alaba Switches Position to Defender in Austria's Euro...
Austria vs France David Alaba Switches Position to Defender in Austria's Euro...Austria vs France David Alaba Switches Position to Defender in Austria's Euro...
Austria vs France David Alaba Switches Position to Defender in Austria's Euro...Eticketing.co
 
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited MoneyReal Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited MoneyApk Toly
 
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024Judith Chuquipul
 
IPL Quiz ( weekly quiz) by SJU quizzers.
IPL Quiz ( weekly quiz) by SJU quizzers.IPL Quiz ( weekly quiz) by SJU quizzers.
IPL Quiz ( weekly quiz) by SJU quizzers.SJU Quizzers
 
Instruction Manual | ThermTec Wild Thermal Monoculars | Optics Trade
Instruction Manual | ThermTec Wild Thermal Monoculars | Optics TradeInstruction Manual | ThermTec Wild Thermal Monoculars | Optics Trade
Instruction Manual | ThermTec Wild Thermal Monoculars | Optics TradeOptics-Trade
 
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/78377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7dollysharma2066
 
Expert Pool Table Refelting in Lee & Collier County, FL
Expert Pool Table Refelting in Lee & Collier County, FLExpert Pool Table Refelting in Lee & Collier County, FL
Expert Pool Table Refelting in Lee & Collier County, FLAll American Billiards
 
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdfJORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdfArturo Pacheco Alvarez
 
Technical Data | ThermTec Wild 335 | Optics Trade
Technical Data | ThermTec Wild 335 | Optics TradeTechnical Data | ThermTec Wild 335 | Optics Trade
Technical Data | ThermTec Wild 335 | Optics TradeOptics-Trade
 
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best ServicesMysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best Servicesnajka9823
 

Último (18)

young Call girls in Moolchand 🔝 9953056974 🔝 Delhi escort Service
young Call girls in Moolchand 🔝 9953056974 🔝 Delhi escort Serviceyoung Call girls in Moolchand 🔝 9953056974 🔝 Delhi escort Service
young Call girls in Moolchand 🔝 9953056974 🔝 Delhi escort Service
 
Instruction Manual | ThermTec Hunt Thermal Clip-On Series | Optics Trade
Instruction Manual | ThermTec Hunt Thermal Clip-On Series | Optics TradeInstruction Manual | ThermTec Hunt Thermal Clip-On Series | Optics Trade
Instruction Manual | ThermTec Hunt Thermal Clip-On Series | Optics Trade
 
Technical Data | ThermTec Wild 650L | Optics Trade
Technical Data | ThermTec Wild 650L | Optics TradeTechnical Data | ThermTec Wild 650L | Optics Trade
Technical Data | ThermTec Wild 650L | Optics Trade
 
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docxFrance's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
 
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
 
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
 
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
 
Austria vs France David Alaba Switches Position to Defender in Austria's Euro...
Austria vs France David Alaba Switches Position to Defender in Austria's Euro...Austria vs France David Alaba Switches Position to Defender in Austria's Euro...
Austria vs France David Alaba Switches Position to Defender in Austria's Euro...
 
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited MoneyReal Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
 
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
 
IPL Quiz ( weekly quiz) by SJU quizzers.
IPL Quiz ( weekly quiz) by SJU quizzers.IPL Quiz ( weekly quiz) by SJU quizzers.
IPL Quiz ( weekly quiz) by SJU quizzers.
 
FULL ENJOY Call Girls In Savitri Nagar (Delhi) Call Us 9953056974
FULL ENJOY Call Girls In  Savitri Nagar (Delhi) Call Us 9953056974FULL ENJOY Call Girls In  Savitri Nagar (Delhi) Call Us 9953056974
FULL ENJOY Call Girls In Savitri Nagar (Delhi) Call Us 9953056974
 
Instruction Manual | ThermTec Wild Thermal Monoculars | Optics Trade
Instruction Manual | ThermTec Wild Thermal Monoculars | Optics TradeInstruction Manual | ThermTec Wild Thermal Monoculars | Optics Trade
Instruction Manual | ThermTec Wild Thermal Monoculars | Optics Trade
 
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/78377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
 
Expert Pool Table Refelting in Lee & Collier County, FL
Expert Pool Table Refelting in Lee & Collier County, FLExpert Pool Table Refelting in Lee & Collier County, FL
Expert Pool Table Refelting in Lee & Collier County, FL
 
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdfJORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
JORNADA 3 LIGA MURO 2024GHGHGHGHGHGH.pdf
 
Technical Data | ThermTec Wild 335 | Optics Trade
Technical Data | ThermTec Wild 335 | Optics TradeTechnical Data | ThermTec Wild 335 | Optics Trade
Technical Data | ThermTec Wild 335 | Optics Trade
 
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best ServicesMysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
 

Ch 27

  • 1. Chapter 27 HTTP and WWW
  • 2. 27.1 HTTP Transaction Request Message Response Message Headers
  • 3. HTTP uses the services of TCP on well-known port 80. Note :
  • 4. Figure 27.1 HTTP transaction
  • 5. Figure 27.2 Request message
  • 6. Figure 27.3 Request line
  • 8. Figure 27.5 Response message
  • 9. Figure 27.6 Status line
  • 10. Figure 27.7 Header format
  • 11. Figure 27.8 Headers
  • 12. Example 1 This example retrieves a document. We use the GET method to retrieve an image with the path /usr/bin/image1. The request line shows the method (GET), the URL, and the HTTP version (1.1). The header has two lines that show that the client can accept images in GIF and JPEG format. The request does not have a body. The response message contains the status line and four lines of header. The header lines define the date, server, MIME version, and length of the document. The body of the document follows the header (see Fig. 27.9, next slide).
  • 13. Figure 27.9 Example 1
  • 14. Example 2 This example retrieves information about a document. We use the HEAD method to retrieve information about an HTML document (see the next section). The request line shows the method (HEAD), URL, and HTTP version (1.1). The header is one line showing that the client can accept the document in any format (wild card). The request does not have a body. The response message contains the status line and five lines of header. The header lines define the date, server, MIME version, type of document, and length of the document (see Fig. 27.10, next slide). Note that the response message does not contain a body.
  • 15. Figure 27.10 Example 2
  • 16. HTTP version 1.1 specifies a persistent connection by default. Note :
  • 17. 27.2 World Wide Web Hypertext and Hypermedia Browser Architecture Static Document/HTML Dynamic Document/CGI Active Document/Java
  • 18. Figure 27.11 Distributed services
  • 19. Figure 27.12 Hypertext
  • 20. Figure 27.13 Browser architecture
  • 21. Figure 27.14 Categories of Web documents
  • 22. Figure 27.15 Static document
  • 23. Figure 27.16 Boldface tags
  • 24. Figure 27.17 Effect of boldface tags
  • 25. Figure 27.18 Beginning and ending tags
  • 26. Table 27.1 Common tags Skeletal Tags </Hn> </TITLE> </BODY> </HEAD> </HTML> Ending Tag Defines the title of the document <Hn> Defines the title of the document <TITLE> Title and Header Tags Defines the body of the document <BODY> Defines the head of the document <HEAD> Defines an HTML document <HTML> Meaning Beginning Tag
  • 27. Table 27.1 Common tags (continued) Superscript </SUP> <SUP> Subscript </SUB> <SUB> Text Formatting Tags </BR> </CENTER> </U> </I> </B> Ending Tag Line break <BR> Centered <CENTER> Data Flow Tag Underlined <U> Italic <I> Boldface <B> Meaning Beginning Tag
  • 28. Table 27.1 Common tags (continued) Executable Contents The document is an applet </APPLET> <APPLET> Hyperlink Tag Defines an address (hyperlink) </A> <A> List Tags </LI> </UL> </OL> Ending Tag Defines an image <IMG> Image Tag An item in a list <LI> Unordered list <UL> Ordered list <OL> Meaning Beginning Tag
  • 29. Example 3 This example shows how tags are used to let the browser format the appearance of the text. <HTML> <HEAD> <TITLE> First Sample Document </TITLE> </HEAD> <BODY> <CENTER> <H1><B> ATTENTION </B></H1> </CENTER> You can get a copy of this document by: <UL> <LI> Writing to the publisher <LI> Ordering online <LI> Ordering through a bookstore </UL> </BODY> </HTML>
  • 30. Example 4 This example shows how tags are used to import an image and insert it into the text. <HTML> <HEAD> <TITLE> Second Sample Document </TITLE> </HEAD> <BODY> This is the picture of a book: <IMG SRC=&quot;Pictures/book1.gif&quot; ALIGN=MIDDLE> </BODY> </HTML>
  • 31. Example 5 This example shows how tags are used to make a hyperlink to another document. <HTML> <HEAD> <TITLE> Third Sample Document </TITLE> </HEAD> <BODY> This is a wonderful product that can save you money and time. To get information about the producer, click on <A HREF=&quot;http://www.phony.producer&quot;> Producer </A> </BODY> </HTML>
  • 32. Figure 27.19 Dynamic document
  • 33. Example 6 Example 6 is a CGI program written in Bourne shell script. The program accesses the UNIX utility (date) that returns the date and the time. Note that the program output is in plain text. #!/bin/sh # The head of the program echo Content_type: text/plain echo # The body of the program now='date' echo $now exit 0
  • 34. Example 7 Example 7 is similar to Example 6 except that program output is in HTML. #!/bin/sh # The head of the program echo Content_type: text/html echo # The body of the program echo <HTML> echo <HEAD><TITLE> Date and Time </TITLE></HEAD> echo <BODY> now='date' echo <CENTER><B> $now </B></CENTER> echo </BODY> echo </HTML> exit 0
  • 35. Example 8 Example 8 is similar to Example 7 except that the program is written in Perl. #!/bin/perl # The head of the program print &quot;Content_type: text/html&quot;; print &quot;&quot;; # The body of the program print &quot;<HTML>&quot;; print &quot;<HEAD><TITLE> Date and Time </TITLE></HEAD>&quot;; print &quot;<BODY>&quot;; $now = 'date'; print &quot;<CENTER><B> $now </B></CENTER>&quot;; print &quot;</BODY>&quot;; print &quot;</HTML>&quot;; exit 0
  • 36. Figure 27.20 Active document
  • 37. Figure 27.21 Skeleton of an applet
  • 38. Figure 27.22 Instantiation of the object defined by an applet
  • 39. Figure 27.23 Creation and compilation
  • 40. Figure 27.24 HTML document carrying an applet
  • 41. Example 9 In this example, we first import two packages, java.awt and java.applet. They contain the declarations and definitions of classes and methods that we need. Our example uses only one publicly inherited class called First. We define only one public method, paint. The browser can access the instance of First through the public method paint. The paint method, however, calls another method called drawString, which is defined in java.awt.*. import java.applet.*; import java.awt.*; public class First extends Applet { public void paint (Graphics g) { g.drawString (&quot;Hello World&quot;, 100, 100); } }
  • 42. Example 10 In this example, we modify the program in Example 9 to draw a line. Instead of method drawString, we use another method called drawLine. This method needs four parameters: the x and y coordinates at the beginning of the line and the x and y coordinates at the end of the line. We use 0, 0 for the beginning and 80, 90 for the end. import java.applet.*; import java.awt.*; public class Second extends Applet { public void paint (Graphics g) { g.drawLine (0, 0, 80, 90); } }