public class SimpleClient extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ERROR_KEY
A special error prefix that will appear at the start of error responses.
|
static String |
SESSION_KEY_PARAM_NAME
A special request parameter used to indicate that the server should
maintain a session with this client.
|
Constructor and Description |
---|
SimpleClient(String host)
Initialiazes a new client to connect to the given HTTP server/host.
|
Modifier and Type | Method and Description |
---|---|
String |
makeRequest(Request request)
Initiates a synchronous HTTP request to this client's given server host,
waiting for the HTTP response to be sent back, and returns the response.
|
String |
makeRequest(String command,
String... params)
Initiates a synchronous HTTP request to this client's given server host,
waiting for the HTTP response to be sent back, and returns the response.
|
void |
sessionEnd()
Ends any current session between this client and the server host.
|
boolean |
sessionIsInProgress()
Returns true if a session is currently in progress between this client
and the server host.
|
void |
sessionStart()
Begins a session between this client and the server host.
|
String |
toString()
Returns a string representation of this client.
|
public static final String ERROR_KEY
public static final String SESSION_KEY_PARAM_NAME
public SimpleClient(String host)
host
- e.g. "http://localhost:8080/"public String makeRequest(Request request)
public String makeRequest(String command, String... params)
public void sessionEnd()
public boolean sessionIsInProgress()
public void sessionStart()