aboutsummaryrefslogtreecommitdiffstats
path: root/aai-schema-service/src/main/java
diff options
context:
space:
mode:
authorKajur, Harish (vk250x) <vk250x@att.com>2019-04-10 13:46:17 -0400
committerKajur, Harish (vk250x) <vk250x@att.com>2019-04-10 14:46:50 -0400
commit3501e74711a2e91ce84d0b4cbc989738f96e0891 (patch)
treecd99b4bbd91a775bec46a4a6a686e191bcfe6d0c /aai-schema-service/src/main/java
parentd52076b0c1cb20eae678cfcf534988d3d0618c34 (diff)
Add additional logging statements1.0.2
Fix the metaspace issue Respond to an invalid content-type appropriately Add getTool.sh to the scripts Issue-ID: AAI-2326 Change-Id: Ib4764ba71be78816e549f59ccbdab8ccb14dc4c0 Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
Diffstat (limited to 'aai-schema-service/src/main/java')
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java9
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/InvalidResponseStatus.java39
2 files changed, 40 insertions, 8 deletions
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
index 8f36ac5..f2e0bd1 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
@@ -148,6 +148,15 @@ public class SchemaServiceApp {
@PreDestroy
public void cleanup() {
+
+ LoggingContext.save();
+ LoggingContext.component("Stopped");
+ LoggingContext.partnerName("NA");
+ LoggingContext.targetEntity(APP_NAME);
+ LoggingContext.requestId(UUID.randomUUID().toString());
+ LoggingContext.serviceName(APP_NAME);
+ LoggingContext.targetServiceName("Stopped");
+ LoggingContext.statusCode(StatusCode.COMPLETE);
logger.info("SchemaService shutting down");
}
}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/InvalidResponseStatus.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/InvalidResponseStatus.java
index 4fd3220..8b03ac2 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/InvalidResponseStatus.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/InvalidResponseStatus.java
@@ -24,10 +24,12 @@ import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.schemaservice.interceptors.AAIContainerFilter;
import javax.annotation.Priority;
+import javax.print.attribute.standard.Media;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -39,15 +41,18 @@ public class InvalidResponseStatus extends AAIContainerFilter implements Contain
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
throws IOException {
- if (responseContext.getStatus() == 405) {
+ String contentType = responseContext.getHeaderString("Content-Type");
+ ArrayList<String> templateVars = new ArrayList<>();
+ List<MediaType> mediaTypeList = new ArrayList<>();
+ AAIException e;
+ String message = "";
- responseContext.setStatus(400);
- AAIException e = new AAIException("AAI_3012");
- ArrayList<String> templateVars = new ArrayList<>();
+ if (responseContext.getStatus() == 405) {
- List<MediaType> mediaTypeList = new ArrayList<>();
+ // add the accept type error msg here as well.
- String contentType = responseContext.getHeaderString("Content-Type");
+ responseContext.setStatus(400);
+ e = new AAIException("AAI_3012");
if (contentType == null) {
mediaTypeList.add(MediaType.APPLICATION_XML_TYPE);
@@ -55,11 +60,29 @@ public class InvalidResponseStatus extends AAIContainerFilter implements Contain
mediaTypeList.add(MediaType.valueOf(contentType));
}
- String message = ErrorLogHelper.getRESTAPIErrorResponse(mediaTypeList, e, templateVars);
+ message = ErrorLogHelper.getRESTAPIErrorResponse(mediaTypeList, e, templateVars);
responseContext.setEntity(message);
}
+ else if (responseContext.getStatus() == 406) {
+ responseContext.setStatus(406);
+ mediaTypeList.add(MediaType.valueOf(contentType));
+ if (contentType.equals(MediaType.APPLICATION_XML)) {
+ e = new AAIException("AAI_3019", MediaType.APPLICATION_XML);
+ } else if (contentType.equals(MediaType.APPLICATION_JSON)) {
+ e = new AAIException("AAI_3019", MediaType.APPLICATION_JSON);
+ } else {
+ if (contentType == null) {
+ mediaTypeList.add(MediaType.APPLICATION_XML_TYPE);
+ e = new AAIException("AAI_3019", "null");
+ } else {
+ mediaTypeList.add(MediaType.valueOf(contentType));
+ e = new AAIException("AAI_3019", contentType);
+ }
+ }
+ message = ErrorLogHelper.getRESTAPIErrorResponse(mediaTypeList, e, templateVars);
+ responseContext.setEntity(message);
+ }
}
-
}