diff options
author | Leigh, Phillip (pl876u) <phillip.leigh@amdocs.com> | 2019-02-04 14:59:54 -0500 |
---|---|---|
committer | Leigh, Phillip (pl876u) <phillip.leigh@amdocs.com> | 2019-02-04 15:00:17 -0500 |
commit | 03a6609e1ffb981e7222fe938b6dd6337b287b87 (patch) | |
tree | e104c15975b71dfd6fb23f18c242c1b6b39c1733 /src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java | |
parent | 09e3af8778d9a84ecea2f2085708f22554bd04b8 (diff) |
Log request when no XFromAppId/ServiceInstance
Issue-ID: LOG-688
Change-Id: I909e589b0c1c5dc5998a2e2129585c900210b2c6
Signed-off-by: Leigh, Phillip (pl876u) <phillip.leigh@amdocs.com>
Diffstat (limited to 'src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java')
-rw-r--r-- | src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java index 958f656..29fd8d0 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java +++ b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java @@ -73,9 +73,9 @@ public class RestUtil { private static final String SERVICE_INSTANCE_ID = "serviceInstanceId"; // HTTP headers - private static final String TRANSACTION_ID = "X-TransactionId"; - private static final String FROM_APP_ID = "X-FromAppId"; - private static final String AUTHORIZATION = "Authorization"; + public static final String TRANSACTION_ID = "X-TransactionId"; + public static final String FROM_APP_ID = "X-FromAppId"; + public static final String AUTHORIZATION = "Authorization"; private static final String APP_NAME = "aaiCtxBuilder"; @@ -144,16 +144,33 @@ public class RestUtil { * * @throws AuditException if there is missing parameter */ - public static void validateURL(String serviceInstanceId) + public static void validateServiceInstanceId(String serviceInstanceId) throws AuditException { if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + log.info("Null %s", SERVICE_INSTANCE_ID); throw new AuditException(AuditError.INVALID_REQUEST_URL_MISSING_PARAMETER + SERVICE_INSTANCE_ID, Status.BAD_REQUEST); } } + /** + * Validates the URL parameter. + * + * @throws AuditException if there is missing parameter + */ + public static void validateXFromAppId(String xFromAppId) + throws AuditException { + + if (xFromAppId == null || xFromAppId.isEmpty()) { + log.info("Null %s", FROM_APP_ID); + throw new AuditException(AuditError.INVALID_REQUEST_URL_MISSING_PARAMETER + FROM_APP_ID, + Status.BAD_REQUEST); + } + + } + public static void validateBasicAuthorization(HttpHeaders headers, String basicAuthorization) throws AuditException { String authorization = null; |