try {
JSONObject request = createRequest(offset, CHUNK_SIZE);
Client c = Client.create();
if (squeezeboxServerUsername != null && squeezeboxServerUsername.length() > 0) {
if (squeezeboxServerPassword != null && squeezeboxServerPassword.length() > 0) {
c.addFilter(new HTTPBasicAuthFilter(squeezeboxServerUsername, squeezeboxServerPassword));
} else if (squeezeboxServerPasswordHash != null && squeezeboxServerPasswordHash.length() > 0) {
c.addFilter(new HTTPBasicAuthFilter(squeezeboxServerUsername, squeezeboxServerPasswordHash));
}
}
JSONObject response = null;
if (squeezeboxServerPasswordHash != null && squeezeboxServerPasswordHash.length() > 0) {
response = c.resource(SERVICE_URL).accept("application/json").header("X-Scanner", 1).post(JSONObject.class, request);