diff options
author | Pavel Paroulek <pavel.paroulek@orange.com> | 2018-10-25 20:35:00 +0200 |
---|---|---|
committer | Pavel Paroulek <pavel.paroulek@orange.com> | 2018-10-25 20:35:00 +0200 |
commit | 530f8ee2e901e36e27b481c9319f0551ceaae5a0 (patch) | |
tree | e59c9978488a5364fcb4f553f3d9c91d8f7e6f85 | |
parent | 0c675e5f7853dccfc795c74be6cc7cc873f9ad19 (diff) |
Check if response not sent
Check if someone else didn't already flush the response
Change-Id: Id4230baaffcf80e388283f1d5b3ea4be4c011e2a
Issue-ID: AAI-1762
Signed-off-by: Pavel Paroulek <pavel.paroulek@orange.com>
-rw-r--r-- | aai-traversal/src/main/java/org/onap/aai/config/aaf/ResponseFormatter.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/aai-traversal/src/main/java/org/onap/aai/config/aaf/ResponseFormatter.java b/aai-traversal/src/main/java/org/onap/aai/config/aaf/ResponseFormatter.java index 1b932e6..0fc64bc 100644 --- a/aai-traversal/src/main/java/org/onap/aai/config/aaf/ResponseFormatter.java +++ b/aai-traversal/src/main/java/org/onap/aai/config/aaf/ResponseFormatter.java @@ -34,6 +34,10 @@ class ResponseFormatter { private static final String ACCEPT_HEADER = "accept"; static void errorResponse(HttpServletRequest request, HttpServletResponse response) throws IOException { + if (response.isCommitted()){ + return; + } + String accept = request.getHeader(ACCEPT_HEADER) == null ? MediaType.APPLICATION_XML : request.getHeader(ACCEPT_HEADER); AAIException aaie = new AAIException("AAI_3300"); response.setStatus(aaie.getErrorObject().getHTTPResponseCode().getStatusCode()); |