public class RestRequester extends Object
Modifier and Type | Field and Description |
---|---|
protected static boolean |
acceptJSON_ |
static boolean |
authenticating_ |
protected static String |
baseUrl_ |
protected static String |
CLASSNAME |
protected static boolean |
debugOut_ |
static String |
LOG_TAG |
protected static String |
password_ |
static String |
SYSTEM_FILE_SEPERATOR
A holder for this clients System File Separator.
|
static String |
SYSTEM_LINE_SEPERATOR
A holder for this clients System line termination separator.
|
static String |
USER_AGENT |
protected static String |
username_ |
Constructor and Description |
---|
RestRequester() |
RestRequester(String baseUrl) |
RestRequester(String baseUrl,
String uName,
String uPasswd) |
Modifier and Type | Method and Description |
---|---|
StringBuilder |
callService(String serviceName,
boolean getNotPost)
Sends the rest service request off and returns the results.
|
StringBuilder |
callService(String baseUrl,
String serviceName,
boolean getNotPost) |
private String |
cleanJSON(StringBuilder sb) |
boolean |
getAcceptJSON() |
String |
getBaseUrl() |
String |
getPassword() |
String |
getServiceUrl(String serviceStr)
Stitches together the URL that will get sent as the fuul service request.
|
String |
getUsername() |
boolean |
isInit() |
StringBuilder |
responseIndenter(StringBuilder sb)
Indents/spaces out an XML result.
|
StringBuilder |
serviceGet(String serviceName)
Sends the rest service GET request off and returns the results.
|
StringBuilder |
servicePost(String serviceName)
Sends the rest service POST request off and retruns the results.
|
void |
setAcceptJSON(boolean acceptJson) |
void |
setBaseUrl(String url) |
void |
setPassword(String uPasswd) |
void |
setUsername(String uName) |
protected static boolean debugOut_
public static final String SYSTEM_FILE_SEPERATOR
public static final String SYSTEM_LINE_SEPERATOR
public static boolean authenticating_
protected static boolean acceptJSON_
public static final String USER_AGENT
public RestRequester()
public RestRequester(String baseUrl)
public RestRequester(String baseUrl, String uName, String uPasswd)
public void setUsername(String uName)
public void setPassword(String uPasswd)
public void setBaseUrl(String url)
public void setAcceptJSON(boolean acceptJson)
public String getUsername()
public String getPassword()
public String getBaseUrl()
public boolean getAcceptJSON()
public boolean isInit()
public String getServiceUrl(String serviceStr)
public StringBuilder serviceGet(String serviceName)
serviceName
- is the service (string) to append to the baseURL - example /rest/syspublic StringBuilder servicePost(String serviceName)
serviceName
- is the service (string) to append to the baseURL - example /rest/syspublic StringBuilder callService(String serviceName, boolean getNotPost)
serviceName
- is the service (string) to append to the baseURL - example /rest/sysgetNotPost
- is a flag to tell this method to do a get or post based on this flag - true does a GET, false does a POSTpublic StringBuilder callService(String baseUrl, String serviceName, boolean getNotPost)
private String cleanJSON(StringBuilder sb)
public StringBuilder responseIndenter(StringBuilder sb)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses