Skip to content

Instantly share code, notes, and snippets.

@StefanKrecher
Created January 5, 2012 15:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StefanKrecher/1565660 to your computer and use it in GitHub Desktop.
Save StefanKrecher/1565660 to your computer and use it in GitHub Desktop.
Ambrhino (Smalltalk/Amber-, Java-, Javascript-Mixture) example: makes HTTP-GET-Request & display result on a JFrame
| url con is isr br line content pane frame |
<importPackage(java.net)>.
<importPackage(java.io)>.
url := <new URL('http://www.esvapi.org/v2/rest/passageQuery?key=IP&passage=Psalm+23&include-headings=false')>.
con := url openConnection.
is := con getInputStream.
isr := <new InputStreamReader(is)>.
br := <new BufferedReader(isr)>.
content := ''.
line := ''.
[ line isNil ] whileFalse: [
line := br readLine.
content := content, line.
].
pane := <new JTextPane()>.
pane setContentType: 'text/html'.
pane setText: (content printString).
frame := <new JFrame()>.
frame getContentPane add: pane.
frame pack; setVisible: true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment