public class HttpClient extends Service implements HttpDataListener, HttpResponseListener
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
log |
cfgDir, dnaPool, MESSAGE_RECORDING_FORMAT_BINARY, MESSAGE_RECORDING_FORMAT_XML
Constructor and Description |
---|
HttpClient(java.lang.String n) |
Modifier and Type | Method and Description |
---|---|
void |
addFormField(java.lang.String name,
java.lang.String value) |
void |
addHttpDataListener(ServiceInterface listener) |
void |
addHttpResponseListener(ServiceInterface listener) |
void |
clearForm() |
java.lang.String |
get(java.lang.String uri) |
byte[] |
getBytes(java.lang.String uri) |
static ServiceType |
getMetaData()
This static method returns all the details of the class without it having
to be constructed.
|
static void |
main(java.lang.String[] args) |
void |
onHttpData(HttpData data)
publishHttpData contains more information content type, response code,
etc...
|
void |
onHttpResponse(java.lang.String data)
for testing purposes
|
java.lang.String |
post(java.lang.String uri) |
java.lang.String |
post(java.lang.String uri,
java.util.HashMap<java.lang.String,java.lang.String> fields) |
byte[] |
postBytes(java.lang.String uri,
java.util.HashMap<java.lang.String,java.lang.String> fields) |
HttpData |
processResponse(org.apache.http.client.methods.HttpUriRequest request,
java.util.HashMap<java.lang.String,java.lang.String> fields) |
HttpData |
publishHttpData(HttpData data)
publishing point for any http request this is the asynchronous callback
which will arrive typically at publishHttpData(data)
contains more data than just the text, can be used for any content type
too, since the payload is in a byte[]
|
java.lang.String |
publishHttpResponse(java.lang.String data)
publishing point for any http request this is the asynchronous callback
which will arrive typically at onHttpRespone(data)
|
void |
startService() |
addListener, addListener, addTask, addTask, addTask, addTaskOneShot, allowDisplay, allowDisplay, attach, attach, broadcastState, buildDna, buildDna, buildDnaKeys, buildDnaNames, clearLastError, close, containsTask, copyShallowFrom, createPeer, createPeer, createRootReserved, detach, detach, detach, echoHeartbeat, error, error, error, getAttached, getCfgDir, getComm, getDeclaredMethodNames, getDeclaredMethods, getDescription, getDna, getDnaString, getHostName, getInbox, getInstanceId, getIntanceName, getInterfaceSet, getLastError, getMessageSet, getMetaData, getMethodMap, getMethodNames, getMethods, getMethodToolTip, getMsg, getName, getNotifyList, getNotifyListKeySet, getOutbox, getPeerKey, getPeerName, getServiceResourceFile, getSimpleName, getTasks, getThisThread, getType, hasError, hasPeers, help, help, in, info, info, invoke, invoke, invoke, invokeOn, isAttached, isAttached, isLocal, isReady, isRunning, isRuntime, isVirtual, load, load, logTimeEnable, mergeDna, mergeDna, mergePeerDna, movePeerDna, out, out, preProcessHook, preRoutingHook, publishError, publishQueueStats, publishState, publishStats, publishStatus, purgeTask, purgeTasks, releasePeers, releaseService, removeAllListeners, removeListener, requiresSecurity, reserve, reserve, reserveRoot, reserveRoot, reserveRootAs, run, save, save, save, send, send, send, send, sendBlocking, sendBlocking, sendBlocking, sendBlocking, sendPeer, setInstanceId, setName, setPeer, setSecurityProvider, setState, setThisThread, setVirtual, sleep, stackToString, startHeartbeat, startPeer, startPeer, startRecording, stopHeartbeat, stopMsgRecording, stopService, subscribe, subscribe, subscribe, toString, unsubscribe, unsubscribe, unsubscribe, updateStats, warn, warn
public static ServiceType getMetaData()
public void addFormField(java.lang.String name, java.lang.String value)
public void addHttpDataListener(ServiceInterface listener)
public void addHttpResponseListener(ServiceInterface listener)
public void clearForm()
public java.lang.String get(java.lang.String uri) throws org.apache.http.client.ClientProtocolException, java.io.IOException
org.apache.http.client.ClientProtocolException
java.io.IOException
public byte[] getBytes(java.lang.String uri) throws org.apache.http.client.ClientProtocolException, java.io.IOException
org.apache.http.client.ClientProtocolException
java.io.IOException
public void onHttpData(HttpData data)
onHttpData
in interface HttpDataListener
public void onHttpResponse(java.lang.String data)
onHttpResponse
in interface HttpResponseListener
public java.lang.String post(java.lang.String uri) throws org.apache.http.client.ClientProtocolException, java.io.IOException
org.apache.http.client.ClientProtocolException
java.io.IOException
public java.lang.String post(java.lang.String uri, java.util.HashMap<java.lang.String,java.lang.String> fields) throws org.apache.http.client.ClientProtocolException, java.io.IOException
org.apache.http.client.ClientProtocolException
java.io.IOException
public byte[] postBytes(java.lang.String uri, java.util.HashMap<java.lang.String,java.lang.String> fields) throws org.apache.http.client.ClientProtocolException, java.io.IOException
org.apache.http.client.ClientProtocolException
java.io.IOException
public HttpData processResponse(org.apache.http.client.methods.HttpUriRequest request, java.util.HashMap<java.lang.String,java.lang.String> fields) throws java.io.IOException
java.io.IOException
public HttpData publishHttpData(HttpData data)
data
- the http datapublic java.lang.String publishHttpResponse(java.lang.String data)
data
- the datapublic void startService()
startService
in interface ServiceInterface
startService
in class Service
public static void main(java.lang.String[] args)