diff --git a/phase4-lib/src/main/java/com/helger/phase4/incoming/AS4RequestHandler.java b/phase4-lib/src/main/java/com/helger/phase4/incoming/AS4RequestHandler.java index c09822af5..f78f558b6 100644 --- a/phase4-lib/src/main/java/com/helger/phase4/incoming/AS4RequestHandler.java +++ b/phase4-lib/src/main/java/com/helger/phase4/incoming/AS4RequestHandler.java @@ -109,7 +109,6 @@ import com.helger.phase4.util.AS4ResourceHelper; import com.helger.phase4.util.AS4XMLHelper; import com.helger.phase4.util.Phase4Exception; -import com.helger.phase4.v3.ChangePhase4V3; import com.helger.photon.io.PhotonWorkerPool; import com.helger.xml.serialize.write.XMLWriter; @@ -272,11 +271,15 @@ public void applyToResponse (@Nonnull final IAS4ResponseAbstraction aHttpRespons if (aDumpOS != null) try { - StreamHelper.copyInputStreamToOutputStream (aContent.getBufferedInputStream (), aDumpOS); + StreamHelper.copyByteStream () + .from (aContent.getBufferedInputStream ()) + .closeFrom (true) + .to (aDumpOS) + .closeTo (true) + .build (); } finally { - StreamHelper.close (aDumpOS); aOutgoingDumper.onEndRequest (EAS4MessageMode.RESPONSE, m_aIncomingMessageMetadata, m_aIncomingState, @@ -292,25 +295,6 @@ public void applyToResponse (@Nonnull final IAS4ResponseAbstraction aHttpRespons } } - /** - * Callback interface to indicate finalization of async processing. - * - * @author Philip Helger - * @since 0.13.1 - */ - @ChangePhase4V3 ("Rename") - public interface ISoapProcessingFinalizedCallback - { - /** - * Indicate that processing has finished. - * - * @param bWasSynchronous - * true if it was synchronous, false if it - * was asynchronous. - */ - void onProcessingFinalized (boolean bWasSynchronous); - } - private static final class SPIInvocationResult implements ISuccessIndicator { private boolean m_bSuccess = false; @@ -376,7 +360,7 @@ public boolean hasAsyncResponseURL () private IAS4IncomingDumper m_aIncomingDumper; private IAS4OutgoingDumper m_aOutgoingDumper; private IAS4RetryCallback m_aRetryCallback; - private ISoapProcessingFinalizedCallback m_aSoapProcessingFinalizedCB; + private IAS4SoapProcessingFinalizedCallback m_aSoapProcessingFinalizedCB; /** By default get all message processors from the global SPI registry */ private Supplier > m_aProcessorSupplier = AS4IncomingMessageProcessorManager::getAllProcessors; @@ -722,7 +706,7 @@ public final AS4RequestHandler setRetryCallback (@Nullable final IAS4RetryCallba * @since 0.13.1 */ @Nullable - public final ISoapProcessingFinalizedCallback getSoapProcessingFinalizedCallback () + public final IAS4SoapProcessingFinalizedCallback getSoapProcessingFinalizedCallback () { return m_aSoapProcessingFinalizedCB; } @@ -740,7 +724,7 @@ public final ISoapProcessingFinalizedCallback getSoapProcessingFinalizedCallback * @since 0.13.1 */ @Nonnull - public final AS4RequestHandler setSoapProcessingFinalizedCallback (@Nullable final ISoapProcessingFinalizedCallback aSoapProcessingFinalizedCB) + public final AS4RequestHandler setSoapProcessingFinalizedCallback (@Nullable final IAS4SoapProcessingFinalizedCallback aSoapProcessingFinalizedCB) { m_aSoapProcessingFinalizedCB = aSoapProcessingFinalizedCB; return this; diff --git a/phase4-lib/src/main/java/com/helger/phase4/incoming/IAS4SoapProcessingFinalizedCallback.java b/phase4-lib/src/main/java/com/helger/phase4/incoming/IAS4SoapProcessingFinalizedCallback.java new file mode 100644 index 000000000..4bd67fab2 --- /dev/null +++ b/phase4-lib/src/main/java/com/helger/phase4/incoming/IAS4SoapProcessingFinalizedCallback.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2015-2024 Philip Helger (www.helger.com) + * philip[at]helger[dot]com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.helger.phase4.incoming; + +/** + * Callback interface to indicate finalization of async processing. + * + * @author Philip Helger + * @since 0.13.1 + */ +public interface IAS4SoapProcessingFinalizedCallback +{ + /** + * Indicate that processing has finished. + * + * @param bWasSynchronous + * true if it was synchronous, false if it + * was asynchronous. + */ + void onProcessingFinalized (boolean bWasSynchronous); +} \ No newline at end of file