Package org.qdl_lang.extensions.http
Class HTTPClient
- java.lang.Object
-
- org.qdl_lang.extensions.http.HTTPClient
-
- All Implemented Interfaces:
Serializable
,QDLMetaModule
public class HTTPClient extends Object implements QDLMetaModule
Class that is the workhorse forQDLHTTPModule
. See the blurb
/home/ncsa/dev/ncsa-git/qdl/language/src/main/docs/http-extension.odtCreated by Jeff Gaynor
on 10/5/21 at 7:02 AM- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
HTTPClient.Close
class
HTTPClient.CreateCredentials
class
HTTPClient.Delete
class
HTTPClient.Download
class
HTTPClient.Get
class
HTTPClient.Headers
class
HTTPClient.Host
class
HTTPClient.IsJSON
class
HTTPClient.IsOpen
class
HTTPClient.IsText
class
HTTPClient.Open
class
HTTPClient.Post
class
HTTPClient.Put
-
Field Summary
Fields Modifier and Type Field Description String
CLOSE_METHOD
static String
CONTENT_FORM
static int
CONTENT_FORM_VALUE
static String
CONTENT_HTML
static int
CONTENT_HTML_VALUE
static String
CONTENT_JSON
static int
CONTENT_JSON_VALUE
static String
CONTENT_KEY
static String
CONTENT_TEXT
static int
CONTENT_TEXT_VALUE
static int
CONTENT_TYPE_MISSING_VALUE
static String
CREATE_CREDENTIALS_METHOD
String
DELETE_METHOD
String
DOWNLOAD_METHOD
String
GET_METHOD
static String
HEADERS_KEY
String
HEADERS_METHOD
String
HOST_METHOD
static String
IS_JSON
String
IS_OPEN_METHOD
static String
IS_TEXT
String
OPEN_METHOD
String
POST_METHOD
String
PUT_METHOD
static String
STATUS_KEY
-
Constructor Summary
Constructors Constructor Description HTTPClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkInit()
void
deserializeFromJSON(net.sf.json.JSONObject json)
Object
doPostOrPut(Object[] objects, State state, boolean isPost)
protected String
getActualHost(String uriPath)
Given a uriPath, return the actual path to the service.protected int
getContentType(Set<String> contentType)
QDLStem
getResponseStem(org.apache.http.HttpResponse response)
Utillity to turn the response, whatever it is, into a stem.protected List<String>
getURIPathBlurb()
protected QDLStem
jsonToStemJSON(String rawJSON)
protected String
paramsToRequest(Object[] objects)
Takes the array of objects for an evaluate method and creates the right url This is used in get and delete.net.sf.json.JSONObject
serializeToJSON()
Send back a serialization of internal state for this object.
-
-
-
Field Detail
-
HOST_METHOD
public String HOST_METHOD
-
GET_METHOD
public String GET_METHOD
-
HEADERS_METHOD
public String HEADERS_METHOD
-
PUT_METHOD
public String PUT_METHOD
-
POST_METHOD
public String POST_METHOD
-
DELETE_METHOD
public String DELETE_METHOD
-
CLOSE_METHOD
public String CLOSE_METHOD
-
OPEN_METHOD
public String OPEN_METHOD
-
IS_OPEN_METHOD
public String IS_OPEN_METHOD
-
DOWNLOAD_METHOD
public String DOWNLOAD_METHOD
-
CONTENT_FORM
public static final String CONTENT_FORM
- See Also:
- Constant Field Values
-
CONTENT_FORM_VALUE
public static final int CONTENT_FORM_VALUE
- See Also:
- Constant Field Values
-
CONTENT_JSON
public static final String CONTENT_JSON
- See Also:
- Constant Field Values
-
CONTENT_JSON_VALUE
public static final int CONTENT_JSON_VALUE
- See Also:
- Constant Field Values
-
CONTENT_HTML
public static final String CONTENT_HTML
- See Also:
- Constant Field Values
-
CONTENT_HTML_VALUE
public static final int CONTENT_HTML_VALUE
- See Also:
- Constant Field Values
-
CONTENT_TEXT
public static final String CONTENT_TEXT
- See Also:
- Constant Field Values
-
CONTENT_TEXT_VALUE
public static final int CONTENT_TEXT_VALUE
- See Also:
- Constant Field Values
-
CONTENT_TYPE_MISSING_VALUE
public static final int CONTENT_TYPE_MISSING_VALUE
- See Also:
- Constant Field Values
-
CONTENT_KEY
public static final String CONTENT_KEY
- See Also:
- Constant Field Values
-
HEADERS_KEY
public static final String HEADERS_KEY
- See Also:
- Constant Field Values
-
STATUS_KEY
public static final String STATUS_KEY
- See Also:
- Constant Field Values
-
CREATE_CREDENTIALS_METHOD
public static String CREATE_CREDENTIALS_METHOD
-
IS_JSON
public static String IS_JSON
-
IS_TEXT
public static String IS_TEXT
-
-
Method Detail
-
checkInit
protected void checkInit()
-
paramsToRequest
protected String paramsToRequest(Object[] objects) throws UnsupportedEncodingException
Takes the array of objects for an evaluate method and creates the right url This is used in get and delete. Options are 0 args - return current host 1 arg - stem, parameters 2 args - uri path + stem of parameters- Parameters:
objects
-- Returns:
- a valid get/delete string of host+uri_path+?key0=value0&key1=value1...
- Throws:
UnsupportedEncodingException
-
getResponseStem
public QDLStem getResponseStem(org.apache.http.HttpResponse response) throws IOException
Utillity to turn the response, whatever it is, into a stem.- Parameters:
response
-- Returns:
- Throws:
IOException
-
getActualHost
protected String getActualHost(String uriPath)
Given a uriPath, return the actual path to the service. This does the nitpicky things to create the path.- Parameters:
uriPath
-- Returns:
-
serializeToJSON
public net.sf.json.JSONObject serializeToJSON()
Description copied from interface:QDLMetaModule
Send back a serialization of internal state for this object. This allows for the state you choose to be serialized and then reloaded.NOTE
There is no canonical form for this. Set it how you will and deserialize it accordingly.- Specified by:
serializeToJSON
in interfaceQDLMetaModule
- Returns:
-
deserializeFromJSON
public void deserializeFromJSON(net.sf.json.JSONObject json)
- Specified by:
deserializeFromJSON
in interfaceQDLMetaModule
-
-