Last change
on this file since 31525 was 31525, checked in by ak19, 7 years ago |
Nathan provided more stuff: Themes folder contains Sencha's Themebuilder which generates GXT Themes. It includes the .theme and generated .jar files for the project theme.
|
File size:
772 bytes
|
Rev | Line | |
---|
[31525] | 1 | # Example using HTTP POST operation
|
---|
| 2 | page = require("webpage").create()
|
---|
| 3 | server = require("webserver").create()
|
---|
| 4 | system = require("system")
|
---|
| 5 | data = "universe=expanding&answer=42"
|
---|
| 6 | if system.args.length isnt 2
|
---|
| 7 | console.log "Usage: postserver.js <portnumber>"
|
---|
| 8 | phantom.exit 1
|
---|
| 9 | port = system.args[1]
|
---|
| 10 | service = server.listen(port, (request, response) ->
|
---|
| 11 | console.log "Request received at " + new Date()
|
---|
| 12 | response.statusCode = 200
|
---|
| 13 | response.headers =
|
---|
| 14 | Cache: "no-cache"
|
---|
| 15 | "Content-Type": "text/plain;charset=utf-8"
|
---|
| 16 |
|
---|
| 17 | response.write JSON.stringify(request, null, 4)
|
---|
| 18 | response.close()
|
---|
| 19 | )
|
---|
| 20 | page.open "http://localhost:" + port + "/", "post", data, (status) ->
|
---|
| 21 | if status isnt "success"
|
---|
| 22 | console.log "Unable to post!"
|
---|
| 23 | else
|
---|
| 24 | console.log page.plainText
|
---|
| 25 | phantom.exit()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.