1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.ws.cxf;
17
18 import org.apache.cxf.binding.soap.SoapMessage;
19 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
20 import org.apache.cxf.interceptor.Fault;
21 import org.apache.cxf.message.Exchange;
22 import org.apache.cxf.phase.Phase;
23
24 import static java.util.Objects.requireNonNull;
25
26
27
28
29
30
31
32
33
34
35 public class RejectionHandlerInterceptor extends AbstractSoapInterceptor {
36 private final WsRejectionHandlingStrategy strategy;
37
38 public RejectionHandlerInterceptor(WsRejectionHandlingStrategy strategy) {
39 super(Phase.MARSHAL);
40 requireNonNull(strategy);
41 this.strategy = strategy;
42 }
43
44
45 @Override
46 public void handleMessage(SoapMessage message) throws Fault {
47 Exchange exchange = message.getExchange();
48 if (strategy.isRejected(exchange)) {
49 strategy.handleRejectedExchange(exchange);
50 }
51 }
52 }