├── .gitignore ├── core.jar ├── lib ├── httpclient-4.1.2.jar ├── httpcore-4.1.2.jar ├── httpmime-4.1.2.jar ├── commons-codec-1.4.jar ├── commons-logging-1.1.1.jar └── httpclient-cache-4.1.2.jar ├── resources ├── code │ ├── ExampleTaglet.class │ ├── ant-contrib-1.0b3.jar │ ├── doc.sh │ └── ExampleTaglet.java ├── README.md ├── install_instructions.txt ├── library.properties ├── stylesheet.css ├── build.properties └── build.xml ├── examples ├── get │ └── get.pde ├── put │ └── put.pde ├── post │ └── post.pde ├── delete │ └── delete.pde ├── jsonget │ └── jsonget.pde ├── jsonpost │ └── jsonpost.pde └── jsonput │ └── jsonput.pde ├── .project ├── .classpath ├── LICENSE ├── README.md ├── src └── http │ └── requests │ ├── GetRequest.java │ ├── DeleteRequest.java │ ├── PostRequest.java │ └── PutRequest.java └── web ├── stylesheet.css └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | distribution 2 | .DS_Store 3 | *.class 4 | /bin/ 5 | -------------------------------------------------------------------------------- /core.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runemadsen/HTTP-Requests-for-Processing/HEAD/core.jar -------------------------------------------------------------------------------- /lib/httpclient-4.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runemadsen/HTTP-Requests-for-Processing/HEAD/lib/httpclient-4.1.2.jar -------------------------------------------------------------------------------- /lib/httpcore-4.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runemadsen/HTTP-Requests-for-Processing/HEAD/lib/httpcore-4.1.2.jar -------------------------------------------------------------------------------- /lib/httpmime-4.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runemadsen/HTTP-Requests-for-Processing/HEAD/lib/httpmime-4.1.2.jar -------------------------------------------------------------------------------- /lib/commons-codec-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runemadsen/HTTP-Requests-for-Processing/HEAD/lib/commons-codec-1.4.jar -------------------------------------------------------------------------------- /lib/commons-logging-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runemadsen/HTTP-Requests-for-Processing/HEAD/lib/commons-logging-1.1.1.jar -------------------------------------------------------------------------------- /lib/httpclient-cache-4.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runemadsen/HTTP-Requests-for-Processing/HEAD/lib/httpclient-cache-4.1.2.jar -------------------------------------------------------------------------------- /resources/code/ExampleTaglet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runemadsen/HTTP-Requests-for-Processing/HEAD/resources/code/ExampleTaglet.class -------------------------------------------------------------------------------- /resources/code/ant-contrib-1.0b3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runemadsen/HTTP-Requests-for-Processing/HEAD/resources/code/ant-contrib-1.0b3.jar -------------------------------------------------------------------------------- /examples/get/get.pde: -------------------------------------------------------------------------------- 1 | import http.requests.*; 2 | 3 | public void setup() 4 | { 5 | size(400,400); 6 | smooth(); 7 | 8 | GetRequest get = new GetRequest("http://dummy.restapiexample.com/api/v1/employees/1"); 9 | get.send(); 10 | println("Reponse Content: " + get.getContent()); 11 | println("Reponse Content-Length Header: " + get.getHeader("Content-Length")); 12 | } 13 | -------------------------------------------------------------------------------- /examples/put/put.pde: -------------------------------------------------------------------------------- 1 | // PUT test 2 | 3 | import http.requests.*; 4 | 5 | public void setup() 6 | { 7 | size(400,400); 8 | smooth(); 9 | 10 | PutRequest put = new PutRequest("http://httprocessing.heroku.com"); 11 | put.addData("name", "Rune"); 12 | put.send(); 13 | System.out.println("Reponse Content: " + put.getContent()); 14 | System.out.println("Reponse Content-Length Header: " + put.getHeader("Content-Length")); 15 | } 16 | -------------------------------------------------------------------------------- /examples/post/post.pde: -------------------------------------------------------------------------------- 1 | import http.requests.*; 2 | 3 | public void setup() 4 | { 5 | size(400,400); 6 | smooth(); 7 | 8 | PostRequest post = new PostRequest("http://httprocessing.heroku.com"); 9 | post.addData("name", "Rune"); 10 | post.send(); 11 | System.out.println("Reponse Content: " + post.getContent()); 12 | System.out.println("Reponse Content-Length Header: " + post.getHeader("Content-Length")); 13 | } 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | HTTPRequests-for-Processing 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/delete/delete.pde: -------------------------------------------------------------------------------- 1 | import http.requests.*; 2 | 3 | public void setup() 4 | { 5 | size(400, 400); 6 | smooth(); 7 | 8 | DeleteRequest delete = new DeleteRequest("http://dummy.restapiexample.com/api/v1/delete/971"); 9 | delete.addHeader("Content-Type", "application/json"); 10 | delete.send(); 11 | System.out.println("Reponse Content: " + delete.getContent()); 12 | System.out.println("Reponse Content-Length Header: " + delete.getHeader("Content-Length")); 13 | } 14 | -------------------------------------------------------------------------------- /examples/jsonget/jsonget.pde: -------------------------------------------------------------------------------- 1 | import http.requests.*; 2 | 3 | public void setup() { 4 | size(400, 400); 5 | 6 | GetRequest get = new GetRequest("http://dummy.restapiexample.com/api/v1/employee/1"); 7 | get.send(); // d program will wait untill the request is completed 8 | println("response: " + get.getContent()); 9 | JSONObject response = parseJSONObject(get.getContent()); 10 | println("status: " + response.getString("status")); 11 | println("data: " + response.getJSONObject("data")); 12 | } 13 | -------------------------------------------------------------------------------- /examples/jsonpost/jsonpost.pde: -------------------------------------------------------------------------------- 1 | import http.requests.*; 2 | 3 | public void setup() { 4 | size(400, 400); 5 | PostRequest post = new PostRequest("http://dummy.restapiexample.com/api/v1/create"); 6 | post.addHeader("Content-Type", "application/json"); 7 | post.addData("{\"name\":\"Daniel Shiffman\",\"salary\":\"123\",\"age\":\"23\"}"); 8 | post.send(); 9 | System.out.println("Reponse Content: " + post.getContent()); 10 | System.out.println("Reponse Content-Length Header: " + post.getHeader("Content-Length")); 11 | } 12 | -------------------------------------------------------------------------------- /resources/code/doc.sh: -------------------------------------------------------------------------------- 1 | # a shell script to create a java documentation 2 | # for a processing library. 3 | # 4 | # make changes to the variables below so they 5 | # fit the structure of your library 6 | 7 | # the package name of your library 8 | package=template; 9 | 10 | # source folder location 11 | src=../src; 12 | 13 | # the destination folder of your documentation 14 | dest=../documentation; 15 | 16 | 17 | # compile the java documentation 18 | javadoc -d $dest -stylesheetfile ./stylesheet.css -sourcepath ${src} ${package} 19 | -------------------------------------------------------------------------------- /examples/jsonput/jsonput.pde: -------------------------------------------------------------------------------- 1 | import http.requests.*; 2 | 3 | public void setup() 4 | { 5 | size(400, 400); 6 | smooth(); 7 | 8 | PutRequest put = new PutRequest("http://dummy.restapiexample.com/api/v1/update/43"); 9 | put.addHeader("Content-Type", "application/json"); 10 | put.addData("{\"name\":\"Daniel Shiffman\",\"salary\":\"1123\",\"age\":\"23\"}"); 11 | put.send(); 12 | System.out.println("Reponse Content: " + put.getContent()); 13 | System.out.println("Reponse Content-Length Header: " + put.getHeader("Content-Length")); 14 | } 15 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Rune Skjoldborg Madsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | HTTP Requests for Processing is a small library that takes the pain out of doing HTTP requests in Processing. 5 | 6 | HTTP Requests for Processing is based on code by [Chris Allick](http://chrisallick.com/) and [Daniel Shiffman](http://www.shiffman.net/). 7 | 8 | 9 | How to 10 | ------------ 11 | 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). 12 | 13 | Then import the library in your sketch: 14 | ```Java 15 | import http.requests.*; 16 | ``` 17 | Then you can make GET and POST requests from your code: 18 | ```Java 19 | GetRequest get = new GetRequest("http://httprocessing.heroku.com"); 20 | get.send(); 21 | println("Reponse Content: " + get.getContent()); 22 | println("Reponse Content-Length Header: " + get.getHeader("Content-Length")); 23 | 24 | PostRequest post = new PostRequest("http://httprocessing.heroku.com"); 25 | post.addData("name", "Rune"); 26 | post.send(); 27 | println("Reponse Content: " + post.getContent()); 28 | println("Reponse Content-Length Header: " + post.getHeader("Content-Length")); 29 | ``` 30 | To authenticate requests using a Basic Access authentication scheme, include the following in your requests: 31 | ```Java 32 | get.addUser("username", "password"); 33 | post.addUser("username", "password"); 34 | ``` 35 | To add a header to your request, including the following: 36 | ```Java 37 | //method: addHeader(name,value) 38 | get.addHeader("Accept", "application/json"); 39 | post.addHeader("Content-Type", "application/json"); 40 | ``` 41 | -------------------------------------------------------------------------------- /resources/README.md: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | HTTP Requests for Processing is a small library that takes the pain out of doing HTTP requests in Processing. 5 | 6 | HTTP Requests for Processing is based on code by [Chris Allick](http://chrisallick.com/) and [Daniel Shiffman](http://www.shiffman.net/). 7 | 8 | 9 | How to 10 | ------------ 11 | 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). 12 | 13 | Then import the library in your sketch: 14 | ```Java 15 | import http.requests.*; 16 | ``` 17 | Then you can make GET and POST requests from your code: 18 | ```Java 19 | GetRequest get = new GetRequest("http://httprocessing.heroku.com"); 20 | get.send(); 21 | println("Reponse Content: " + get.getContent()); 22 | println("Reponse Content-Length Header: " + get.getHeader("Content-Length")); 23 | 24 | PostRequest post = new PostRequest("http://httprocessing.heroku.com"); 25 | post.addData("name", "Rune"); 26 | post.send(); 27 | println("Reponse Content: " + post.getContent()); 28 | println("Reponse Content-Length Header: " + post.getHeader("Content-Length")); 29 | ``` 30 | To authenticate requests using a Basic Access authentication scheme, include the following in your requests: 31 | ```Java 32 | get.addUser("username", "password"); 33 | post.addUser("username", "password"); 34 | ``` 35 | To add a header to your request, including the following: 36 | ```Java 37 | //method: addHeader(name,value) 38 | get.addHeader("Accept", "application/json"); 39 | post.addHeader("Content-Type", "application/json"); 40 | ``` 41 | -------------------------------------------------------------------------------- /resources/install_instructions.txt: -------------------------------------------------------------------------------- 1 | How to install library ##library.name## 2 | 3 | 4 | Install with the "Add Library..." tool 5 | 6 | New for Processing 2.0: Add contributed libraries by selecting "Add Library..." 7 | from the "Import Library..." submenu within the Sketch menu. Not all available 8 | libraries have been converted to show up in this menu. If a library isn't there, 9 | it will need to be installed manually by following the instructions below. 10 | 11 | 12 | Manual Install 13 | 14 | Contributed libraries may be downloaded separately and manually placed within 15 | the "libraries" folder of your Processing sketchbook. To find (and change) the 16 | Processing sketchbook location on your computer, open the Preferences window 17 | from the Processing application (PDE) and look for the "Sketchbook location" 18 | item at the top. 19 | 20 | Copy the contributed library's folder into the "libraries" folder at this 21 | location. You will need to create the "libraries" folder if this is your first 22 | contributed library. 23 | 24 | By default the following locations are used for your sketchbook folder: 25 | For Mac users, the sketchbook folder is located inside ~/Documents/Processing. 26 | For Windows users, the sketchbook folder is located inside 27 | 'My Documents'/Processing. 28 | 29 | The folder structure for library ##library.name## should be as follows: 30 | 31 | Processing 32 | libraries 33 | ##library.name## 34 | examples 35 | library 36 | ##library.name##.jar 37 | reference 38 | src 39 | 40 | Some folders like "examples" or "src" might be missing. After library 41 | ##library.name## has been successfully installed, restart the Processing 42 | application. 43 | 44 | 45 | If you're having trouble, have a look at the Processing Wiki for more 46 | information: http://wiki.processing.org/w/How_to_Install_a_Contributed_Library 47 | -------------------------------------------------------------------------------- /src/http/requests/GetRequest.java: -------------------------------------------------------------------------------- 1 | package http.requests; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | 6 | import org.apache.http.Header; 7 | import org.apache.http.HttpEntity; 8 | import org.apache.http.HttpResponse; 9 | import org.apache.http.NameValuePair; 10 | import org.apache.http.auth.UsernamePasswordCredentials; 11 | import org.apache.http.client.methods.HttpGet; 12 | import org.apache.http.impl.auth.BasicScheme; 13 | import org.apache.http.impl.client.DefaultHttpClient; 14 | import org.apache.http.message.BasicNameValuePair; 15 | import org.apache.http.util.EntityUtils; 16 | 17 | public class GetRequest 18 | { 19 | String url; 20 | String content; 21 | HttpResponse response; 22 | UsernamePasswordCredentials creds; 23 | ArrayList headerPairs; 24 | 25 | 26 | public GetRequest(String url) 27 | { 28 | this.url = url; 29 | headerPairs = new ArrayList(); 30 | 31 | } 32 | 33 | public void addUser(String user, String pwd) 34 | { 35 | creds = new UsernamePasswordCredentials(user, pwd); 36 | 37 | } 38 | 39 | public void addHeader(String key,String value) { 40 | BasicNameValuePair nvp = new BasicNameValuePair(key,value); 41 | headerPairs.add(nvp); 42 | 43 | } 44 | 45 | public void send() 46 | { 47 | try { 48 | DefaultHttpClient httpClient = new DefaultHttpClient(); 49 | 50 | HttpGet httpGet = new HttpGet(url); 51 | 52 | if(creds != null){ 53 | httpGet.addHeader(new BasicScheme().authenticate(creds, httpGet, null)); 54 | } 55 | 56 | Iterator headerIterator = headerPairs.iterator(); 57 | while (headerIterator.hasNext()) { 58 | BasicNameValuePair headerPair = headerIterator.next(); 59 | httpGet.addHeader(headerPair.getName(),headerPair.getValue()); 60 | } 61 | 62 | 63 | response = httpClient.execute( httpGet ); 64 | HttpEntity entity = response.getEntity(); 65 | this.content = EntityUtils.toString(response.getEntity()); 66 | 67 | if( entity != null ) EntityUtils.consume(entity); 68 | httpClient.getConnectionManager().shutdown(); 69 | 70 | } catch( Exception e ) { 71 | e.printStackTrace(); 72 | } 73 | } 74 | 75 | /* Getters 76 | _____________________________________________________________ */ 77 | 78 | public String getContent() 79 | { 80 | return this.content; 81 | } 82 | 83 | public String getHeader(String name) 84 | { 85 | Header header = response.getFirstHeader(name); 86 | if(header == null) 87 | { 88 | return ""; 89 | } 90 | else 91 | { 92 | return header.getValue(); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /web/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* processingLibs style by andreas schlegel, sojamo. */ 2 | 3 | 4 | * { 5 | margin:0; 6 | padding:0; 7 | border:0; 8 | } 9 | 10 | 11 | body { 12 | font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; 13 | font-size : 100%; 14 | font-size : 0.70em; 15 | font-weight : normal; 16 | line-height : normal; 17 | } 18 | 19 | 20 | 21 | #container { 22 | margin-left:64px; 23 | background-color:#fff; 24 | } 25 | 26 | #header { 27 | float:left; 28 | padding-top:24px; 29 | padding-bottom:48px; 30 | } 31 | 32 | #menu { 33 | margin-top:16px; 34 | float:left; 35 | margin-bottom:64px; 36 | } 37 | 38 | 39 | #about, 40 | #download, 41 | #examples, 42 | #demos, 43 | #misc { 44 | width:480px; 45 | float:left; 46 | margin-right:24px; 47 | } 48 | 49 | 50 | #resources, #info { 51 | width:320px; 52 | float:left; 53 | } 54 | 55 | 56 | .clear { 57 | clear:both; 58 | } 59 | 60 | #footer { 61 | margin-top:300px; 62 | height:20px; 63 | margin-bottom:32px; 64 | } 65 | 66 | 67 | ul { 68 | list-style:none; 69 | padding:0; 70 | margin:0; 71 | } 72 | 73 | 74 | #menu ul li, #subMenu ul li { 75 | float:left; 76 | padding-right:6px; 77 | } 78 | 79 | 80 | 81 | 82 | 83 | 84 | /* Headings */ 85 | 86 | h1 { 87 | font-size:2em; 88 | font-weight:normal; 89 | } 90 | 91 | 92 | h2, h3, h4, h5, th { 93 | font-size:1.3em; 94 | font-weight:normal; 95 | margin-bottom:4px; 96 | } 97 | 98 | 99 | 100 | p { 101 | font-size:1em; 102 | width:90%; 103 | margin-bottom:32px; 104 | } 105 | 106 | 107 | pre, code { 108 | font-family:"Courier New", Courier, monospace; 109 | font-size:1em; 110 | line-height:normal; 111 | } 112 | 113 | 114 | 115 | 116 | hr { 117 | border:0; 118 | height:1px; 119 | margin-bottom:24px; 120 | } 121 | 122 | 123 | a { 124 | text-decoration: underline; 125 | font-weight: normal; 126 | } 127 | 128 | 129 | a:hover, 130 | a:active { 131 | text-decoration: underline; 132 | font-weight: normal; 133 | } 134 | 135 | 136 | a:visited, 137 | a:link:visited { 138 | text-decoration: underline; 139 | font-weight: normal; 140 | } 141 | 142 | 143 | 144 | img { 145 | border: 0px solid #000000; 146 | } 147 | 148 | 149 | 150 | 151 | 152 | /* COLORS */ 153 | 154 | 155 | body { 156 | color : #333; 157 | background-color :#fff; 158 | } 159 | 160 | 161 | #header { 162 | background-color:#fff; 163 | color:#333; 164 | } 165 | 166 | 167 | 168 | h1, h2, h3, h4, h5, h6 { 169 | color:#666; 170 | } 171 | 172 | 173 | pre, code { 174 | color: #000000; 175 | } 176 | 177 | 178 | a,strong { 179 | color: #333; 180 | } 181 | 182 | 183 | a:hover, 184 | a:active { 185 | color: #333; 186 | } 187 | 188 | 189 | a:visited, 190 | a:link:visited { 191 | color: #333; 192 | } 193 | 194 | 195 | #footer, #menu { 196 | background-color:#fff; 197 | color:#333; 198 | } 199 | 200 | 201 | #footer a, #menu a { 202 | color:#333; 203 | } 204 | -------------------------------------------------------------------------------- /resources/library.properties: -------------------------------------------------------------------------------- 1 | # More on this file here: https://github.com/processing/processing/wiki/Library-Basics 2 | # UTF-8 supported. 3 | 4 | # The name of your library as you want it formatted. 5 | name = HTTP Requests for Processing 6 | 7 | # List of authors. Links can be provided using the syntax [author name](url). 8 | authors = [Rune Madsen](http://www.runemadsen.com), [Daniel Shiffman](http://shiffman.net) 9 | 10 | # A web page for your library, NOT a direct link to where to download it. 11 | url = https://github.com/runemadsen/HTTP-Requests-for-Processing 12 | 13 | # The category of your library, must be one (or many) of the following: 14 | # "3D" "Animation" "Compilations" "Data" 15 | # "Fabrication" "Geometry" "GUI" "Hardware" 16 | # "I/O" "Language" "Math" "Simulation" 17 | # "Sound" "Utilities" "Typography" "Video & Vision" 18 | # 19 | # If a value other than those listed is used, your library will listed as 20 | # "Other". 21 | category = Data 22 | 23 | # A short sentence (or fragment) to summarize the library's function. This will 24 | # be shown from inside the PDE when the library is being installed. Avoid 25 | # repeating the name of your library here. Also, avoid saying anything redundant 26 | # like mentioning that it's a library. This should start with a capitalized 27 | # letter, and end with a period. 28 | sentence = HTTP Requests for Processing is a small library that takes the pain out of doing HTTP requests in Processing. 29 | 30 | # Additional information suitable for the Processing website. The value of 31 | # 'sentence' always will be prepended, so you should start by writing the 32 | # second sentence here. If your library only works on certain operating systems, 33 | # mention it here. 34 | paragraph = 35 | 36 | # Links in the 'sentence' and 'paragraph' attributes can be inserted using the 37 | # same syntax as for authors. 38 | # That is, [here is a link to Processing](http://processing.org/) 39 | 40 | 41 | # A version number that increments once with each release. This is used to 42 | # compare different versions of the same library, and check if an update is 43 | # available. You should think of it as a counter, counting the total number of 44 | # releases you've had. 45 | version = 4 # This must be parsable as an int 46 | 47 | # The version as the user will see it. If blank, the version attribute will be 48 | # used here. 49 | prettyVersion = 0.1.4 # This is treated as a String 50 | 51 | # The min and max revision of Processing compatible with your library. 52 | # Note that these fields use the revision and not the version of Processing, 53 | # parsable as an int. For example, the revision number for 2.2.1 is 227. 54 | # You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt 55 | # Only use maxRevision (or minRevision), when your library is known to 56 | # break in a later (or earlier) release. Otherwise, use the default value 0. 57 | minRevision = 218 58 | maxRevision = 0 59 | -------------------------------------------------------------------------------- /src/http/requests/DeleteRequest.java: -------------------------------------------------------------------------------- 1 | package http.requests; 2 | 3 | 4 | // this part will get folded into the HTTP library if all goes well: 5 | import java.io.File; 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.Iterator; 9 | import java.util.Map.Entry; 10 | 11 | import org.apache.http.Header; 12 | import org.apache.http.HttpEntity; 13 | import org.apache.http.HttpResponse; 14 | import org.apache.http.NameValuePair; 15 | import org.apache.http.auth.UsernamePasswordCredentials; 16 | import org.apache.http.client.entity.UrlEncodedFormEntity; 17 | import org.apache.http.client.methods.*; 18 | import org.apache.http.entity.mime.MultipartEntity; 19 | import org.apache.http.entity.mime.content.FileBody; 20 | import org.apache.http.entity.mime.content.StringBody; 21 | import org.apache.http.impl.auth.BasicScheme; 22 | import org.apache.http.impl.client.DefaultHttpClient; 23 | import org.apache.http.message.BasicNameValuePair; 24 | import org.apache.http.util.EntityUtils; 25 | 26 | public class DeleteRequest 27 | { 28 | String url; 29 | ArrayList nameValuePairs; 30 | HashMap nameFilePairs; 31 | ArrayList headerPairs; 32 | 33 | String content; 34 | String encoding; 35 | HttpResponse response; 36 | UsernamePasswordCredentials creds; 37 | 38 | public DeleteRequest(String url) 39 | { 40 | this(url, "ISO-8859-1"); 41 | } 42 | 43 | public DeleteRequest(String url, String encoding) 44 | { 45 | this.url = url; 46 | this.encoding = encoding; 47 | nameValuePairs = new ArrayList(); 48 | nameFilePairs = new HashMap(); 49 | this.headerPairs = new ArrayList(); 50 | } 51 | 52 | public void addUser(String user, String pwd) 53 | { 54 | creds = new UsernamePasswordCredentials(user, pwd); 55 | } 56 | 57 | public void addHeader(String key, String value) { 58 | BasicNameValuePair nvp = new BasicNameValuePair(key, value); 59 | headerPairs.add(nvp); 60 | } 61 | 62 | public void addData(String key, String value) 63 | { 64 | BasicNameValuePair nvp = new BasicNameValuePair(key, value); 65 | nameValuePairs.add(nvp); 66 | } 67 | 68 | public void addFile(String name, File f) { 69 | nameFilePairs.put(name, f); 70 | } 71 | 72 | public void addFile(String name, String path) { 73 | File f = new File(path); 74 | nameFilePairs.put(name, f); 75 | } 76 | 77 | public void send() 78 | { 79 | try { 80 | DefaultHttpClient httpClient = new DefaultHttpClient(); 81 | HttpDelete httpDelete = new HttpDelete(url); 82 | 83 | if (creds != null) { 84 | httpDelete.addHeader(new BasicScheme().authenticate(creds, httpDelete, null)); 85 | } 86 | 87 | if (nameFilePairs.isEmpty()) { 88 | //httpDelete.setEntity(new UrlEncodedFormEntity(nameValuePairs, encoding)); 89 | } else { 90 | MultipartEntity mentity = new MultipartEntity(); 91 | Iterator> it = nameFilePairs.entrySet().iterator(); 92 | while (it.hasNext()) { 93 | Entry pair = it.next(); 94 | String name = (String) pair.getKey(); 95 | File f = (File) pair.getValue(); 96 | mentity.addPart(name, new FileBody(f)); 97 | } 98 | for (NameValuePair nvp : nameValuePairs) { 99 | mentity.addPart(nvp.getName(), new StringBody(nvp.getValue())); 100 | } 101 | } 102 | 103 | Iterator headerIterator = headerPairs.iterator(); 104 | while (headerIterator.hasNext()) { 105 | BasicNameValuePair headerPair = headerIterator.next(); 106 | httpDelete.addHeader(headerPair.getName(), headerPair.getValue()); 107 | } 108 | 109 | response = httpClient.execute( httpDelete ); 110 | HttpEntity entity = response.getEntity(); 111 | this.content = EntityUtils.toString(response.getEntity()); 112 | 113 | if ( entity != null ) EntityUtils.consume(entity); 114 | 115 | httpClient.getConnectionManager().shutdown(); 116 | 117 | // Clear it out for the next time 118 | nameValuePairs.clear(); 119 | nameFilePairs.clear(); 120 | headerPairs.clear(); 121 | } 122 | catch( Exception e ) { 123 | e.printStackTrace(); 124 | } 125 | } 126 | /* Getters 127 | _____________________________________________________________ */ 128 | 129 | public String getContent() 130 | { 131 | return this.content; 132 | } 133 | 134 | public String getHeader(String name) 135 | { 136 | Header header = response.getFirstHeader(name); 137 | if (header == null) 138 | { 139 | return ""; 140 | } else 141 | { 142 | return header.getValue(); 143 | } 144 | } 145 | } -------------------------------------------------------------------------------- /resources/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* Javadoc style sheet */ 2 | /* Define colors, fonts and other style attributes here to override the defaults */ 3 | /* processingLibs style by andreas schlegel, sojamo */ 4 | 5 | 6 | body { 7 | margin : 0; 8 | padding : 0; 9 | padding-left : 10px; 10 | padding-right : 8px; 11 | background-color : #FFFFFF; 12 | font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; 13 | font-size : 100%; 14 | font-size : 0.7em; 15 | font-weight : normal; 16 | line-height : normal; 17 | margin-bottom:30px; 18 | } 19 | 20 | 21 | 22 | 23 | /* Headings */ 24 | h1, h2, h3, h4, h5, th { 25 | font-family :Arial, Helvetica, sans-serif; 26 | font-size:1.2em; 27 | } 28 | 29 | 30 | p { 31 | font-size : 1em; 32 | width:80%; 33 | } 34 | 35 | pre, code { 36 | font-family : "Courier New", Courier, monospace; 37 | font-size : 12px; 38 | line-height : normal; 39 | } 40 | 41 | 42 | 43 | table { 44 | border:0; 45 | margin-bottom:10px; 46 | margin-top:10px; 47 | } 48 | 49 | 50 | tr, td { 51 | border-top: 0px solid; 52 | border-left: 0px solid; 53 | padding-top:8px; 54 | padding-bottom:8px; 55 | } 56 | 57 | 58 | 59 | hr { 60 | border:0; 61 | height:1px; 62 | padding:0; 63 | margin:0; 64 | margin-bottom:4px; 65 | 66 | } 67 | 68 | 69 | 70 | dd, th, td, font { 71 | font-size:1.0em; 72 | line-height:1.0em; 73 | } 74 | 75 | 76 | 77 | dt { 78 | margin-bottom:0px; 79 | } 80 | 81 | 82 | 83 | dd { 84 | margin-top:2px; 85 | margin-bottom:4px; 86 | } 87 | 88 | 89 | 90 | a { 91 | text-decoration: underline; 92 | font-weight: normal; 93 | } 94 | 95 | a:hover, 96 | a:active { 97 | text-decoration: underline; 98 | font-weight: normal; 99 | } 100 | 101 | a:visited, 102 | a:link:visited { 103 | text-decoration: underline; 104 | font-weight: normal; 105 | } 106 | 107 | 108 | img { 109 | border: 0px solid #000000; 110 | } 111 | 112 | 113 | 114 | /* Navigation bar fonts */ 115 | .NavBarCell1 { 116 | border:0; 117 | } 118 | 119 | .NavBarCell1Rev { 120 | border:0; 121 | } 122 | 123 | .NavBarFont1 { 124 | font-family: Arial, Helvetica, sans-serif; 125 | font-size:1.1em; 126 | } 127 | 128 | 129 | .NavBarFont1 b { 130 | font-weight:normal; 131 | } 132 | 133 | 134 | 135 | .NavBarFont1:after, .NavBarFont1Rev:after { 136 | font-weight:normal; 137 | content: " \\"; 138 | } 139 | 140 | 141 | .NavBarFont1Rev { 142 | font-family: Arial, Helvetica, sans-serif; 143 | font-size:1.1em; 144 | } 145 | 146 | .NavBarFont1Rev b { 147 | font-family: Arial, Helvetica, sans-serif; 148 | font-size:1.1em; 149 | font-weight:normal; 150 | } 151 | 152 | .NavBarCell2 { 153 | font-family: Arial, Helvetica, sans-serif; 154 | } 155 | 156 | .NavBarCell3 { 157 | font-family: Arial, Helvetica, sans-serif; 158 | } 159 | 160 | 161 | 162 | font.FrameItemFont { 163 | font-family: Helvetica, Arial, sans-serif; 164 | font-size:1.1em; 165 | line-height:1.1em; 166 | } 167 | 168 | font.FrameHeadingFont { 169 | font-family: Helvetica, Arial, sans-serif; 170 | line-height:32px; 171 | } 172 | 173 | /* Font used in left-hand frame lists */ 174 | .FrameTitleFont { 175 | font-family: Helvetica, Arial, sans-serif 176 | } 177 | 178 | 179 | .toggleList { 180 | padding:0; 181 | margin:0; 182 | margin-top:12px; 183 | } 184 | 185 | .toggleList dt { 186 | font-weight:bold; 187 | font-size:12px; 188 | font-family:arial,sans-serif; 189 | padding:0px; 190 | margin:10px 0px 10px 0px; 191 | } 192 | 193 | .toggleList dt span { 194 | font-family: monospace; 195 | padding:0; 196 | margin:0; 197 | } 198 | 199 | 200 | .toggleList dd { 201 | margin:0; 202 | padding:0; 203 | } 204 | 205 | html.isjs .toggleList dd { 206 | display: none; 207 | } 208 | 209 | .toggleList pre { 210 | padding: 4px 4px 4px 4px; 211 | } 212 | 213 | 214 | 215 | 216 | 217 | /* COLORS */ 218 | 219 | pre, code { 220 | color: #000000; 221 | } 222 | 223 | 224 | body { 225 | color : #333333; 226 | background-color :#FFFFFF; 227 | } 228 | 229 | 230 | h1, h2, h3, h4, h5, h6 { 231 | color:#555; 232 | } 233 | 234 | a, 235 | .toggleList dt { 236 | color: #1a7eb0; 237 | } 238 | 239 | a:hover, 240 | a:active { 241 | color: #1a7eb0; 242 | } 243 | 244 | a:visited, 245 | a:link:visited { 246 | color: #1a7eb0; 247 | } 248 | 249 | td,tr { 250 | border-color: #999999; 251 | } 252 | 253 | hr { 254 | color:#999999; 255 | background:#999999; 256 | } 257 | 258 | 259 | .TableHeadingColor { 260 | background: #dcdcdc; 261 | color: #555; 262 | } 263 | 264 | 265 | .TableSubHeadingColor { 266 | background: #EEEEFF 267 | } 268 | 269 | .TableRowColor { 270 | background: #FFFFFF 271 | } 272 | 273 | 274 | .NavBarCell1 { 275 | background-color:#dcdcdc; 276 | color:#000; 277 | } 278 | 279 | .NavBarCell1 a { 280 | color:#333; 281 | } 282 | 283 | 284 | .NavBarCell1Rev { 285 | background-color:transparent; 286 | } 287 | 288 | .NavBarFont1 { 289 | color:#333; 290 | } 291 | 292 | 293 | .NavBarFont1Rev { 294 | color:#fff; 295 | } 296 | 297 | .NavBarCell2 { 298 | background-color:#999; 299 | } 300 | 301 | .NavBarCell2 a { 302 | color:#fff; 303 | } 304 | 305 | 306 | 307 | .NavBarCell3 { 308 | background-color:#dcdcdc; 309 | } 310 | 311 | -------------------------------------------------------------------------------- /src/http/requests/PostRequest.java: -------------------------------------------------------------------------------- 1 | package http.requests; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | import java.util.HashMap; 6 | import java.util.Iterator; 7 | import java.util.Map.Entry; 8 | 9 | import org.apache.http.Header; 10 | import org.apache.http.HttpEntity; 11 | import org.apache.http.HttpResponse; 12 | import org.apache.http.NameValuePair; 13 | import org.apache.http.auth.UsernamePasswordCredentials; 14 | import org.apache.http.client.entity.UrlEncodedFormEntity; 15 | import org.apache.http.client.methods.HttpPost; 16 | import org.apache.http.entity.mime.MultipartEntity; 17 | import org.apache.http.entity.mime.content.FileBody; 18 | import org.apache.http.entity.mime.content.StringBody; 19 | import org.apache.http.entity.StringEntity; 20 | import org.apache.http.impl.auth.BasicScheme; 21 | import org.apache.http.impl.client.DefaultHttpClient; 22 | import org.apache.http.message.BasicNameValuePair; 23 | import org.apache.http.util.EntityUtils; 24 | 25 | public class PostRequest 26 | { 27 | String url; 28 | ArrayList nameValuePairs; 29 | StringEntity stringEntity; 30 | HashMap nameFilePairs; 31 | ArrayList headerPairs; 32 | 33 | 34 | String content; 35 | String encoding; 36 | HttpResponse response; 37 | UsernamePasswordCredentials creds; 38 | 39 | public PostRequest(String url) 40 | { 41 | this(url, "ISO-8859-1"); 42 | } 43 | 44 | public PostRequest(String url, String encoding) 45 | { 46 | this.url = url; 47 | this.encoding = encoding; 48 | nameValuePairs = new ArrayList(); 49 | nameFilePairs = new HashMap(); 50 | this.headerPairs = new ArrayList(); 51 | } 52 | 53 | public void addUser(String user, String pwd) 54 | { 55 | creds = new UsernamePasswordCredentials(user, pwd); 56 | } 57 | 58 | public void addHeader(String key, String value) { 59 | BasicNameValuePair nvp = new BasicNameValuePair(key, value); 60 | headerPairs.add(nvp); 61 | } 62 | 63 | public void addData(String key, String value) 64 | { 65 | BasicNameValuePair nvp = new BasicNameValuePair(key, value); 66 | nameValuePairs.add(nvp); 67 | } 68 | 69 | // overloads addData so you can add a JSON string: 70 | public void addData(String json) 71 | { 72 | try { 73 | stringEntity = new StringEntity(json); 74 | } 75 | catch( Exception e ) { 76 | e.printStackTrace(); 77 | } 78 | } 79 | 80 | public void addFile(String name, File f) { 81 | nameFilePairs.put(name, f); 82 | } 83 | 84 | public void addFile(String name, String path) { 85 | File f = new File(path); 86 | nameFilePairs.put(name, f); 87 | } 88 | 89 | public void send() 90 | { 91 | try { 92 | DefaultHttpClient httpClient = new DefaultHttpClient(); 93 | HttpPost httpPost = new HttpPost(url); 94 | 95 | if (creds != null) { 96 | httpPost.addHeader(new BasicScheme().authenticate(creds, httpPost, null)); 97 | } 98 | 99 | if (nameFilePairs.isEmpty()) { 100 | httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, encoding)); 101 | } else { 102 | MultipartEntity mentity = new MultipartEntity(); 103 | Iterator> it = nameFilePairs.entrySet().iterator(); 104 | while (it.hasNext()) { 105 | Entry pair = it.next(); 106 | String name = (String) pair.getKey(); 107 | File f = (File) pair.getValue(); 108 | mentity.addPart(name, new FileBody(f)); 109 | } 110 | for (NameValuePair nvp : nameValuePairs) { 111 | mentity.addPart(nvp.getName(), new StringBody(nvp.getValue())); 112 | } 113 | httpPost.setEntity(mentity); 114 | } 115 | 116 | if (stringEntity != null) { 117 | httpPost.setEntity(stringEntity); 118 | } 119 | 120 | Iterator headerIterator = headerPairs.iterator(); 121 | while (headerIterator.hasNext()) { 122 | BasicNameValuePair headerPair = headerIterator.next(); 123 | httpPost.addHeader(headerPair.getName(), headerPair.getValue()); 124 | } 125 | 126 | response = httpClient.execute( httpPost ); 127 | HttpEntity entity = response.getEntity(); 128 | this.content = EntityUtils.toString(response.getEntity()); 129 | 130 | if ( entity != null ) EntityUtils.consume(entity); 131 | 132 | httpClient.getConnectionManager().shutdown(); 133 | 134 | // Clear it out for the next time 135 | nameValuePairs.clear(); 136 | nameFilePairs.clear(); 137 | headerPairs.clear(); 138 | } 139 | catch( Exception e ) { 140 | e.printStackTrace(); 141 | } 142 | } 143 | 144 | /* Getters 145 | _____________________________________________________________ */ 146 | 147 | public String getContent() 148 | { 149 | return this.content; 150 | } 151 | 152 | public String getHeader(String name) 153 | { 154 | Header header = response.getFirstHeader(name); 155 | if (header == null) 156 | { 157 | return ""; 158 | } else 159 | { 160 | return header.getValue(); 161 | } 162 | } 163 | } -------------------------------------------------------------------------------- /src/http/requests/PutRequest.java: -------------------------------------------------------------------------------- 1 | package http.requests; 2 | 3 | 4 | // this part will get folded into the HTTP library if all goes well: 5 | import java.io.File; 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.Iterator; 9 | import java.util.Map.Entry; 10 | 11 | import org.apache.http.Header; 12 | import org.apache.http.HttpEntity; 13 | import org.apache.http.HttpResponse; 14 | import org.apache.http.NameValuePair; 15 | import org.apache.http.auth.UsernamePasswordCredentials; 16 | import org.apache.http.client.entity.UrlEncodedFormEntity; 17 | import org.apache.http.client.methods.*; 18 | import org.apache.http.entity.mime.MultipartEntity; 19 | import org.apache.http.entity.mime.content.FileBody; 20 | import org.apache.http.entity.mime.content.StringBody; 21 | import org.apache.http.entity.StringEntity; 22 | import org.apache.http.impl.auth.BasicScheme; 23 | import org.apache.http.impl.client.DefaultHttpClient; 24 | import org.apache.http.message.BasicNameValuePair; 25 | import org.apache.http.util.EntityUtils; 26 | 27 | public class PutRequest 28 | { 29 | String url; 30 | ArrayList nameValuePairs; 31 | HashMap nameFilePairs; 32 | ArrayList headerPairs; 33 | StringEntity stringEntity; 34 | 35 | String content; 36 | String encoding; 37 | HttpResponse response; 38 | UsernamePasswordCredentials creds; 39 | 40 | public PutRequest(String url) 41 | { 42 | this(url, "ISO-8859-1"); 43 | } 44 | 45 | public PutRequest(String url, String encoding) 46 | { 47 | this.url = url; 48 | this.encoding = encoding; 49 | nameValuePairs = new ArrayList(); 50 | nameFilePairs = new HashMap(); 51 | this.headerPairs = new ArrayList(); 52 | } 53 | 54 | public void addUser(String user, String pwd) 55 | { 56 | creds = new UsernamePasswordCredentials(user, pwd); 57 | } 58 | 59 | public void addHeader(String key, String value) { 60 | BasicNameValuePair nvp = new BasicNameValuePair(key, value); 61 | headerPairs.add(nvp); 62 | } 63 | 64 | public void addData(String key, String value) 65 | { 66 | BasicNameValuePair nvp = new BasicNameValuePair(key, value); 67 | nameValuePairs.add(nvp); 68 | } 69 | 70 | // overloads addData so you can add a JSON string: 71 | public void addData(String json) 72 | { 73 | try{ 74 | stringEntity = new StringEntity(json); 75 | } catch( Exception e ) { 76 | e.printStackTrace(); 77 | } 78 | } 79 | 80 | public void addFile(String name, File f) { 81 | nameFilePairs.put(name, f); 82 | } 83 | 84 | public void addFile(String name, String path) { 85 | File f = new File(path); 86 | nameFilePairs.put(name, f); 87 | } 88 | 89 | public void send() 90 | { 91 | try { 92 | DefaultHttpClient httpClient = new DefaultHttpClient(); 93 | HttpPut httpPut = new HttpPut(url); 94 | 95 | if (creds != null) { 96 | httpPut.addHeader(new BasicScheme().authenticate(creds, httpPut, null)); 97 | } 98 | 99 | if (nameFilePairs.isEmpty()) { 100 | httpPut.setEntity(new UrlEncodedFormEntity(nameValuePairs, encoding)); 101 | } else { 102 | MultipartEntity mentity = new MultipartEntity(); 103 | Iterator> it = nameFilePairs.entrySet().iterator(); 104 | while (it.hasNext()) { 105 | Entry pair = it.next(); 106 | String name = (String) pair.getKey(); 107 | File f = (File) pair.getValue(); 108 | mentity.addPart(name, new FileBody(f)); 109 | } 110 | for (NameValuePair nvp : nameValuePairs) { 111 | mentity.addPart(nvp.getName(), new StringBody(nvp.getValue())); 112 | } 113 | httpPut.setEntity(mentity); 114 | } 115 | 116 | if (stringEntity != null) { 117 | httpPut.setEntity(stringEntity); 118 | } 119 | 120 | Iterator headerIterator = headerPairs.iterator(); 121 | while (headerIterator.hasNext()) { 122 | BasicNameValuePair headerPair = headerIterator.next(); 123 | httpPut.addHeader(headerPair.getName(), headerPair.getValue()); 124 | } 125 | 126 | response = httpClient.execute( httpPut ); 127 | HttpEntity entity = response.getEntity(); 128 | this.content = EntityUtils.toString(response.getEntity()); 129 | 130 | if ( entity != null ) EntityUtils.consume(entity); 131 | 132 | httpClient.getConnectionManager().shutdown(); 133 | 134 | // Clear it out for the next time 135 | nameValuePairs.clear(); 136 | nameFilePairs.clear(); 137 | headerPairs.clear(); 138 | } 139 | catch( Exception e ) { 140 | e.printStackTrace(); 141 | } 142 | } 143 | /* Getters 144 | _____________________________________________________________ */ 145 | 146 | public String getContent() 147 | { 148 | return this.content; 149 | } 150 | 151 | public String getHeader(String name) 152 | { 153 | Header header = response.getFirstHeader(name); 154 | if (header == null) 155 | { 156 | return ""; 157 | } else 158 | { 159 | return header.getValue(); 160 | } 161 | } 162 | } -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | ##library.name## 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 25 | 26 | 38 | 39 |
40 | 41 |
42 |

##library.name##

43 |

44 | A library by ##author.name## for the Processing programming environment.
45 | Last update, ##date##. 46 |

47 |

48 | ##library.sentence##
49 | ##library.paragraph##
50 | Feel free to replace this paragraph with a description of the library.
51 | Contributed libraries are developed, documented, and maintained by members of the Processing community. Further directions are included with each library. For feedback and support, please post to the Discourse. We strongly encourage all libraries to be open source, but not all of them are. 52 |

53 |
54 | 55 | 56 | 57 |
58 |

Download

59 |

60 | Download ##library.name## version ##library.prettyVersion## (##library.version##) in 61 | .zip format. 62 |

63 |

Installation

64 |

65 | Unzip and put the extracted ##project.name## folder into the libraries folder of your Processing sketches. Reference and examples are included in the ##project.name## folder. 66 |

67 |
68 | 69 | 70 |
71 |

Keywords. ##library.keywords##

72 |

Reference. Have a look at the javadoc reference here. A copy of the reference is included in the .zip as well.

73 |

Source. The source code of ##library.name## is available at ##source.host##, and its repository can be browsed here.

74 |
75 | 76 | 77 |
78 |

Examples

79 |

Find a list of examples in the current distribution of ##library.name##, or have a look at them by following the links below.

80 |
    81 | ##examples## 82 |
83 |
84 | 85 | 86 |
87 |

Tested

88 |

89 | 90 | Platform ##tested.platform## 91 | 92 | 93 |
Processing ##tested.processingVersion## 94 | 95 | 96 |
Dependencies ##library.dependencies## 97 |

98 |
99 | 100 | 101 | 102 | 114 | 115 | 116 | 121 | 122 | 123 | 127 | 128 | 129 |
130 |
131 | 132 | 135 |
136 | 137 | -------------------------------------------------------------------------------- /resources/build.properties: -------------------------------------------------------------------------------- 1 | # Create libraries for the Processing open source programming language and 2 | # environment (http://www.processing.org) 3 | # 4 | # Customize the build properties to make the ant-build-process work for your 5 | # environment. How? Please read the comments below. 6 | # 7 | # The default properties are set for OSX, for Windows-settings please refer to 8 | # comments made under (1) and (2). 9 | 10 | 11 | 12 | # (1) 13 | # Where is your Processing sketchbook located? 14 | # If you are not sure, check the sketchbook location in your Processing 15 | # application preferences. 16 | # ${user.home} points the compiler to your home directory. 17 | # For windows the default path to your sketchbook would be 18 | # ${user.home}/My Documents/Processing (make adjustments below). 19 | 20 | sketchbook.location=${user.home}/Documents/Processing 21 | 22 | 23 | 24 | # (2) 25 | # Where are the jar files located that are required for compiling your library 26 | # such as e.g. core.jar? 27 | # By default the local classpath location points to folder libs inside Eclipse's 28 | # workspace (by default found in your home directory). 29 | # For Windows the default path would be ${user.home}/workspace/libs (make 30 | # adjustments below). 31 | 32 | #classpath.local.location=${user.home}/Documents/workspace/libs 33 | 34 | 35 | # For OSX users. 36 | # The following path will direct you into Processing's application source code 37 | # folder in case you put Processing inside your Applications folder. 38 | # Uncommenting the line below will overwrite the classpath.local.location from 39 | # above. 40 | 41 | classpath.local.location=/Applications/Processing-3.5.4.app/Contents/Java/core/library 42 | 43 | 44 | # Add all jar files that are required for compiling your project to the local 45 | # and project classpath, use a comma as delimiter. These jar files must be 46 | # inside your classpath.local.location folder. 47 | 48 | classpath.local.include=core.jar 49 | 50 | 51 | # Add processing's libraries folder to the classpath. 52 | # If you don't need to include the libraries folder to your classpath, comment 53 | # out the following line. 54 | 55 | classpath.libraries.location=${sketchbook.location}/libraries 56 | 57 | 58 | 59 | # (3) 60 | # Set the java version that should be used to compile your library. 61 | 62 | java.target.version=1.7 63 | 64 | 65 | # Set the description of the Ant build.xml file. 66 | 67 | ant.description=ProcessingLibs Ant build file. 68 | 69 | 70 | 71 | # (4) 72 | # Project details. 73 | # Give your library a name. The name must not contain spaces or special characters. 74 | 75 | project.name=httprequests_processing 76 | 77 | # The name as the user will see it. This can contain spaces and special characters. 78 | 79 | project.prettyName=HTTP Requests for Processing 80 | 81 | 82 | # Use 'normal' or 'fast' as value for project.compile. 83 | # 'fast' will only compile the project into your sketchbook. 84 | # 'normal' will compile the distribution including the javadoc-reference and all 85 | # web-files (the compile process here takes longer). 86 | 87 | project.compile=normal 88 | 89 | # All files compiled with project.compile=normal are stored 90 | # in the distribution folder. 91 | 92 | 93 | 94 | # (5) 95 | # The following items are properties that will be used to make changes to the 96 | # web document templates. Values of properties will be inserted into the 97 | # documents automatically. 98 | # If you need more control, you can edit web/index.html and 99 | # web/library.properties directly. 100 | 101 | author.name=Rune Madsen 102 | author.url=http://www.runemadsen.com 103 | 104 | 105 | # Set the web page for your library. 106 | # This is NOT a direct link to where to download it. 107 | 108 | library.url=https://github.com/runemadsen/HTTProcessing 109 | 110 | 111 | # Set the category of your library. This must be one (or many) of the following: 112 | # "3D" "Animation" "Compilations" "Data" 113 | # "Fabrication" "Geometry" "GUI" "Hardware" 114 | # "I/O" "Language" "Math" "Simulation" 115 | # "Sound" "Utilities" "Typography" "Video & Vision" 116 | # If a value other than those listed is used, your library will listed as 117 | # "Other". 118 | 119 | library.category=Other 120 | 121 | 122 | # A short sentence (or fragment) to summarize the library's function. This will 123 | # be shown from inside the PDE when the library is being installed. Avoid 124 | # repeating the name of your library here. Also, avoid saying anything redundant 125 | # like mentioning that it's a library. This should start with a capitalized 126 | # letter, and end with a period. 127 | 128 | library.sentence=A collection of utilities for solving this and that problem. 129 | 130 | 131 | # Additional information suitable for the Processing website. The value of 132 | # 'sentence' always will be prepended, so you should start by writing the 133 | # second sentence here. If your library only works on certain operating systems, 134 | # mention it here. 135 | 136 | library.paragraph= 137 | 138 | 139 | # Set the source code repository for your project. 140 | # Recommendations for storing your source code online are Google Code or GitHub. 141 | 142 | source.host=Github 143 | source.url=https://github.com/runemadsen/HTTProcessing 144 | source.repository=https://github.com/runemadsen/HTTProcessing 145 | 146 | 147 | # The current version of your library. 148 | # This number must be parsable as an int. It increments once with each release. 149 | # This is used to compare different versions of the same library, and check if 150 | # an update is available. 151 | 152 | library.version=4 153 | 154 | 155 | # The version as the user will see it. 156 | 157 | library.prettyVersion=0.1.4 158 | 159 | 160 | library.copyright=(c) 2014 161 | library.dependencies=? 162 | library.keywords=? 163 | 164 | tested.platform=osx,windows 165 | tested.processingVersion=3.0.1 166 | 167 | 168 | # Include javadoc references into your project's javadocs. 169 | 170 | javadoc.java.href=http://java.sun.com/javase/7/docs/api/ 171 | javadoc.processing.href=http://processing.org/reference/javadoc/core/ 172 | -------------------------------------------------------------------------------- /resources/code/ExampleTaglet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or 5 | * without modification, are permitted provided that the following 6 | * conditions are met: 7 | * 8 | * -Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * -Redistribution in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * Neither the name of Sun Microsystems, Inc. or the names of 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * This software is provided "AS IS," without a warranty of any 21 | * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND 22 | * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, 23 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY 24 | * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY 25 | * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR 26 | * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR 27 | * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE 28 | * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, 29 | * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER 30 | * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF 31 | * THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN 32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 33 | * 34 | * You acknowledge that Software is not designed, licensed or 35 | * intended for use in the design, construction, operation or 36 | * maintenance of any nuclear facility. 37 | */ 38 | 39 | import com.sun.tools.doclets.Taglet; 40 | import com.sun.javadoc.*; 41 | import java.util.Map; 42 | import java.io.*; 43 | /** 44 | * A sample Taglet representing @example. This tag can be used in any kind of 45 | * {@link com.sun.javadoc.Doc}. It is not an inline tag. The text is displayed 46 | * in yellow to remind the developer to perform a task. For 47 | * example, "@example Hello" would be shown as: 48 | *
49 | *
50 | * To Do: 51 | *
Fix this! 52 | *
53 | *
54 | * 55 | * @author Jamie Ho 56 | * @since 1.4 57 | */ 58 | 59 | public class ExampleTaglet implements Taglet { 60 | 61 | private static final String NAME = "example"; 62 | private static final String HEADER = "example To Do:"; 63 | 64 | /** 65 | * Return the name of this custom tag. 66 | */ 67 | public String getName() { 68 | return NAME; 69 | } 70 | 71 | /** 72 | * Will return true since @example 73 | * can be used in field documentation. 74 | * @return true since @example 75 | * can be used in field documentation and false 76 | * otherwise. 77 | */ 78 | public boolean inField() { 79 | return true; 80 | } 81 | 82 | /** 83 | * Will return true since @example 84 | * can be used in constructor documentation. 85 | * @return true since @example 86 | * can be used in constructor documentation and false 87 | * otherwise. 88 | */ 89 | public boolean inConstructor() { 90 | return true; 91 | } 92 | 93 | /** 94 | * Will return true since @example 95 | * can be used in method documentation. 96 | * @return true since @example 97 | * can be used in method documentation and false 98 | * otherwise. 99 | */ 100 | public boolean inMethod() { 101 | return true; 102 | } 103 | 104 | /** 105 | * Will return true since @example 106 | * can be used in method documentation. 107 | * @return true since @example 108 | * can be used in overview documentation and false 109 | * otherwise. 110 | */ 111 | public boolean inOverview() { 112 | return true; 113 | } 114 | 115 | /** 116 | * Will return true since @example 117 | * can be used in package documentation. 118 | * @return true since @example 119 | * can be used in package documentation and false 120 | * otherwise. 121 | */ 122 | public boolean inPackage() { 123 | return true; 124 | } 125 | 126 | /** 127 | * Will return true since @example 128 | * can be used in type documentation (classes or interfaces). 129 | * @return true since @example 130 | * can be used in type documentation and false 131 | * otherwise. 132 | */ 133 | public boolean inType() { 134 | return true; 135 | } 136 | 137 | /** 138 | * Will return false since @example 139 | * is not an inline tag. 140 | * @return false since @example 141 | * is not an inline tag. 142 | */ 143 | 144 | public boolean isInlineTag() { 145 | return false; 146 | } 147 | 148 | /** 149 | * Register this Taglet. 150 | * @param tagletMap the map to register this tag to. 151 | */ 152 | public static void register(Map tagletMap) { 153 | ExampleTaglet tag = new ExampleTaglet(); 154 | Taglet t = (Taglet) tagletMap.get(tag.getName()); 155 | if (t != null) { 156 | tagletMap.remove(tag.getName()); 157 | } 158 | tagletMap.put(tag.getName(), tag); 159 | } 160 | 161 | /** 162 | * Given the Tag representation of this custom 163 | * tag, return its string representation. 164 | * @param tag the Tag representation of this custom tag. 165 | */ 166 | public String toString(Tag tag) { 167 | return createHTML(readFile(tag.text())); 168 | } 169 | 170 | 171 | /** 172 | * Given an array of Tags representing this custom 173 | * tag, return its string representation. 174 | * @param tags the array of Tags representing of this custom tag. 175 | */ 176 | public String toString(Tag[] tags) { 177 | if (tags.length == 0) { 178 | return null; 179 | } 180 | return createHTML(readFile(tags[0].text())); 181 | } 182 | 183 | 184 | 185 | String createHTML(String theString) { 186 | if(theString!=null) { 187 | String dd = ""; 193 | 194 | return dd+"\n
" + 195 | "
+Example
" + 196 | "
"+theString+"
" + 197 | "
"; 198 | } 199 | return ""; 200 | } 201 | 202 | 203 | /** 204 | * check if the examples directory exists and return the example as given in the tag. 205 | * @param theExample the name of the example 206 | */ 207 | String readFile(String theExample) { 208 | String record = ""; 209 | String myResult = ""; 210 | int recCount = 0; 211 | String myDir = "../examples"; 212 | File file=new File(myDir); 213 | if(file.exists()==false) { 214 | myDir = "./examples"; 215 | } 216 | try { 217 | FileReader fr = new FileReader(myDir+"/"+theExample+"/"+theExample+".pde"); 218 | BufferedReader br = new BufferedReader(fr); 219 | record = new String(); 220 | while ((record = br.readLine()) != null) { 221 | myResult += record+"\n"; 222 | } 223 | } catch (IOException e) { 224 | System.out.println(e); 225 | return null; 226 | } 227 | return myResult; 228 | } 229 | } 230 | 231 | 232 | -------------------------------------------------------------------------------- /resources/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | ${ant.description} 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | ${line} 81 | Building the Processing Library ${project.name} ${library.version} 82 | ${line} 83 | src path ${project.src} 84 | bin path ${project.bin} 85 | classpath.local ${classpath.local.location} 86 | sketchbook ${sketchbook.location} 87 | java version ${java.target.version} 88 | ${line} 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | ${exampleDir} 342 | 348 | 349 | 355 | 356 | 357 | 358 | 359 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | ${line} 378 | Name ${project.name} 379 | Version ${library.prettyVersion} (${library.version}) 380 | Compiled ${project.compile} 381 | Sketchbook ${sketchbook.location} 382 | ${line} 383 | done, finished. 384 | ${line} 385 | 386 | 387 | 388 | 389 | 390 | --------------------------------------------------------------------------------