From 8892267d87e89917f05f82edab86691501f8d3fe Mon Sep 17 00:00:00 2001 From: Vrinda Date: Tue, 23 Apr 2024 14:35:38 +0200 Subject: [PATCH] Replace 400 - Bad Request with 413 - Request entity too large error response code for matching RS services #4488 --- .../arc/export/rs/ExportMatchingRS.java | 3 ++- .../dcm4chee/arc/ian/rs/IANSCUMatchingRS.java | 3 ++- .../arc/iocm/rs/ApplyRetentionPolicy.java | 3 ++- .../dcm4chee/arc/iocm/rs/RejectMatchingRS.java | 4 ++-- .../dcm4chee/arc/iocm/rs/UpdateMatchingRS.java | 3 ++- .../iocm/rs/UpdateStudyAccessMatchingRS.java | 3 ++- .../arc/pdq/rs/DiffPatientDemographicsRS.java | 3 ++- .../arc/stgcmt/rs/StgCmtSCUMatchingRS.java | 3 ++- .../arc/stgcmt/rs/StgVerMatchingRS.java | 3 ++- docs/swagger/paths/export.json | 9 +++++++++ docs/swagger/paths/ian.json | 9 +++++++++ docs/swagger/paths/iocm.json | 18 ++++++++++++++++++ docs/swagger/paths/misc.json | 3 +++ docs/swagger/paths/pam.json | 6 +++--- docs/swagger/paths/stgcmt.json | 9 +++++++++ docs/swagger/paths/stgver.json | 9 +++++++++ 16 files changed, 78 insertions(+), 13 deletions(-) diff --git a/dcm4chee-arc-export-rs/src/main/java/org/dcm4chee/arc/export/rs/ExportMatchingRS.java b/dcm4chee-arc-export-rs/src/main/java/org/dcm4chee/arc/export/rs/ExportMatchingRS.java index f98934baaf..535a51633a 100644 --- a/dcm4chee-arc-export-rs/src/main/java/org/dcm4chee/arc/export/rs/ExportMatchingRS.java +++ b/dcm4chee-arc-export-rs/src/main/java/org/dcm4chee/arc/export/rs/ExportMatchingRS.java @@ -291,7 +291,8 @@ private Response exportMatching(String exporterID, String aet, int queryMaxNumberOfResults = ctx.getArchiveAEExtension().queryMaxNumberOfResults(); if (queryMaxNumberOfResults > 0 && !ctx.containsUniqueKey() && query.fetchCount() > queryMaxNumberOfResults) - return errResponse(Response.Status.BAD_REQUEST, "Request entity too large"); + return errResponse(Response.Status.REQUEST_ENTITY_TOO_LARGE, + "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters."); ExportMatchingObjects exportMatchingObjects = new ExportMatchingObjects( exporter, qrlevel, query, scheduledTime(), status); diff --git a/dcm4chee-arc-ian-rs/src/main/java/org/dcm4chee/arc/ian/rs/IANSCUMatchingRS.java b/dcm4chee-arc-ian-rs/src/main/java/org/dcm4chee/arc/ian/rs/IANSCUMatchingRS.java index 85aa485884..2834ca0bcc 100644 --- a/dcm4chee-arc-ian-rs/src/main/java/org/dcm4chee/arc/ian/rs/IANSCUMatchingRS.java +++ b/dcm4chee-arc-ian-rs/src/main/java/org/dcm4chee/arc/ian/rs/IANSCUMatchingRS.java @@ -274,7 +274,8 @@ Response ianMatching(String aet, String ianscp, String method, QueryRetrieveLeve int queryMaxNumberOfResults = ctx.getArchiveAEExtension().queryMaxNumberOfResults(); if (queryMaxNumberOfResults > 0 && !ctx.containsUniqueKey() && query.fetchCount() > queryMaxNumberOfResults) - return errResponse("Request entity too large", Response.Status.BAD_REQUEST); + return errResponse("Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters.", + Response.Status.REQUEST_ENTITY_TOO_LARGE); IANSCUMatchingObjects ianSCUMatchingObjects = new IANSCUMatchingObjects(ae, ianscp, query, status); runInTx.execute(ianSCUMatchingObjects); diff --git a/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/ApplyRetentionPolicy.java b/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/ApplyRetentionPolicy.java index bb032eade8..83a9cc519f 100644 --- a/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/ApplyRetentionPolicy.java +++ b/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/ApplyRetentionPolicy.java @@ -162,7 +162,8 @@ public Response applyRetentionPolicy() { int queryMaxNumberOfResults = arcAE.queryMaxNumberOfResults(); if (queryMaxNumberOfResults > 0 && !ctx.containsUniqueKey() && query.fetchCount() > queryMaxNumberOfResults) - return errResponse("Request entity too large", Response.Status.BAD_REQUEST); + return errResponse("Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters.", + Response.Status.REQUEST_ENTITY_TOO_LARGE); ExpireSeries es = new ExpireSeries(ae, query); runInTx.execute(es); diff --git a/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/RejectMatchingRS.java b/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/RejectMatchingRS.java index 431fc6891e..106e4fa091 100644 --- a/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/RejectMatchingRS.java +++ b/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/RejectMatchingRS.java @@ -52,7 +52,6 @@ import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; -import org.dcm4che3.conf.api.ConfigurationException; import org.dcm4che3.data.*; import org.dcm4che3.net.ApplicationEntity; import org.dcm4che3.net.Device; @@ -340,7 +339,8 @@ Response rejectMatching(String aet, String codeValue, String designator, int queryMaxNumberOfResults = ctx.getArchiveAEExtension().queryMaxNumberOfResults(); if (queryMaxNumberOfResults > 0 && !ctx.containsUniqueKey() && query.fetchCount() > queryMaxNumberOfResults) - return errResponse("Request entity too large", Response.Status.BAD_REQUEST); + return errResponse("Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters.", + Response.Status.REQUEST_ENTITY_TOO_LARGE); RejectMatchingObjects rejectMatchingObjects = new RejectMatchingObjects( aet, rjNoteCode, qrlevel, query, status); diff --git a/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/UpdateMatchingRS.java b/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/UpdateMatchingRS.java index a3aeb8abec..84cf6dc1a7 100644 --- a/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/UpdateMatchingRS.java +++ b/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/UpdateMatchingRS.java @@ -278,7 +278,8 @@ Response updateMatching(String aet, String method, QueryRetrieveLevel2 qrlevel, int queryMaxNumberOfResults = ctx.getArchiveAEExtension().queryMaxNumberOfResults(); if (queryMaxNumberOfResults > 0 && !ctx.containsUniqueKey() && query.fetchCount() > queryMaxNumberOfResults) - return errResponse("Request entity too large", Response.Status.BAD_REQUEST); + return errResponse("Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters.", + Response.Status.REQUEST_ENTITY_TOO_LARGE); UpdateMatchingEntities updateMatchingObjects = new UpdateMatchingEntities(aet, attrs, qrlevel, studyMgtCtx, query); diff --git a/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/UpdateStudyAccessMatchingRS.java b/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/UpdateStudyAccessMatchingRS.java index 77cccbb7bc..fe18b5cfc1 100644 --- a/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/UpdateStudyAccessMatchingRS.java +++ b/dcm4chee-arc-iocm-rs/src/main/java/org/dcm4chee/arc/iocm/rs/UpdateStudyAccessMatchingRS.java @@ -202,7 +202,8 @@ public Response updateStudyAccessControlID( int queryMaxNumberOfResults = qCtx.getArchiveAEExtension().queryMaxNumberOfResults(); if (queryMaxNumberOfResults > 0 && !qCtx.containsUniqueKey() && query.fetchCount() > queryMaxNumberOfResults) - return errResponse("Request entity too large", Response.Status.BAD_REQUEST); + return errResponse("Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters.", + Response.Status.REQUEST_ENTITY_TOO_LARGE); UpdateStudyAccess updateStudyAccess = new UpdateStudyAccess(ae, query, accessControlID1); runInTx.execute(updateStudyAccess); diff --git a/dcm4chee-arc-pdq-rs/src/main/java/org/dcm4chee/arc/pdq/rs/DiffPatientDemographicsRS.java b/dcm4chee-arc-pdq-rs/src/main/java/org/dcm4chee/arc/pdq/rs/DiffPatientDemographicsRS.java index 602ac5a109..bf74b27736 100644 --- a/dcm4chee-arc-pdq-rs/src/main/java/org/dcm4chee/arc/pdq/rs/DiffPatientDemographicsRS.java +++ b/dcm4chee-arc-pdq-rs/src/main/java/org/dcm4chee/arc/pdq/rs/DiffPatientDemographicsRS.java @@ -192,7 +192,8 @@ public Response comparePatients() { int queryMaxNumberOfResults = ctx.getArchiveAEExtension().queryMaxNumberOfResults(); if (queryMaxNumberOfResults > 0 && !ctx.containsUniqueKey() && query.fetchCount() > queryMaxNumberOfResults) - return errResponse("Request entity too large", Response.Status.BAD_REQUEST); + return errResponse("Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters.", + Response.Status.REQUEST_ENTITY_TOO_LARGE); DiffPatientDemographics diffPatientDemographics = new DiffPatientDemographics(query, descriptor); runInTx.execute(diffPatientDemographics); diff --git a/dcm4chee-arc-stgcmt-rs/src/main/java/org/dcm4chee/arc/stgcmt/rs/StgCmtSCUMatchingRS.java b/dcm4chee-arc-stgcmt-rs/src/main/java/org/dcm4chee/arc/stgcmt/rs/StgCmtSCUMatchingRS.java index 59028801d2..2f079a4fca 100644 --- a/dcm4chee-arc-stgcmt-rs/src/main/java/org/dcm4chee/arc/stgcmt/rs/StgCmtSCUMatchingRS.java +++ b/dcm4chee-arc-stgcmt-rs/src/main/java/org/dcm4chee/arc/stgcmt/rs/StgCmtSCUMatchingRS.java @@ -274,7 +274,8 @@ Response storageCommitMatching(String aet, String stgcmtscp, String method, Quer int queryMaxNumberOfResults = ctx.getArchiveAEExtension().queryMaxNumberOfResults(); if (queryMaxNumberOfResults > 0 && !ctx.containsUniqueKey() && query.fetchCount() > queryMaxNumberOfResults) - return errResponse("Request entity too large", Response.Status.BAD_REQUEST); + return errResponse("Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters.", + Response.Status.REQUEST_ENTITY_TOO_LARGE); StgCmtSCUMatchingObjects stgCmtSCUMatchingObjects = new StgCmtSCUMatchingObjects( aet, stgcmtscp, qrlevel, query, status); diff --git a/dcm4chee-arc-stgcmt-rs/src/main/java/org/dcm4chee/arc/stgcmt/rs/StgVerMatchingRS.java b/dcm4chee-arc-stgcmt-rs/src/main/java/org/dcm4chee/arc/stgcmt/rs/StgVerMatchingRS.java index 1cafb0ac53..ac0d8c7287 100644 --- a/dcm4chee-arc-stgcmt-rs/src/main/java/org/dcm4chee/arc/stgcmt/rs/StgVerMatchingRS.java +++ b/dcm4chee-arc-stgcmt-rs/src/main/java/org/dcm4chee/arc/stgcmt/rs/StgVerMatchingRS.java @@ -293,7 +293,8 @@ Response verifyStorageOf(String aet, int queryMaxNumberOfResults = ctx.getArchiveAEExtension().queryMaxNumberOfResults(); if (queryMaxNumberOfResults > 0 && !ctx.containsUniqueKey() && query.fetchCount() > queryMaxNumberOfResults) - return errResponse(Response.Status.BAD_REQUEST, "Request entity too large"); + return errResponse(Response.Status.REQUEST_ENTITY_TOO_LARGE, + "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters."); StgVerMatchingObjects stgVerMatchingObjects = new StgVerMatchingObjects(aet, qrlevel, query, status); runInTx.execute(stgVerMatchingObjects); diff --git a/docs/swagger/paths/export.json b/docs/swagger/paths/export.json index 24633bc599..d87270cc77 100644 --- a/docs/swagger/paths/export.json +++ b/docs/swagger/paths/export.json @@ -276,6 +276,9 @@ "404": { "description": "No such Archive AE Title or Exporter or Exporter configuration does not consist of IAN Destinations or Storage Commitment SCPs" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error." } @@ -491,6 +494,9 @@ "404": { "description": "No such Archive AE Title or Exporter or Exporter configuration does not consist of IAN Destinations or Storage Commitment SCPs" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error." } @@ -818,6 +824,9 @@ "404": { "description": "No such Archive AE Title or Exporter or Exporter configuration does not consist of IAN Destinations or Storage Commitment SCPs" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error." } diff --git a/docs/swagger/paths/ian.json b/docs/swagger/paths/ian.json index 62fbd4eb71..682aeae8ab 100644 --- a/docs/swagger/paths/ian.json +++ b/docs/swagger/paths/ian.json @@ -249,6 +249,9 @@ "404": { "description": "No such Archive AE Title or Instance Availability Notification SCP AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -458,6 +461,9 @@ "404": { "description": "No such Archive AE Title or Instance Availability Notification SCP AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -776,6 +782,9 @@ "404": { "description": "No such Archive AE Title or Instance Availability Notification SCP AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } diff --git a/docs/swagger/paths/iocm.json b/docs/swagger/paths/iocm.json index 3cdf882928..ae37a7fa85 100644 --- a/docs/swagger/paths/iocm.json +++ b/docs/swagger/paths/iocm.json @@ -111,6 +111,9 @@ "409": { "$ref": "../responses.json#/updateMatchingFailed" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -350,6 +353,9 @@ "409": { "$ref": "../responses.json#/updateMatchingFailed" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -719,6 +725,9 @@ "404": { "description": "No such Archive AE Title or Rejection Note" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -940,6 +949,9 @@ "404": { "description": "No such Archive AE Title or Rejection Note" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -1276,6 +1288,9 @@ "404": { "description": "No such Archive AE Title or Rejection Note" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -1717,6 +1732,9 @@ "404": { "description": "No such Archive AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } diff --git a/docs/swagger/paths/misc.json b/docs/swagger/paths/misc.json index 6335f1a57e..566d23d4ea 100644 --- a/docs/swagger/paths/misc.json +++ b/docs/swagger/paths/misc.json @@ -469,6 +469,9 @@ "404": { "description": "No such Archive AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error." } diff --git a/docs/swagger/paths/pam.json b/docs/swagger/paths/pam.json index 392b9b9f6c..c0628024fe 100644 --- a/docs/swagger/paths/pam.json +++ b/docs/swagger/paths/pam.json @@ -533,12 +533,12 @@ "204": { "description": "No matching Patient found at Archive AE" }, - "400": { - "description": "Request entity too large" - }, "404": { "description": "AE Title of Archive or PDQ Service not found" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } diff --git a/docs/swagger/paths/stgcmt.json b/docs/swagger/paths/stgcmt.json index 08dd228872..6e2e94b6e8 100644 --- a/docs/swagger/paths/stgcmt.json +++ b/docs/swagger/paths/stgcmt.json @@ -347,6 +347,9 @@ "404": { "description": "No such Archive AE Title or Storage Commitment SCP AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -556,6 +559,9 @@ "404": { "description": "No such Archive AE Title or Storage Commitment SCP AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -874,6 +880,9 @@ "404": { "description": "No such Archive AE Title or Storage Commitment SCP AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } diff --git a/docs/swagger/paths/stgver.json b/docs/swagger/paths/stgver.json index 850b21c2a7..0b42ae23f9 100644 --- a/docs/swagger/paths/stgver.json +++ b/docs/swagger/paths/stgver.json @@ -296,6 +296,9 @@ "404": { "description": "No such Archive AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -505,6 +508,9 @@ "404": { "description": "No such Archive AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" } @@ -823,6 +829,9 @@ "404": { "description": "No such Archive AE Title" }, + "413": { + "description": "Request entity too large. Query count exceeds configured Query Max Number of Results, narrow down search using query filters." + }, "500": { "description": "Internal Server Error" }