Author: dkulp
Date: Tue Oct 20 15:57:42 2009
New Revision: 827714
URL: http://svn.apache.org/viewvc?rev=827714&view=rev
Log:
Merged revisions 827711 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r827711 | dkulp | 2009-10-20 11:54:16 -0400 (Tue, 20 Oct 2009) | 1 line
[CXF-2484] Update STSClient to allow interceptors/features to be configured
on it
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
cxf/branches/2.2.x-fixes/systests/uncategorized/pom.xml
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
svn:mergeinfo = /cxf/trunk:827711
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=827714&r1=827713&r2=827714&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
Tue Oct 20 15:57:42 2009
@@ -52,6 +52,7 @@
import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ModCountCopyOnWriteArrayList;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.configuration.Configurable;
import org.apache.cxf.configuration.Configurer;
@@ -61,9 +62,12 @@
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.EndpointException;
import org.apache.cxf.endpoint.EndpointImpl;
+import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.InterceptorProvider;
import org.apache.cxf.resource.ResourceManager;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.BindingInfo;
@@ -112,9 +116,9 @@
/**
*
*/
-public class STSClient implements Configurable {
+public class STSClient implements Configurable, InterceptorProvider {
private static final Logger LOG = LogUtils.getL7dLogger(STSClient.class);
-
+
Bus bus;
String name = "default.sts-client";
Client client;
@@ -137,6 +141,12 @@
int ttl = 300;
Map<String, Object> ctx = new HashMap<String, Object>();
+
+ List<Interceptor> in = new ModCountCopyOnWriteArrayList<Interceptor>();
+ List<Interceptor> out = new ModCountCopyOnWriteArrayList<Interceptor>();
+ List<Interceptor> outFault = new
ModCountCopyOnWriteArrayList<Interceptor>();
+ List<Interceptor> inFault = new
ModCountCopyOnWriteArrayList<Interceptor>();
+ List<AbstractFeature> features;
public STSClient(Bus b) {
bus = b;
@@ -281,6 +291,20 @@
client = new ClientImpl(bus, endpoint);
}
+
+ client.getInFaultInterceptors().addAll(inFault);
+ client.getInInterceptors().addAll(in);
+ client.getOutInterceptors().addAll(out);
+ client.getOutFaultInterceptors().addAll(outFault);
+ in = null;
+ out = null;
+ inFault = null;
+ outFault = null;
+ if (features != null) {
+ for (AbstractFeature f : features) {
+ f.initialize(client, bus);
+ }
+ }
}
private BindingOperationInfo findOperation(String suffix) {
@@ -865,5 +889,55 @@
public void setTemplate(Element rstTemplate) {
template = rstTemplate;
}
+
+ public List<Interceptor> getOutFaultInterceptors() {
+ if (client != null) {
+ return client.getOutFaultInterceptors();
+ }
+ return outFault;
+ }
+
+ public List<Interceptor> getInFaultInterceptors() {
+ if (client != null) {
+ return client.getInFaultInterceptors();
+ }
+ return inFault;
+ }
+
+ public List<Interceptor> getInInterceptors() {
+ if (client != null) {
+ return client.getInInterceptors();
+ }
+ return in;
+ }
+
+ public List<Interceptor> getOutInterceptors() {
+ if (client != null) {
+ return client.getOutInterceptors();
+ }
+ return out;
+ }
+
+ public void setInInterceptors(List<Interceptor> interceptors) {
+ getInInterceptors().addAll(interceptors);
+ }
+ public void setInFaultInterceptors(List<Interceptor> interceptors) {
+ getInFaultInterceptors().addAll(interceptors);
+ }
+
+ public void setOutInterceptors(List<Interceptor> interceptors) {
+ getOutInterceptors().addAll(interceptors);
+ }
+
+ public void setOutFaultInterceptors(List<Interceptor> interceptors) {
+ getOutFaultInterceptors().addAll(interceptors);
+ }
+
+ public void setFeatures(List<AbstractFeature> f) {
+ features = f;
+ }
+ public List<AbstractFeature> getFeatures() {
+ return features;
+ }
}
Modified: cxf/branches/2.2.x-fixes/systests/uncategorized/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/uncategorized/pom.xml?rev=827714&r1=827713&r2=827714&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/uncategorized/pom.xml (original)
+++ cxf/branches/2.2.x-fixes/systests/uncategorized/pom.xml Tue Oct 20 15:57:42
2009
@@ -231,11 +231,11 @@
<artifactId>cxf-rt-ws-policy</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>