Smalltalk Daily 09/10/10: Creating HTTP POSTs
Today's Smalltalk Daily looks at doing Http POST and GET requests in Cincom Smalltalk - VisualWorks or ObjectStudio. The examples I used are below; they hit a simple servlet I have on a test server in my office. To skip to the video now, click here.
"Do a simple GET" response := HttpClient new get: 'http://victoria:8011/blog/servlet/TestBlogServlet' "Do a POST request for a site that should be there" postData := OrderedCollection with: 'blog' -> 'blog'. client := HttpClient new. request := HttpRequest method: 'POST' url: 'http://victoria:8011/blog/servlet/TestBlogServlet'. request formData: postData. client executeRequest: request. "Do a POST request for a site that should not be there" postData := OrderedCollection with: 'blog' -> 'foo'. client := HttpClient new. request := HttpRequest method: 'POST' url: 'http://victoria:8011/blog/servlet/TestBlogServlet'. request formData: postData. client executeRequest: request.
To watch now, use the viewer below:
If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.
You can also watch it on YouTube:
Enclosures:
[http://www.cincomsmalltalk.com/casts/stDaily/2010/smalltalk_daily-09-10-10-iPhone.m4v ( Size: 7433716 )]

