Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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