World Wide Web Components - NYU Stern:World Wide Web部件-纽约大学斯特恩
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Browser functionality can also be extended by adding plugins.
Plugins are not standalone applications, but executable code that is dynamically linked into the browser when necessary.
application CGI program can be in any language that runs on the
server, including a shell language like sh or bash.
CGI Programming
http form content B
GET format
Information is passed as a series of variable=value pairs separated by “&” to program named in action statement by adding them on to the URL (after a “?”)
The WEB Server takes information from form, and passes it on as input to a Common Gateway Interface Program (CGI)
Output of CGI program is sent back to Client browser as an HTML (or other) file.
information Put the name of the CGI program in the
“ACTION” statement of the form.
Note: program can be on another server.
CGI Two Processing options
button) Server runs the CGI program named in the
ACTION section of the FORM CGI program parses data as input Output of CGI program is sent by the server to
Solution HTML5 and it’s features
Writing a CGI Program
CGI program needs to
Parse form input Process the input Generate html output
GET vs. POST Alternative CGI methods
World Wide Web Components
Browsers and Servers CGI Processing Model (Common Gateway Interface)
© Norman White, 2019
Agenda
WWW and Client Server computing Forms & CGI programming Writing a CGI program
CGI programming extends power of WWW
CGI programs can do an almost unlimited set of activities ...
Look up info in a database and send it to Browser. Take input from user and add to a file. Take input and send to a standard business
Simple example – one line form with a field named “userid” and “ACTION=mycgiprog.cgi”
User enters “nwhite” Browser sends the following to the web server
Many toolkits available to do common things
Disadvantages
All processing is done on server. May overload server
Interaction is all through forms Lot’s of data traffic back and forth
http request
B
index1.html
Index1.html
GET pic1.gif
pic1.gif
Server next sends pic1.gif
Server
Browser displays pic1.gif
http request
B
index1.html
index1.html
pic1.gif
Forms and CGI Programming
HTML provides an easy to use FORM capability, which allows a wide variety of input forms to be easily generated.
Form data types include
Browser applications understand HTML, (and now Javascript, Java etc.)
Server Browser Interaction (simple)
http request
B
Server
Browser sends http request to server (I.e. GET index1.html)
the client (i.e. it should be HTML)
CGI Advantages and Disadvantages
Advantages
Very general model, easy to do really neat things like front end existing applications, databases etc.
http request
B
HTML file
Server
Server retrieves file Sends file (index1.html) to Browser
Browser displays file
http request
B
HTML
index1.html
Server
Browser “formats” index1.html May mean retrieving more files In order to display
Browser asks for next file
B
index1.html
http request HTML
GET pic1.gif
Server
index1.html contains reference to pic1.gif Browser then requests pic1.gif
Server sends pic1.gif
GET pic1.gif
pic1.gif
Browser displays pic1.gif
Server
RESULT ???
Processing Non-HTML files
Web Server sends a header in front of each file identifying the file type (HTML,GIF,JPEG etc.)
Index1.html file
<html> <head> <title> Sample Title</title> </head> <body> Here is some text and a picture <img src=“pic1.gif:> </body> </html>
Server Response
Text input - One line of text Textarea - Multiple lines of text Check boxes (on/off) Radio boxes (1 of N) Etc.
Forms Processing Logic
Output of Form is formatted and sent to Server, along with the name of a program to process the contents of the form.
Most Browsers understand HTML, GIF and TEXT
Browsers can be configured to call external programs to handle new types of files
Helper Apps
These programs are called HELPER applications and dramatically extend the capabilities of the browser, since they can be developed independently of the client software
HTML
http server
input output
CGI Program
(Note, all processing is on server)
BREAK??
What do you need to do for CGI?
Develop form to collect information from users Write and test CGI program to handle form
Examples - Quicktime viewers, sound players, VRML viewers etc.
To see the currently configured viewers go to options on the Browser title bar
Plugins
/~nwhite/mycgiprog.cgi?userid=nwhite
GET Processing Server Side
Web server takes the information after the “?”
Two Types of FORM processing options, GET and POST
GET - parameters sent as additions to URL string. Each individual parameter separated by &
POST - Data sent in message body. This is a more general method and can handle more input data.
WWW is example of Client/Server Computing
Server computers are located all around the world and respond to requests (messages) from computers running browser software (Netscape, IE)
CGI Processing - review
Server sends form (in html document) to client Client displays form, and user fills in fields Client sends form info to server (SUBMIT
Plugins are not standalone applications, but executable code that is dynamically linked into the browser when necessary.
application CGI program can be in any language that runs on the
server, including a shell language like sh or bash.
CGI Programming
http form content B
GET format
Information is passed as a series of variable=value pairs separated by “&” to program named in action statement by adding them on to the URL (after a “?”)
The WEB Server takes information from form, and passes it on as input to a Common Gateway Interface Program (CGI)
Output of CGI program is sent back to Client browser as an HTML (or other) file.
information Put the name of the CGI program in the
“ACTION” statement of the form.
Note: program can be on another server.
CGI Two Processing options
button) Server runs the CGI program named in the
ACTION section of the FORM CGI program parses data as input Output of CGI program is sent by the server to
Solution HTML5 and it’s features
Writing a CGI Program
CGI program needs to
Parse form input Process the input Generate html output
GET vs. POST Alternative CGI methods
World Wide Web Components
Browsers and Servers CGI Processing Model (Common Gateway Interface)
© Norman White, 2019
Agenda
WWW and Client Server computing Forms & CGI programming Writing a CGI program
CGI programming extends power of WWW
CGI programs can do an almost unlimited set of activities ...
Look up info in a database and send it to Browser. Take input from user and add to a file. Take input and send to a standard business
Simple example – one line form with a field named “userid” and “ACTION=mycgiprog.cgi”
User enters “nwhite” Browser sends the following to the web server
Many toolkits available to do common things
Disadvantages
All processing is done on server. May overload server
Interaction is all through forms Lot’s of data traffic back and forth
http request
B
index1.html
Index1.html
GET pic1.gif
pic1.gif
Server next sends pic1.gif
Server
Browser displays pic1.gif
http request
B
index1.html
index1.html
pic1.gif
Forms and CGI Programming
HTML provides an easy to use FORM capability, which allows a wide variety of input forms to be easily generated.
Form data types include
Browser applications understand HTML, (and now Javascript, Java etc.)
Server Browser Interaction (simple)
http request
B
Server
Browser sends http request to server (I.e. GET index1.html)
the client (i.e. it should be HTML)
CGI Advantages and Disadvantages
Advantages
Very general model, easy to do really neat things like front end existing applications, databases etc.
http request
B
HTML file
Server
Server retrieves file Sends file (index1.html) to Browser
Browser displays file
http request
B
HTML
index1.html
Server
Browser “formats” index1.html May mean retrieving more files In order to display
Browser asks for next file
B
index1.html
http request HTML
GET pic1.gif
Server
index1.html contains reference to pic1.gif Browser then requests pic1.gif
Server sends pic1.gif
GET pic1.gif
pic1.gif
Browser displays pic1.gif
Server
RESULT ???
Processing Non-HTML files
Web Server sends a header in front of each file identifying the file type (HTML,GIF,JPEG etc.)
Index1.html file
<html> <head> <title> Sample Title</title> </head> <body> Here is some text and a picture <img src=“pic1.gif:> </body> </html>
Server Response
Text input - One line of text Textarea - Multiple lines of text Check boxes (on/off) Radio boxes (1 of N) Etc.
Forms Processing Logic
Output of Form is formatted and sent to Server, along with the name of a program to process the contents of the form.
Most Browsers understand HTML, GIF and TEXT
Browsers can be configured to call external programs to handle new types of files
Helper Apps
These programs are called HELPER applications and dramatically extend the capabilities of the browser, since they can be developed independently of the client software
HTML
http server
input output
CGI Program
(Note, all processing is on server)
BREAK??
What do you need to do for CGI?
Develop form to collect information from users Write and test CGI program to handle form
Examples - Quicktime viewers, sound players, VRML viewers etc.
To see the currently configured viewers go to options on the Browser title bar
Plugins
/~nwhite/mycgiprog.cgi?userid=nwhite
GET Processing Server Side
Web server takes the information after the “?”
Two Types of FORM processing options, GET and POST
GET - parameters sent as additions to URL string. Each individual parameter separated by &
POST - Data sent in message body. This is a more general method and can handle more input data.
WWW is example of Client/Server Computing
Server computers are located all around the world and respond to requests (messages) from computers running browser software (Netscape, IE)
CGI Processing - review
Server sends form (in html document) to client Client displays form, and user fills in fields Client sends form info to server (SUBMIT