Author: ay
Date: Mon Feb 27 15:46:13 2012
New Revision: 1294190
URL: http://svn.apache.org/viewvc?rev=1294190&view=rev
Log:
Merged revisions 1294188 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1294188 | ay | 2012-02-27 16:41:02 +0100 (Mon, 27 Feb 2012) | 1 line
[CXF-4084] Blueprint (part 2 HTTPConduit)
........
Modified:
cxf/branches/2.5.x-fixes/ (props changed)
cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd
cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb 27 15:46:13 2012
@@ -1 +1 @@
-/cxf/trunk:1291943,1292763,1292792,1292839,1293064,1293255,1293326,1293413,1293546
+/cxf/trunk:1291943,1292763,1292792,1292839,1293064,1293255,1293326,1293413,1293546,1294188
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd?rev=1294190&r1=1294189&r2=1294190&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd
(original)
+++
cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd
Mon Feb 27 15:46:13 2012
@@ -24,16 +24,10 @@
attributeFormDefault="unqualified"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:tns="http://cxf.apache.org/configuration/security"
- xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pt="http://cxf.apache.org/configuration/parameterized-types"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd"
jaxb:version="2.0">
- <xs:import namespace="http://www.springframework.org/schema/beans"/>
-
<xs:import
namespace="http://cxf.apache.org/configuration/parameterized-types"
schemaLocation="http://cxf.apache.org/schemas/configuration/parameterized-types.xsd"/>
Modified:
cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java?rev=1294190&r1=1294189&r2=1294190&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java
(original)
+++
cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java
Mon Feb 27 15:46:13 2012
@@ -19,17 +19,25 @@
package org.apache.cxf.transport.http.blueprint;
+import java.io.StringWriter;
+
import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
import org.w3c.dom.Element;
import org.apache.aries.blueprint.ParserContext;
import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.apache.aries.blueprint.mutable.MutablePassThroughMetadata;
import org.apache.cxf.configuration.blueprint.AbstractBPBeanDefinitionParser;
-import org.apache.cxf.configuration.jsse.TLSClientParameters;
+import org.apache.cxf.configuration.jsse.spring.TLSClientParametersConfig;
import org.apache.cxf.configuration.security.AuthorizationPolicy;
import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
+import org.apache.cxf.staxutils.StaxUtils;
import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transport.http.MessageTrustDecider;
+import org.apache.cxf.transport.http.auth.HttpAuthSupplier;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.osgi.service.blueprint.reflect.Metadata;
@@ -50,11 +58,6 @@ public class HttpConduitBPBeanDefinition
mapElementToJaxbProperty(context, bean, element,
new QName(HTTP_NS, "authorization"), "authorization",
AuthorizationPolicy.class);
- mapElementToJaxbProperty(context, bean, element,
- new QName(HTTP_NS, "tlsClientParameters"),
"tlsClientParameters", TLSClientParameters.class);
-
- //TODO handle those bean/ref dual entries (basicAuthSupplier and
trustDecider)
-
parseAttributes(element, context, bean);
parseChildElements(element, context, bean);
@@ -68,4 +71,43 @@ public class HttpConduitBPBeanDefinition
String val) {
bean.setId(val);
}
+
+ @Override
+ protected void mapElement(ParserContext ctx, MutableBeanMetadata bean,
Element el, String name) {
+ if ("tlsClientParameters".equals(name)) {
+ mapTLSClientParameters(ctx, bean, el);
+ } else if ("trustDecider".equals(name)) {
+ mapBeanOrClassElement(ctx, bean, el, MessageTrustDecider.class);
+ } else if ("authSupplier".equals(name)) {
+ mapBeanOrClassElement(ctx, bean, el, HttpAuthSupplier.class);
+ }
+ }
+
+ private void mapTLSClientParameters(ParserContext ctx, MutableBeanMetadata
bean, Element el) {
+ StringWriter writer = new StringWriter();
+ XMLStreamWriter xmlWriter = StaxUtils.createXMLStreamWriter(writer);
+ try {
+ StaxUtils.copy(el, xmlWriter);
+ xmlWriter.flush();
+ } catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ }
+ Object v =
TLSClientParametersConfig.createTLSClientParameters(writer.toString());
+ MutablePassThroughMetadata value =
ctx.createMetadata(MutablePassThroughMetadata.class);
+ value.setObject(v);
+ bean.addProperty("tlsClientParameters", value);
+ }
+
+
+ private void mapBeanOrClassElement(ParserContext ctx, MutableBeanMetadata
bean, Element el,
+ Class<?> cls) {
+ String elementName = el.getLocalName();
+ String classProperty = el.getAttribute("class");
+ String beanref = el.getAttribute("bean");
+ if (classProperty != null && !classProperty.equals("")) {
+ bean.addProperty(elementName, createObjectOfClass(ctx,
classProperty));
+ } else if (beanref != null && !beanref.equals("")) {
+ bean.addProperty(elementName, createRef(ctx, beanref));
+ }
+ }
}