1 / 42

HTTP - Forms - AppEngine

HTTP - Forms - AppEngine. Jim Eng jimeng@umich.edu. Making an HTTP request. Connect to the server a "hand shake" Request a document (or the default document) GET http://dr-chuck.com/page1.htm GET http://www.mlive.com/ann-arbor/ GET http://www.facebook.com.

ursula
Download Presentation

HTTP - Forms - AppEngine

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HTTP - Forms - AppEngine • Jim Eng • jimeng@umich.edu

  2. Making an HTTP request • Connect to the server • a "hand shake" • Request a document (or the default document) • GET http://dr-chuck.com/page1.htm • GET http://www.mlive.com/ann-arbor/ • GET http://www.facebook.com

  3. http://www.dr-chuck.com/page1.htm protocol host document

  4. Browser

  5. Web Server Browser

  6. Web Server GET http://www.dr-chuck.com/page2.htm Browser

  7. Web Server <h1>The Second Page</h1><p>If you like, you can switch back to the <a href="page1.htm">First Page</a>.</p> GET http://www.dr-chuck.com/page2.htm Browser

  8. Web Server <h1>The Second Page</h1><p>If you like, you can switch back to the <a href="page1.htm">First Page</a>.</p> GET http://www.dr-chuck.com/page2.htm Browser

  9. Web Server <h1>The Second Page</h1><p>If you like, you can switch back to the <a href="page1.htm">First Page</a>.</p> An HTTP request - response cycle GET http://www.dr-chuck.com/page2.htm Browser

  10. Making an HTTP request • Connect to the server • a "hand shake" • Request a document (or the default document) • GET http://dr-chuck.com/page1.htm • GET http://www.mlive.com/ann-arbor/ • GET http://www.facebook.com

  11. Firebug helps again • If you haven't already installed Firebug, you need it now • It can help explore the HTTP request-response cycle • Some simple-looking pages involve lots of requests: • HTML page(s) • Image files • CSS Style Sheets • Javascript files

  12. print "Your guess is", guess answer = 42 if guess < answer : print "Your guess is too low" if guess == answer : print "Congratulations!" if guess > answer : print "Your guess is too high"

  13. Logical expressions True or false? print "Your guess is", guess answer = 42 if guess < answer : print "Your guess is too low" if guess == answer : print "Congratulations!" if guess > answer : print "Your guess is too high"

  14. <p>Your guess is 20.</p> <p>Your guess is too low.</p> <form method="post" action="/"> <p> Enter Guess: <input type="text" name="guess" /> </p> <p> <input type="submit" /> </p> </form>

  15. <p>Your guess is 20.</p> <p>Your guess is too low.</p> <form method="post" action="/"> <p> Enter Guess: <input type="text" name="guess" /> </p> <p> <input type="submit" /> </p> </form>

  16. Attributes of a form element • "action" attribute tells where to submit the form • Usually the path to a script or program on the server that processes the form inputs • "method" attribute tells how to submit the form • In this case using HTTP POST • See page 30 of RFC 1945

  17. Intended purpose of POST • Posting a message to a bulletin board, newsgroup, mailing list • Annotation of existing resources • Extending a database through an append operation • Creating a new object • Providing a block of data, such as the result of submitting a form

  18. As opposed to GET • Retrieve a resource identified by the path portion of the URL

  19. Browser <input type="text" name="guess" />

  20. Web Server Browser <input type="text" name="guess" />

  21. Web Server POST / Accept: www/source Accept: text/html User-Agent: Lynx/2.4 libwww/2.14 Content-type: application/x-www-form-urlencoded Content-length: 8 guess=25 HTTP Request Browser <input type="text" name="guess" />

  22. 1 POST /

  23. 1 POST / 2

  24. 1 POST / 2 <html> ... 3

  25. Text -1

  26. Text

  27. This is a job for ... ... Google App Engine • Installing App Engine • Demo of ae-01-trivial • Demo of ae-01-guess • Preview of next assignment

More Related