. .

smalltalkDaily

Smalltalk Daily 9/10/10: Creating HTTP POSTs

September 10, 2010 7:32:13.781

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.

If you can't see the embedded video directly, you can go directly to YouTube for it.


"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, click on the viewer below:

You can follow the Smalltalk channel on YouTube for all the "Smalltalk Daily" videos. You can also check out the videos on Vimeo, where the quality is higher, or over on Facebook, if you are a member.

You can download the video directly here. If you need the video in a Windows Media format, then download that here. If you like this kind of video, why not subscribe to "Smalltalk Daily"?

Technorati Tags: , , ,

posted by James Robertson

 Share Tweet This