|
void | setServer (String server) throws IllegalArgumentException |
|
String | getServerURL () |
|
void | setServerURL (String server_url) |
|
String | latlongFormatter (String text) |
|
String | trimmLast (String text) |
|
JSONObject | asJSONObject (String text) throws IOException |
|
JSONArray | asJSONArray (String text) throws IOException |
|
Object | safeJSONTraverse (String sequence, Object original, Class<?> target) throws IOException |
|
String | executeHTTPRequest (Request request) throws ClientProtocolException, IOException, RateLimitException |
|
String | get (String url) throws RateLimitException, IOException |
|
String | getUSGS (String url) throws RateLimitException, IOException |
|
String | post (String url, Map< String, String > arguments) throws IOException, RateLimitException |
|
String | post (String url, String data) throws IOException, RateLimitException |
|
String | prepare (String url) |
|
String | prepareUSGS (String url) |
|
bridges.connect.Connector.Connector |
( |
| ) |
|
|
protected |
JSONArray bridges.connect.Connector.asJSONArray |
( |
String |
text | ) |
throws IOException |
Decode a String containing JSON into a JSON Array, or throw an error.
- Parameters
-
text | The JSON Array as a string |
- Returns
- a non-null JSONArray
JSONObject bridges.connect.Connector.asJSONObject |
( |
String |
text | ) |
throws IOException |
Decode a String containing JSON into a JSON Object, or throw an error.
- Parameters
-
- Returns
- A non-null JSON object
String bridges.connect.Connector.executeHTTPRequest |
( |
Request |
request | ) |
throws ClientProtocolException, IOException, RateLimitException |
Execute an Apache Fluent Request. Decorates HTTP error tracebacks with urls and server {"error": "..."} responses. Throws an IOException with URL if the server returns an empty response. Returns server response if the status code is >= 400 but can still throw other exceptions if JSON parsing fails when formatting server JSON response
- Parameters
-
- Returns
- the requested string from the server
- Exceptions
-
ClientProtocolException | |
IOException | |
RateLimitException | |
String bridges.connect.Connector.getServerURL |
( |
| ) |
|
Get the current base URL for the DataFormatters server (with no ending/)
- Returns
String bridges.connect.Connector.getUSGS |
( |
String |
url | ) |
throws RateLimitException, IOException |
String bridges.connect.Connector.latlongFormatter |
( |
String |
text | ) |
|
This reformats the coordinates in Earthwuake tweet such that there will be no arrays present when casting to the JSONObject. for the resons described below Mihai
- Parameters
-
- Returns
String bridges.connect.Connector.post |
( |
String |
url, |
|
|
Map< String, String > |
arguments |
|
) |
| throws IOException, RateLimitException |
Execute a simple POST request with relative paths, taking a Scala Map() of request parameters.
String bridges.connect.Connector.post |
( |
String |
url, |
|
|
String |
data |
|
) |
| throws IOException, RateLimitException |
String bridges.connect.Connector.prepare |
( |
String |
url | ) |
|
Escape the URL and prepend the base URL.
- Returns
- the new url as a String
String bridges.connect.Connector.prepareUSGS |
( |
String |
url | ) |
|
Object bridges.connect.Connector.safeJSONTraverse |
( |
String |
sequence, |
|
|
Object |
original, |
|
|
Class<?> |
target |
|
) |
| throws IOException |
Traverse JSON in a type-safe manner. This is somewhat complicated, but comes with the advantage that the debugging reports are far clearer when you know the whole path you are searching for.
Use this syntax: [ number ] to access an array element, ["quoted string"] to get an object attribute
- Parameters
-
void bridges.connect.Connector.setServer |
( |
String |
server | ) |
throws IllegalArgumentException |
Set the current DataFormatters server to live, clone, or local, or throw an error;
- Parameters
-
void bridges.connect.Connector.setServerURL |
( |
String |
server_url | ) |
|
Set the current base URL for the DataFormatters server (with no ending /)
- Parameters
-
String bridges.connect.Connector.trimmLast |
( |
String |
text | ) |
|
Trimm the end of the earthquake data: ,"products":{"String":[]}
Important: future implementations could combine the above in one single method with a hash table for different patters Mihai
- Parameters
-
- Returns
The documentation for this class was generated from the following file:
- /Users/kalpathi/gr/bridges/bridges17/java/src/main/java/bridges/connect/Connector.java