You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/02/19 17:55:28 UTC
svn commit: r911866 -
/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
Author: dkulp
Date: Fri Feb 19 16:55:27 2010
New Revision: 911866
URL: http://svn.apache.org/viewvc?rev=911866&view=rev
Log:
Update jaxws endpoint so after publish, adding interceptors will push
the added interceptors into the right place so they take affect.
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?rev=911866&r1=911865&r2=911866&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java Fri Feb 19 16:55:27 2010
@@ -21,8 +21,11 @@
import java.security.AccessController;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.logging.Logger;
@@ -350,17 +353,17 @@
server = serverFactory.create();
org.apache.cxf.endpoint.Endpoint endpoint = getEndpoint();
- if (getInInterceptors() != null) {
- endpoint.getInInterceptors().addAll(getInInterceptors());
+ if (in != null) {
+ endpoint.getInInterceptors().addAll(in);
}
- if (getOutInterceptors() != null) {
- endpoint.getOutInterceptors().addAll(getOutInterceptors());
+ if (out != null) {
+ endpoint.getOutInterceptors().addAll(out);
}
- if (getInFaultInterceptors() != null) {
- endpoint.getInFaultInterceptors().addAll(getInFaultInterceptors());
+ if (inFault != null) {
+ endpoint.getInFaultInterceptors().addAll(inFault);
}
- if (getOutFaultInterceptors() != null) {
- endpoint.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
+ if (outFault != null) {
+ endpoint.getOutFaultInterceptors().addAll(outFault);
}
if (properties != null) {
@@ -475,19 +478,125 @@
}
public List<Interceptor<? extends Message>> getOutFaultInterceptors() {
- return outFault;
+ if (server == null) {
+ return outFault;
+ }
+ return new DoubleAddInterceptorList(outFault, server.getEndpoint().getOutFaultInterceptors());
}
public List<Interceptor<? extends Message>> getInFaultInterceptors() {
- return inFault;
+ if (server == null) {
+ return inFault;
+ }
+ return new DoubleAddInterceptorList(inFault, server.getEndpoint().getInFaultInterceptors());
}
public List<Interceptor<? extends Message>> getInInterceptors() {
- return in;
+ if (server == null) {
+ return in;
+ }
+ return new DoubleAddInterceptorList(in, server.getEndpoint().getInInterceptors());
}
public List<Interceptor<? extends Message>> getOutInterceptors() {
- return out;
+ if (server == null) {
+ return out;
+ }
+ return new DoubleAddInterceptorList(out, server.getEndpoint().getOutInterceptors());
+ }
+
+ class DoubleAddInterceptorList implements List<Interceptor<? extends Message>> {
+ List<Interceptor<? extends Message>> orig;
+ List<Interceptor<? extends Message>> other;
+ public DoubleAddInterceptorList(List<Interceptor<? extends Message>> a1,
+ List<Interceptor<? extends Message>> a2) {
+ orig = a1;
+ other = a2;
+ }
+ public boolean add(Interceptor<? extends Message> e) {
+ other.add(e);
+ return orig.add(e);
+ }
+ public void add(int index, Interceptor<? extends Message> element) {
+ other.add(element);
+ orig.add(index, element);
+ }
+ public boolean addAll(Collection<? extends Interceptor<? extends Message>> c) {
+ other.addAll(c);
+ return orig.addAll(c);
+ }
+ public boolean addAll(int index, Collection<? extends Interceptor<? extends Message>> c) {
+ other.addAll(c);
+ return orig.addAll(index, c);
+ }
+ public void clear() {
+ orig.clear();
+ }
+ public boolean contains(Object o) {
+ return orig.contains(o);
+ }
+ public boolean containsAll(Collection<?> c) {
+ return orig.containsAll(c);
+ }
+ public Interceptor<? extends Message> get(int index) {
+ return orig.get(index);
+ }
+ public int indexOf(Object o) {
+ return orig.indexOf(o);
+ }
+ public boolean isEmpty() {
+ return orig.isEmpty();
+ }
+ public Iterator<Interceptor<? extends Message>> iterator() {
+ return orig.iterator();
+ }
+ public int lastIndexOf(Object o) {
+ return orig.lastIndexOf(o);
+ }
+ public ListIterator<Interceptor<? extends Message>> listIterator() {
+ return orig.listIterator();
+ }
+ public ListIterator<Interceptor<? extends Message>> listIterator(int index) {
+ return orig.listIterator(index);
+ }
+ public boolean remove(Object o) {
+ other.remove(o);
+ return orig.remove(o);
+ }
+ public Interceptor<? extends Message> remove(int index) {
+ Interceptor<? extends Message> o = orig.remove(index);
+ if (o == null) {
+ other.remove(o);
+ }
+ return o;
+ }
+ public boolean removeAll(Collection<?> c) {
+ other.removeAll(c);
+ return orig.removeAll(c);
+ }
+ public boolean retainAll(Collection<?> c) {
+ throw new UnsupportedOperationException();
+ }
+ public Interceptor<? extends Message> set(int index, Interceptor<? extends Message> element) {
+ Interceptor<? extends Message> o = orig.set(index, element);
+ if (o != null) {
+ int idx = other.indexOf(o);
+ other.set(idx, element);
+ }
+ return o;
+ }
+ public int size() {
+ return orig.size();
+ }
+ public List<Interceptor<? extends Message>> subList(int fromIndex, int toIndex) {
+ return orig.subList(fromIndex, toIndex);
+ }
+ public Object[] toArray() {
+ return orig.toArray();
+ }
+ public <T> T[] toArray(T[] a) {
+ return orig.toArray(a);
+ }
}
public void setInInterceptors(List<Interceptor<? extends Message>> interceptors) {