From d9fa32981c756b10d9dbf72dfcc34e48638b0e3b Mon Sep 17 00:00:00 2001 From: FrodeBjerkholt Date: Wed, 29 Jan 2020 09:28:07 +0100 Subject: [PATCH] Fix for Tomcat. --- pom.xml | 2 +- .../oxalis/as4/common/As4CommonModule.java | 29 +++++++++++++++++++ .../as4/outbound/As4OutboundModule.java | 29 ------------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index b10be13..2bb284f 100755 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ oxalis-as4 - 4.1.0 + 4.1.1 jar diff --git a/src/main/java/no/difi/oxalis/as4/common/As4CommonModule.java b/src/main/java/no/difi/oxalis/as4/common/As4CommonModule.java index 432f3da..ff0c86f 100644 --- a/src/main/java/no/difi/oxalis/as4/common/As4CommonModule.java +++ b/src/main/java/no/difi/oxalis/as4/common/As4CommonModule.java @@ -31,8 +31,10 @@ import no.difi.oxalis.as4.api.MessageIdGenerator; import no.difi.oxalis.as4.config.As4Conf; import no.difi.oxalis.as4.outbound.ActionProvider; +import no.difi.oxalis.as4.outbound.DefaultActionProvider; import no.difi.oxalis.as4.util.As4MessageFactory; import no.difi.oxalis.as4.util.PolicyService; +import no.difi.oxalis.as4.util.TransmissionRequestUtil; import no.difi.oxalis.commons.guice.ImplLoader; import no.difi.oxalis.commons.guice.OxalisModule; import no.difi.vefa.peppol.mode.Mode; @@ -98,4 +100,31 @@ protected String getDefaultPolicy() { return new PolicyService(actionProvider); } + + @Provides + @Singleton + public ActionProvider getActionProvider(Settings settings) { + String type = settings.getString(As4Conf.TYPE); + if (CEF_CONNECTIVITY.equalsIgnoreCase(type)) { + return p -> { + String action = TransmissionRequestUtil.translateDocumentTypeToAction(p); + + if (action.startsWith("connectivity::cef##connectivity::")) { + return action.replaceFirst("connectivity::cef##connectivity::", ""); + } + + return action; + }; + } else if (CEF_CONFORMANCE.equalsIgnoreCase(type)) { + return p -> { + if ("http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/test".equals(p.getIdentifier())) { + return "http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/test"; + } + + return TransmissionRequestUtil.translateDocumentTypeToAction(p); + }; + } + + return new DefaultActionProvider(); + } } \ No newline at end of file diff --git a/src/main/java/no/difi/oxalis/as4/outbound/As4OutboundModule.java b/src/main/java/no/difi/oxalis/as4/outbound/As4OutboundModule.java index 8559ede..6129084 100644 --- a/src/main/java/no/difi/oxalis/as4/outbound/As4OutboundModule.java +++ b/src/main/java/no/difi/oxalis/as4/outbound/As4OutboundModule.java @@ -9,7 +9,6 @@ import no.difi.oxalis.as4.util.CompressionUtil; import no.difi.oxalis.as4.util.OxalisAlgorithmSuiteLoader; import no.difi.oxalis.as4.util.PeppolConfiguration; -import no.difi.oxalis.as4.util.TransmissionRequestUtil; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.bouncycastle.jce.provider.BouncyCastleProvider; @@ -18,7 +17,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static no.difi.oxalis.as4.common.AS4Constants.CEF_CONFORMANCE; import static no.difi.oxalis.as4.common.AS4Constants.CEF_CONNECTIVITY; @Slf4j @@ -75,31 +73,4 @@ public String getAgreementRef() { return new PeppolConfiguration(); } - - @Provides - @Singleton - public ActionProvider getActionProvider(Settings settings) { - String type = settings.getString(As4Conf.TYPE); - if (CEF_CONNECTIVITY.equalsIgnoreCase(type)) { - return p -> { - String action = TransmissionRequestUtil.translateDocumentTypeToAction(p); - - if (action.startsWith("connectivity::cef##connectivity::")) { - return action.replaceFirst("connectivity::cef##connectivity::", ""); - } - - return action; - }; - } else if (CEF_CONFORMANCE.equalsIgnoreCase(type)) { - return p -> { - if ("http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/test".equals(p.getIdentifier())) { - return "http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/test"; - } - - return TransmissionRequestUtil.translateDocumentTypeToAction(p); - }; - } - - return new DefaultActionProvider(); - } }