diff options
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/EmptyOutputOutInterceptor.java')
-rw-r--r-- | openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/EmptyOutputOutInterceptor.java | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/EmptyOutputOutInterceptor.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/EmptyOutputOutInterceptor.java index 440354318d..b8548806fe 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/EmptyOutputOutInterceptor.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/EmptyOutputOutInterceptor.java @@ -15,48 +15,44 @@ */ package org.openecomp.server.interceptors; +import javax.inject.Named; +import javax.ws.rs.core.Response; import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageContentsList; import org.apache.cxf.phase.Phase; -import javax.inject.Named; -import javax.ws.rs.core.Response; - - /** * The type Empty output out interceptor. */ @Named public class EmptyOutputOutInterceptor extends AbstractOutDatabindingInterceptor { - public EmptyOutputOutInterceptor() { - // To be executed in post logical phase before marshal phase - super(Phase.POST_LOGICAL); - } + public EmptyOutputOutInterceptor() { + // To be executed in post logical phase before marshal phase + super(Phase.POST_LOGICAL); + } - /** - * Intercepts a message. - * Interceptors should NOT invoke handleMessage or handleFault - * on the next interceptor - the interceptor chain will - * take care of this. - * - * @param message input message. - */ - @Override - public void handleMessage(Message message) { - //get the message - MessageContentsList objs = MessageContentsList.getContentsList(message); - if (objs.get(0) instanceof Response) { - //check if response is present but entity inside it is null the set a default entity - int status = ((Response) objs.get(0)).getStatus(); - Object entity = ((Response) objs.get(0)).getEntity(); - // in case of staus 200 and entity is null send InternalEmptyObject in output. - if (entity == null && status == 200) { - DefaultOutput defaultOutput = new DefaultOutput(status, new InternalEmptyObject()); - defaultOutput.addMetadata(((Response) objs.get(0)).getMetadata()); - objs.set(0, defaultOutput); - } + /** + * Intercepts a message. Interceptors should NOT invoke handleMessage or handleFault on the next interceptor - the interceptor chain will take + * care of this. + * + * @param message input message. + */ + @Override + public void handleMessage(Message message) { + //get the message + MessageContentsList objs = MessageContentsList.getContentsList(message); + if (objs.get(0) instanceof Response) { + //check if response is present but entity inside it is null the set a default entity + int status = ((Response) objs.get(0)).getStatus(); + Object entity = ((Response) objs.get(0)).getEntity(); + // in case of staus 200 and entity is null send InternalEmptyObject in output. + if (entity == null && status == 200) { + DefaultOutput defaultOutput = new DefaultOutput(status, new InternalEmptyObject()); + defaultOutput.addMetadata(((Response) objs.get(0)).getMetadata()); + objs.set(0, defaultOutput); + } + } } - } } |