<groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
<artifactId>dmaapClient</artifactId>
<packaging>jar</packaging>
- <version>1.1.4-SNAPSHOT</version>
+ <version>1.1.5-SNAPSHOT</version>
<name>dmaap-messagerouter-dmaapclient</name>
<description>Client library for MR event routing API</description>
<url>https://github.com/att/dmaap-framework</url>
return target.request().get();
}
+
+ public static Response postResponsewtNoAuth(WebTarget target, byte[] data, String contentType) {
+ return target.request().post(Entity.entity(data, contentType));
+
+ }
}
"Authentication Failed: Username/password/AuthKey/AuthDate parameter(s) cannot be null or empty.");
}
}
+
+ public String postNoAuthWithResponse(final String path, final byte[] data, String contentType)
+ throws HttpException, JSONException {
+
+ String responseData = null;
+ WebTarget target = null;
+ Response response = null;
+ if (contentType == null) {
+ contentType = "text/pain";
+ }
+ target = DmaapClientUtil.getTarget(path);
+
+ response = DmaapClientUtil.postResponsewtNoAuth(target, data, contentType);
+ responseData = (String) response.readEntity(String.class);
+ return responseData;
+ }
public JSONObject postAuth(final String path, final byte[] data, final String contentType, final String authKey,
final String authDate, final String username, final String password, final String protocolFlag)
fPending.clear();
return pubResponse;
}
+
+ if (ProtocolTypeConstants.HTTPNOAUTH.getValue().equalsIgnoreCase(protocolFlag)) {
+ getLog().info("sending " + fPending.size() + " msgs to " + httpurl + ". Oldest: "
+ + (nowMs - fPending.peek().timestamp) + " ms");
+ final String result = postNoAuthWithResponse(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
+ pubResponse = createMRPublisherResponse(result, pubResponse);
+
+ if (Integer.valueOf(pubResponse.getResponseCode()) < 200
+ || Integer.valueOf(pubResponse.getResponseCode()) > 299) {
+
+ return pubResponse;
+ }
+
+ final String logLine = String.valueOf((Clock.now() - startMs));
+ getLog().info(logLine);
+ fPending.clear();
+ return pubResponse;
+ }
} catch (IllegalArgumentException x) {
getLog().warn(x.getMessage(), x);
pubResponse.setResponseCode(String.valueOf(HttpStatus.SC_BAD_REQUEST));
return pubResponse;
}
- private MRPublisherResponse createMRPublisherResponse(String reply, MRPublisherResponse mrPubResponse) {
+ public MRPublisherResponse createMRPublisherResponse(String reply, MRPublisherResponse mrPubResponse) {
if (reply.isEmpty()) {
major=1
minor=1
-patch=4
+patch=5
base_version=${major}.${minor}.${patch}