1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.apache.chemistry.opencmis.server.impl.webservices;
2021import java.util.Iterator;
2223import org.apache.cxf.binding.soap.SoapMessage;
24import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
25import org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor;
26import org.apache.cxf.interceptor.Interceptor;
27import org.apache.cxf.message.Message;
28import org.apache.cxf.phase.Phase;
2930/**31 * Removes the CXF SOAP Action handling to be backwards compatible with the32 * OpenCMIS server framework 0.13.0 and earlier.33 */34publicclassSoapActionRemoveInterceptorextends AbstractSoapInterceptor {
3536publicSoapActionRemoveInterceptor() {
37super(Phase.READ);
38 addBefore(SoapActionInInterceptor.class.getName());
39 }
4041 @Override
42publicvoid handleMessage(SoapMessage message) {
43 Interceptor<? extends Message> soapActionInInterceptor = null;
44 Iterator<Interceptor<? extends Message>> iterator = message.getInterceptorChain().getIterator();
45while (iterator.hasNext()) {
46 Interceptor<? extends Message> interceptor = iterator.next();
47if (interceptor instanceof SoapActionInInterceptor) {
48 soapActionInInterceptor = interceptor;
49break;
50 }
51 }
5253if (soapActionInInterceptor != null) {
54 message.getInterceptorChain().remove(soapActionInInterceptor);
55 }
56 }
57 }