summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorburdziak <olaf.burdziakowski@nokia.com>2018-03-22 10:17:40 +0100
committerburdziak <olaf.burdziakowski@nokia.com>2018-03-22 10:17:40 +0100
commit34a47ef924cb0b58f3a9b88a0a73936fad89f7d8 (patch)
tree6447e3f8b48c4c5cf620c6b02a0a106ea255cdc6 /src
parentbf99eb77b31a4cfbc590762cc6ba669820c21439 (diff)
Fixes in EchoService
Change-Id: I0e1a0798f7f7eb89edaf4731c7e5a02bf362e4b2 Issue-ID: AAI-918 Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/aai/datarouter/service/EchoService.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/org/onap/aai/datarouter/service/EchoService.java b/src/main/java/org/onap/aai/datarouter/service/EchoService.java
index 4ff658b..8192935 100644
--- a/src/main/java/org/onap/aai/datarouter/service/EchoService.java
+++ b/src/main/java/org/onap/aai/datarouter/service/EchoService.java
@@ -44,6 +44,8 @@ public class EchoService {
private static Logger logger = LoggerFactory.getInstance().getLogger(EchoService.class.getName());
private static Logger auditLogger =
LoggerFactory.getInstance().getAuditLogger(EchoService.class.getName());
+ private static final String XFROMAPPID = "X-FromAppId";
+ private static final String XTRANSACTIONID = "X-TransactionId";
@GET
@Path("echo/{input}")
@@ -55,15 +57,15 @@ public class EchoService {
String fromAppId = "";
String transId;
- if (headers.getRequestHeaders().getFirst("X-FromAppId") != null) {
- fromAppId = headers.getRequestHeaders().getFirst("X-FromAppId");
+ if (headers.getRequestHeaders().getFirst(XFROMAPPID) != null) {
+ fromAppId = headers.getRequestHeaders().getFirst(XFROMAPPID);
}
- if ((headers.getRequestHeaders().getFirst("X-TransactionId") == null)
- || headers.getRequestHeaders().getFirst("X-TransactionId").isEmpty()) {
+ if ((headers.getRequestHeaders().getFirst(XTRANSACTIONID) == null)
+ || headers.getRequestHeaders().getFirst(XTRANSACTIONID).isEmpty()) {
transId = java.util.UUID.randomUUID().toString();
} else {
- transId = headers.getRequestHeaders().getFirst("X-TransactionId");
+ transId = headers.getRequestHeaders().getFirst(XTRANSACTIONID);
}
MdcContext.initialize(transId, DataRouterConstants.DATA_ROUTER_SERVICE_NAME, "", fromAppId,
@@ -83,9 +85,7 @@ public class EchoService {
auditLogger.info(DataRouterMsgs.PROCESS_REST_REQUEST,
new LogFields().setField(LogLine.DefinedFields.RESPONSE_CODE, status)
.setField(LogLine.DefinedFields.RESPONSE_DESCRIPTION, respStatusString),
- (req != null) ? req.getMethod() : "Unknown",
- (req != null) ? req.getRequestURL().toString() : "Unknown",
- (req != null) ? req.getRemoteHost() : "Unknown", Integer.toString(status));
+ req.getMethod(), req.getRequestURL().toString(), req.getRemoteHost(), Integer.toString(status));
MDC.clear();
return "Hello, " + input + ".";