diff --git a/resources/README.md b/resources/README.md new file mode 100644 index 0000000..68c9978 --- /dev/null +++ b/resources/README.md @@ -0,0 +1,40 @@ +Introduction +------------ + +HTTP Requests for Processing is a small library that takes the pain out of doing HTTP requests in Processing. + +HTTP Requests for Processing is based on code by [Chris Allick](http://chrisallick.com/) and [Daniel Shiffman](http://www.shiffman.net/). + + +How to +------------ +Install the library by [downloading the latest release](https://github.com/runemadsen/HTTProcessing/releases) or via the [Processing contribution manager](http://wiki.processing.org/w/How_to_Install_a_Contributed_Library). + +Then import the library in your sketch: +```Java +import http.requests.*; +``` +Then you can make GET and POST requests from your code: +```Java +GetRequest get = new GetRequest("http://httprocessing.heroku.com"); +get.send(); +println("Reponse Content: " + get.getContent()); +println("Reponse Content-Length Header: " + get.getHeader("Content-Length")); + +PostRequest post = new PostRequest("http://httprocessing.heroku.com"); +post.addData("name", "Rune"); +post.send(); +println("Reponse Content: " + post.getContent()); +println("Reponse Content-Length Header: " + post.getHeader("Content-Length")); +``` +To authenticate requests using a Basic Access authentication scheme, include the following in your requests: +```Java +get.addUser("username", "password"); +post.addUser("username", "password"); +``` + To add a header to your request, including the following: +```Java + //method: addHeader(name,value) + get.addHeader("Accept", "application/json"); + post.addHeader("Content-Type", "application/json"); +``` diff --git a/resources/build.properties b/resources/build.properties index f49f0a6..44ff2fa 100644 --- a/resources/build.properties +++ b/resources/build.properties @@ -38,7 +38,7 @@ sketchbook.location=${user.home}/Dropbox/Processing # Uncommenting the line below will overwrite the classpath.local.location from # above. -classpath.local.location=/Applications/Processing-3.0.1.app/Contents/Java/core/library +classpath.local.location=/Applications/Processing-3.0.1.app/Contents/Java/core/library # Add all jar files that are required for compiling your project to the local @@ -162,10 +162,10 @@ library.dependencies=? library.keywords=? tested.platform=osx,windows -tested.processingVersion=3.0b7 +tested.processingVersion=3.0.1 # Include javadoc references into your project's javadocs. -javadoc.java.href=http://java.sun.com/javase/6/docs/api/ +javadoc.java.href=http://java.sun.com/javase/7/docs/api/ javadoc.processing.href=http://processing.org/reference/javadoc/core/ diff --git a/resources/build.xml b/resources/build.xml index d9b4f67..14b2fcc 100644 --- a/resources/build.xml +++ b/resources/build.xml @@ -1,4 +1,4 @@ - + - + + + + - + @@ -289,7 +292,7 @@ ${line} - + @@ -297,7 +300,7 @@ ${line} - +