}
}
String responseContent = null;
HttpEntity httpEntity = null;
try {
Client client = clients.getHtmlshark();
String protocol = "http://";
if(method.equals("getCommunicationToken")) {
protocol = "https://";
}
String url = protocol + "grooveshark.com/more.php?" + method;
for(String jsqueueMethod : jsqueueMethods) {
if(jsqueueMethod.equals(method)) {
client = clients.getJsqueue();
break;
}
}
header.put("client", client.getName());
header.put("clientRevision", client.getRevision());
header.put("privacy", "0");
header.put("uuid", uuid);
header.put("country", country);
if(!method.equals("initiateSession")) {
header.put("session", session);
header.put("token", generateToken(method, client.getSecret()));
}
Gson gson = new Gson();
String jsonString = gson.toJson(new JsonRequest(header, parameters, method));
log.info(">>> " + jsonString);
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader(HTTP.CONTENT_TYPE, "application/json");
httpPost.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE);
httpPost.setHeader(HTTP.USER_AGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31");
httpPost.setHeader("Referer", "http://grooveshark.com/JSQueue.swf?" + client.getRevision());
httpPost.setHeader("Content-Language", "en-US");
httpPost.setHeader("Cache-Control", "max-age=0");
httpPost.setHeader("Accept", "*/*");
httpPost.setHeader("Accept-Charset", "utf-8,ISO-8859-1;q=0.7,*;q=0.3");
httpPost.setHeader("Accept-Language", "de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4");