"Authentication Failed: Username/password/AuthKey/AuthDate parameter(s) cannot be null or empty.");
}
}
+
+ public JSONObject postNoAuth(final String path, final byte[] data, String contentType)
+ throws HttpException, JSONException {
+ WebTarget target = null;
+ Response response = null;
+ if (contentType == null) {
+ contentType = "text/pain";
+ }
+ target = DmaapClientUtil.getTarget(path);
+
+ response = DmaapClientUtil.postResponsewtNoAuth(target, data, contentType);
+
+ return getResponseDataInJson(response);
+ }
public String postWithResponse(final String path, final byte[] data, final String contentType,
final String username, final String password, final String protocolFlag)
fPending.clear();
return true;
}
+
+ if (ProtocolTypeConstants.HTTPNOAUTH.getValue().equalsIgnoreCase(protocolFlag)) {
+ getLog().info("sending " + fPending.size() + " msgs to " + httpurl + ". Oldest: "
+ + (nowMs - fPending.peek().timestamp) + " ms");
+ final JSONObject result = postNoAuth(httpurl, baseStream.toByteArray(), contentType);
+
+ // Here we are checking for error response. If HTTP status
+ // code is not within the http success response code
+ // then we consider this as error and return false
+ if (result.getInt("status") < 200 || result.getInt("status") > 299) {
+ return false;
+ }
+ final String logLine = "MR reply ok (" + (Clock.now() - startMs) + " ms):" + result.toString();
+ getLog().info(logLine);
+ fPending.clear();
+ return true;
+ }
} catch (IllegalArgumentException x) {
getLog().warn(x.getMessage(), x);
} catch (IOException x) {