Remarks on CGI programming with Flash - PowerPoint PPT Presentation

Loading...

PPT – Remarks on CGI programming with Flash PowerPoint presentation | free to download - id: 1827ed-ZDc1Z



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Remarks on CGI programming with Flash

Description:

Remarks on CGI programming with Flash. Dr. Hsung Tai-Chiu ... Accept-Encoding: gzip, deflate. User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) ... – PowerPoint PPT presentation

Number of Views:219
Avg rating:3.0/5.0
Slides: 28
Provided by: hsungt
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Remarks on CGI programming with Flash


1
Remarks on CGI programming with Flash
  • Dr. Hsung Tai-Chiu
  • Department of Electronic and Information
    Engineering,
  • The Hong Kong Polytechnic University
  • March 2001

2
TOC
  • Client-server communications using HTTP
  • CGI enabled Web server
  • How Flash talk with CGI enabled web server

3
HTTP communications
1) HTTP requests
2) HTTP replies
4
HTTP requests - method GET
GET http//host/path?query_string HTTP/1.1
A HTTP GET request
  • GET http//host/path?query_string HTTP/1.1CR LF
  • Accept image/gif, image/x-xbitmap, image/jpeg,
    image/pjpeg, /CR LF
  • Accept-Language zh-twCR LF
  • Accept-Encoding gzip, deflateCR LF
  • User-Agent Mozilla/4.0 (compatible MSIE 5.5
    Windows NT 5.0)CR LF
  • Host 158.132.148.224CR LF
  • Connection Keep-AliveCR LF
  • CR LF

CR, LF are ASCII 13 and 10 respectively.
5
METHOD GET
GET http//host/path?query_string HTTP/1.1
Query separator
URL of the resource
Query string - used as input parameters
6
HTTP requests - method POST
Content-Length 20
A HTTP POST request
  • POST http//host/path HTTP/1.1CR LF
  • Accept image/gif, image/x-xbitmap, image/jpeg,
    image/pjpeg, /CR LF
  • Accept-Language zh-twCR LF
  • Accept-Encoding gzip, deflateCR LF
  • User-Agent Mozilla/4.0 (compatible MSIE 5.5
    Windows NT 5.0)CR LF
  • Host 158.132.148.224CR LF
  • Content-Length 20CR LF
  • Connection Keep-AliveCR LF
  • CR LF
  • this_is_query_string

this_is_query_string
7
METHOD POST
URL of the resource
POST http//host/path HTTP/1.1 Content-Length
20 CR LF this_is_query_string
Length of the body
query body
8
HTTP responses
  • Most content of HTTP responses are static HTML
    documents
  • Dynamic contents maybe define on server side
    other than HTML.

9
HTTP responses
  • HTTP/1.1 result_Code reason
  • .
  • Content-type text/plain CR LF
  • Content-length 123 CR LF
  • CR LF
  • content.

Response line
Response headers
Response body
10
CGI
  • CGI stands for Common Gate Interface.
  • For external gateway programs to interface with
    information servers such as HTTP server.
  • MOST HTTP server support this standard.

11
Web server response
1) HTTP requests
3) HTTP replies
2) Read documents from stores.
12
CGI enabled web servers
1) HTTP requests
5) HTTP replies
CGI
2) query string
4) Response header and content
3) Backend logic (e.g. CGI program)
13
How flash talk with CGI program?
  • Use GET or POST method.
  • URL encoded variables upload application/x-www-ur
    lformencoded
  • Send variables to server. e.g.
  • choice123var2hellomessageWelcometom21

Choice var2 message
14
Flash load variables action
Level ID of the movie clip.
Instance of name of the target movie.
15
Flash load variable using GET
Initial value
Variable value of var1
1
Variable value of choice
16
Flash load variable using GET
HTTP request
GET /cgiprogram?var1Initialvaluechoice1
HTTP/1.1 Accept / Accept-Encoding gzip,
deflate User-Agent Mozilla/4.0 (compatible MSIE
5.5 Windows NT 5.0) Host 158.132.148.224 Connect
ion Keep-Alive Cookie wja_pcache_id1648660179
17
Flash load variable using POST
Variable value of var1
Initial value
Variable value of Textfield2
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvw
xyz 1234567890-\',./ !_at_()_"ltgt?
18
Flash load variable using POST
HTTP request
POST /cgiprogram HTTP/1.1 Accept
/ Content-Type application/x-www-form-urlencode
d Accept-Encoding gzip, deflate User-Agent
Mozilla/4.0 (compatible MSIE 5.5 Windows NT
5.0) Host 158.132.148.2243086 Content-Length
197 Connection Keep-Alive Cache-Control
no-cache Cookie wja_pcache_id1648660179 var1In
itialvalueTextField2ABCDEFGHIJKLMNOPQRSTUVWXYZ
0Dabcdefghijklmnopqrstuvwxyz0D6012345678902D3D
5B5D5C3B272C2E2F0D7E21402324255E2
62A28295F2B7B7D7C3A223C3E3F
19
Server response on load variables
  • Most web server only need the CGI program to
    supply the content type and the body.
  • For Apache, the output of CGI program

Content-type application/x-www-urlformencoded CR
LF CR LF choicecrossanother_varanother_value
CGI output
20
A server response example
HTTP response
HTTP/1.1 200 OK Date Fri, 23 Mar 2001 014822
GMT Server Apache/1.3.12 (Unix) (Red Hat/Linux)
PHP/4.0.1pl2 mod_perl/1.24 Transfer-Encoding
chunked Content-Type application/x-www-form-urlen
coded 26 choicecrossanother_varanother_value
0
Length, in HEX
21
Flash load movies?
  • A running Flash movie can load an external flash
    movie (SWF) on top of it.
  • The new movie can be loaded on to different
    levels, which are identified by the level ID.
  • The new movie can also be loaded to replace a
    movie clip instance, which are identified by
    instance name.

22
Flashs multiple timelines
  • Multiple timelines may be present in playing back
    in Flash players.
  • Each movie has its own main timeline.
  • Each movie clip instance contains its own
    timeline.
  • Additional timeline can be created using Load
    movies.

23
Flashs multiple timelines
  • E.g.
  • Movie1.swf (level 0)
  • clipA (instance namem_1)
  • clipAA (instance namemm_1)
  • clipAA (instance namemm_2)
  • clipB(instance namem_1)
  • Movie2.swf (level 1)
  • Use Tell Target to pass message to other
    instances.

24
Flash action
Level ID of the movie clip.
Instance of name of the target movie.
25
Response the Flash Movie
  • For loading movie clip onto the current flash
    movie, the CGI program should output the content
    type application/x-shockwave-flash and the
    movie as body

CGI output
Content-type application/x-shockwave-flash CR
LF CR LF FWS.. .theflashmovie. ..
Flash movie content
26
Summary
  • Flash upload variables in URL form encoded.
  • Apache CGI programs should produce output to
    stdout.

27
Summary (continued)
  • For responding variables
  • Content-Type application/x-www-form-urlencoded
  • For responding movies
  • Content-type application/x-shockwave-flash
About PowerShow.com