assertHasSecurityToken();
}
// TODO: call corresponding functions in Client class directly.
protected void toHttpMessage() throws RequestException, IOException {
Provider provider = client.getProvider();
if (provider.getRpcEndpoint() != null) {
isRpc = true;
Map<String, String> headers = new HashMap<String, String>();
headers.put(HttpMessage.CONTENT_TYPE, provider.getContentType());
final String KEY = "key";
Map<String, Request> requests = new HashMap<String, Request>();
requests.put(KEY, request);
byte[] body = client.buildRpcPayload(requests);
String method = "POST";
String url = client.buildRpcUrl(requests);
message = client.getAuthScheme().getHttpMessage(provider, method, url,
headers, body);
} else if (provider.getRestEndpoint() != null) {
isRpc = false;
Map<String, String> headers = new HashMap<String, String>();
if (request.getContentType() != null) {
headers.put(HttpMessage.CONTENT_TYPE, request.getContentType());
} else {
headers.put(HttpMessage.CONTENT_TYPE, provider.getContentType());
}
String method = request.getRestMethod();
String url = client.buildRestUrl(request);