Skip to content

Commit a8fa7a2

Browse files
Add another unit test to prevent axiom loading with enableJSONOnly=true
1 parent adfd5ad commit a8fa7a2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

modules/kernel/src/org/apache/axis2/kernel/TransportUtils.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.apache.axis2.context.MessageContext;
4242
import org.apache.axis2.context.OperationContext;
4343
import org.apache.axis2.deployment.DeploymentConstants;
44+
import org.apache.axis2.description.AxisService;
4445
import org.apache.axis2.description.Parameter;
4546
import org.apache.axis2.i18n.Messages;
4647
import org.apache.axis2.kernel.http.HTTPConstants;
@@ -508,6 +509,18 @@ public static void deleteAttachments(MessageContext msgContext) {
508509
log.debug("Entering deleteAttachments()");
509510
}
510511

512+
// Check if enableJSONOnly is true - if so, skip attachment cleanup to avoid loading Axiom
513+
AxisService axisService = msgContext.getAxisService();
514+
if (axisService != null) {
515+
String enableJSONOnly = (String) axisService.getParameterValue("enableJSONOnly");
516+
if (enableJSONOnly != null && enableJSONOnly.equalsIgnoreCase("true")) {
517+
if (log.isDebugEnabled()) {
518+
log.debug("Skipping deleteAttachments() due to enableJSONOnly=true");
519+
}
520+
return;
521+
}
522+
}
523+
511524
Attachments attachments = msgContext.getAttachmentMap();
512525

513526
if (attachments != null) {

0 commit comments

Comments
 (0)