geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarek Gawor <jga...@gmail.com>
Subject Re: svn commit: r794318 - in /geronimo/server/trunk/plugins: cxf/geronimo-cxf/ cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/ j2ee/geronimo-naming-builder/src/main/xsd/ jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/ja
Date Thu, 16 Jul 2009 16:22:57 GMT
Yes. I'll fix that in a minute or two. Thanks.

Jarek

On Thu, Jul 16, 2009 at 12:07 PM, David Jencks<david_jencks@yahoo.com> wrote:
> Is it possible that this change causes this NPE?
>
>        at
> org..apache..geronimo..jaxws..builder.EndpointInfoBuilder.getProperties(EndpointInfoBuilder.java:282)
>        at
> org..apache..geronimo..jaxws.builder.EndpointInfoBuilder.build(EndpointInfoBuilder.java:246)
>        at
> org..apache..geronimo..axis2..builder..Axis2ServiceRefBuilder.createService(Axis2ServiceRefBuilder.java:66)
>        at
> org..apache..geronimo..jaxws..builder..JAXWSServiceRefBuilder.buildNaming(JAXWSServiceRefBuilder.java:164)
>        at
> org..apache..geronimo..jaxws..builder..JAXWSServiceRefBuilder.buildNaming(JAXWSServiceRefBuilder.java:103)
>        at
> org..apache..geronimo..naming..deployment..SwitchingServiceRefBuilder..buildNaming(SwitchingServiceRefBuilder.java:133)
>        at
> org..apache..geronimo..j2ee..deployment..NamingBuilderCollection.buildNaming(NamingBuilderCollection.java:69)
>        at
> org..apache..geronimo..web25..deployment..AbstractWebModuleBuilder..configureBasicWebModuleAttributes(AbstractWebModuleBuilder.java:614)
>        at
> org..apache..geronimo..tomcat..deployment.TomcatModuleBuilder.addGBeans(TomcatModuleBuilder.java:349)
>        at
> org..apache..geronimo..j2ee..deployment..SwitchingModuleBuilder.addGBeans(SwitchingModuleBuilder.java:165)
>        at
> org..apache..geronimo..j2ee..deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:652)
>        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:257)
>
>
>
> On Jul 15, 2009, at 9:08 AM, gawor@apache.org wrote:
>
>> Author: gawor
>> Date: Wed Jul 15 16:08:51 2009
>> New Revision: 794318
>>
>> URL: http://svn.apache.org/viewvc?rev=794318&view=rev
>> Log:
>> 1) set arbitrary port properties for service-references in geronimo plan
>> and 2) recognize wss4j properties to enable ws-security for
>> service-references (using CXF provider). Based on patch/work of Rahul Mehta
>> (GERONIMO-4642)
>>
>> Added:
>>
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPasswordHandler.java
>>   (with props)
>>
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPortMethodInterceptor.java
>>   (with props)
>> Modified:
>>   geronimo/server/trunk/plugins/cxf/geronimo-cxf/pom.xml
>>
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFServiceReference.java
>>
>> geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/xsd/geronimo-naming-1.2.xsd
>>
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java
>>
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/EndpointInfo.java
>>
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java
>>
>> Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/pom.xml
>> URL:
>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/pom.xml?rev=794318&r1=794317&r2=794318&view=diff
>>
>> ==============================================================================
>> --- geronimo/server/trunk/plugins/cxf/geronimo-cxf/pom.xml (original)
>> +++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/pom.xml Wed Jul 15
>> 16:08:51 2009
>> @@ -61,6 +61,11 @@
>>            <groupId>org.apache.cxf</groupId>
>>            <artifactId>cxf-rt-transports-http</artifactId>
>>        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>org.apache.cxf</groupId>
>> +            <artifactId>cxf-rt-ws-security</artifactId>
>> +        </dependency>
>>
>>        <dependency>
>>            <groupId>org.apache.geronimo.specs</groupId>
>>
>> Added:
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPasswordHandler.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPasswordHandler.java?rev=794318&view=auto
>>
>> ==============================================================================
>> ---
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPasswordHandler.java
>> (added)
>> +++
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPasswordHandler.java
>> Wed Jul 15 16:08:51 2009
>> @@ -0,0 +1,44 @@
>> +/**
>> + * Licensed to the Apache Software Foundation (ASF) under one or more
>> + * contributor license agreements.  See the NOTICE file distributed with
>> + * this work for additional information regarding copyright ownership.
>> + * The ASF licenses this file to You under the Apache License, Version
>> 2.0
>> + * (the "License"); you may not use this file except in compliance with
>> + * the License.  You may obtain a copy of the License at
>> + *
>> + *     http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing, software
>> + * distributed under the License is distributed on an "AS IS" BASIS,
>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> + * See the License for the specific language governing permissions and
>> + * limitations under the License.
>> + */
>> +
>> +package org.apache.geronimo.cxf.client;
>> +
>> +import java.io.IOException;
>> +
>> +import javax.security.auth.callback.Callback;
>> +import javax.security.auth.callback.CallbackHandler;
>> +import javax.security.auth.callback.UnsupportedCallbackException;
>> +
>> +import org.apache.ws.security.WSPasswordCallback;
>> +import org.slf4j.Logger;
>> +import org.slf4j.LoggerFactory;
>> +
>> +public class CXFPasswordHandler implements CallbackHandler {
>> +
>> +    private static final Logger LOG =
>> LoggerFactory.getLogger(CXFPasswordHandler.class);
>> +
>> +    private String password;
>> +
>> +    public CXFPasswordHandler(String password) {
>> +        this.password = password;
>> +    }
>> +
>> +    public void handle(Callback[] callbacks) throws IOException,
>> UnsupportedCallbackException {
>> +        WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
>> +        pc.setPassword(this.password);
>> +    }
>> +}
>>
>> Propchange:
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPasswordHandler.java
>>
>> ------------------------------------------------------------------------------
>>   svn:eol-style = native
>>
>> Propchange:
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPasswordHandler.java
>>
>> ------------------------------------------------------------------------------
>>   svn:keywords = Date Revision
>>
>> Propchange:
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPasswordHandler.java
>>
>> ------------------------------------------------------------------------------
>>   svn:mime-type = text/plain
>>
>> Added:
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPortMethodInterceptor.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPortMethodInterceptor.java?rev=794318&view=auto
>>
>> ==============================================================================
>> ---
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPortMethodInterceptor.java
>> (added)
>> +++
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPortMethodInterceptor.java
>> Wed Jul 15 16:08:51 2009
>> @@ -0,0 +1,112 @@
>> +/**
>> + * Licensed to the Apache Software Foundation (ASF) under one or more
>> + * contributor license agreements.  See the NOTICE file distributed with
>> + * this work for additional information regarding copyright ownership.
>> + * The ASF licenses this file to You under the Apache License, Version
>> 2.0
>> + * (the "License"); you may not use this file except in compliance with
>> + * the License.  You may obtain a copy of the License at
>> + *
>> + *     http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing, software
>> + * distributed under the License is distributed on an "AS IS" BASIS,
>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> + * See the License for the specific language governing permissions and
>> + * limitations under the License.
>> + */
>> +
>> +package org.apache.geronimo.cxf.client;
>> +
>> +import java.util.HashMap;
>> +import java.util.Map;
>> +
>> +import javax.xml.ws.BindingProvider;
>> +
>> +import org.apache.cxf.endpoint.Client;
>> +import org.apache.cxf.endpoint.Endpoint;
>> +import org.apache.cxf.frontend.ClientProxy;
>> +import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
>> +import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
>> +import org.apache.geronimo.jaxws.client.EndpointInfo;
>> +import org.apache.geronimo.jaxws.client.PortMethodInterceptor;
>> +import org.apache.ws.security.handler.WSHandlerConstants;
>> +import org.slf4j.Logger;
>> +import org.slf4j.LoggerFactory;
>> +
>> +public class CXFPortMethodInterceptor extends PortMethodInterceptor {
>> +
>> +    private static final Logger LOG =
>> LoggerFactory.getLogger(CXFPortMethodInterceptor.class);
>> +
>> +    private static final String IN_PREFIX = "wss4j.in.";
>> +    private static final String OUT_PREFIX = "wss4j.out.";
>> +
>> +    public CXFPortMethodInterceptor(Map<Object, EndpointInfo> seiInfoMap)
>> {
>> +        super(seiInfoMap);
>> +    }
>> +
>> +    @Override
>> +    protected void setProperties(BindingProvider proxy, EndpointInfo
>> info, Map<String, Object> props) {
>> +        if (info == null) {
>> +            return;
>> +        }
>> +
>> +        Map<String, Object> wss4jInProps = new HashMap<String, Object>();
>> +        Map<String, Object> wss4jOutProps = new HashMap<String,
>> Object>();
>> +        Map<String, Object> otherProps = new HashMap<String, Object>();
>> +
>> +        for (Map.Entry<String, Object> entry : props.entrySet()) {
>> +            String key = entry.getKey();
>> +            Object value = entry.getValue();
>> +            if (key.startsWith(IN_PREFIX)) {
>> +                key = key.substring(IN_PREFIX.length());
>> +                wss4jInProps.put(key, value);
>> +            } else if (key.startsWith(OUT_PREFIX)) {
>> +                key = key.substring(OUT_PREFIX.length());
>> +                wss4jOutProps.put(key, value);
>> +            } else {
>> +                otherProps.put(key, value);
>> +            }
>> +        }
>> +
>> +        super.setProperties(proxy, info, otherProps);
>> +
>> +        Client client = ClientProxy.getClient(proxy);
>> +        Endpoint cxfEndpoint = client.getEndpoint();
>> +
>> +        if (!wss4jOutProps.isEmpty()) {
>> +            // pass the security properties to the WSS4J out interceptor
>> +            updateSecurityProperties(wss4jOutProps);
>> +            WSS4JOutInterceptor wssOut = new
>> WSS4JOutInterceptor(wss4jOutProps);
>> +            cxfEndpoint.getOutInterceptors().add(wssOut);
>> +        }
>> +
>> +        if (!wss4jInProps.isEmpty()) {
>> +            // pass the security properties to the WSS4J in interceptor
>> +            WSS4JInInterceptor wssIn = new
>> WSS4JInInterceptor(wss4jInProps);
>> +            cxfEndpoint.getInInterceptors().add(wssIn);
>> +        }
>> +
>> +    }
>> +
>> +    private static void updateSecurityProperties(Map<String, Object>
>> properties) {
>> +        String action = (String)
>> properties.get(WSHandlerConstants.ACTION);
>> +        if (containsValue(action, WSHandlerConstants.USERNAME_TOKEN) &&
>> +
>>  !properties.containsKey(WSHandlerConstants.PW_CALLBACK_CLASS)) {
>> +            String password = (String) properties.get("password");
>> +            properties.put(WSHandlerConstants.PW_CALLBACK_REF,
>> +                           new CXFPasswordHandler(password));
>> +        }
>> +    }
>> +
>> +    private static boolean containsValue(String property, String value) {
>> +        if (property != null) {
>> +            String[] entries = property.split(" ");
>> +            for (String entry : entries) {
>> +                if (value.equals(entry)) {
>> +                    return true;
>> +                }
>> +            }
>> +        }
>> +        return false;
>> +    }
>> +}
>>
>> Propchange:
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPortMethodInterceptor.java
>>
>> ------------------------------------------------------------------------------
>>   svn:eol-style = native
>>
>> Propchange:
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPortMethodInterceptor.java
>>
>> ------------------------------------------------------------------------------
>>   svn:keywords = Date Revision
>>
>> Propchange:
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFPortMethodInterceptor.java
>>
>> ------------------------------------------------------------------------------
>>   svn:mime-type = text/plain
>>
>> Modified:
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFServiceReference.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFServiceReference.java?rev=794318&r1=794317&r2=794318&view=diff
>>
>> ==============================================================================
>> ---
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFServiceReference.java
>> (original)
>> +++
>> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFServiceReference.java
>> Wed Jul 15 16:08:51 2009
>> @@ -38,6 +38,7 @@
>> import org.apache.geronimo.jaxws.JNDIResolver;
>> import org.apache.geronimo.jaxws.client.EndpointInfo;
>> import org.apache.geronimo.jaxws.client.JAXWSServiceReference;
>> +import org.apache.geronimo.jaxws.client.PortMethodInterceptor;
>> import org.apache.geronimo.jaxws.handler.GeronimoHandlerResolver;
>> import org.apache.geronimo.xbeans.javaee.HandlerChainsType;
>>
>> @@ -93,4 +94,9 @@
>>                new GeronimoHandlerResolver(classLoader, serviceClass,
>> getHandlerChains(), annotationProcessor);
>>        return handlerResolver;
>>    }
>> +
>> +    protected PortMethodInterceptor getPortMethodInterceptor() {
>> +        return new CXFPortMethodInterceptor(this.seiInfoMap);
>> +    }
>> +
>> }
>>
>> Modified:
>> geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/xsd/geronimo-naming-1.2.xsd
>> URL:
>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/xsd/geronimo-naming-1.2.xsd?rev=794318&r1=794317&r2=794318&view=diff
>>
>> ==============================================================================
>> ---
>> geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/xsd/geronimo-naming-1.2.xsd
>> (original)
>> +++
>> geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/xsd/geronimo-naming-1.2.xsd
>> Wed Jul 15 16:08:51 2009
>> @@ -986,9 +986,19 @@
>>                    </xsd:documentation>
>>                </xsd:annotation>
>>            </xsd:element>
>> +            <xsd:element name="property"
>> type="gernaming:portPropertyType"
>> +                         minOccurs="0" maxOccurs="unbounded"/>
>>        </xsd:sequence>
>>    </xsd:complexType>
>>
>> +    <xsd:complexType name="portPropertyType">
>> +        <xsd:simpleContent>
>> +            <xsd:extension base="xsd:string">
>> +                <xsd:attribute name="name" type="xsd:string"
>> use="required"/>
>> +            </xsd:extension>
>> +         </xsd:simpleContent>
>> +    </xsd:complexType>
>> +
>>    <xsd:complexType name="service-refType">
>>        <xsd:sequence>
>>            <xsd:element name="service-ref-name" type="xsd:string">
>>
>> Modified:
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java?rev=794318&r1=794317&r2=794318&view=diff
>>
>> ==============================================================================
>> ---
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java
>> (original)
>> +++
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java
>> Wed Jul 15 16:08:51 2009
>> @@ -26,6 +26,7 @@
>> import java.util.Iterator;
>> import java.util.List;
>> import java.util.Map;
>> +import java.util.Properties;
>>
>> import javax.wsdl.Binding;
>> import javax.wsdl.Definition;
>> @@ -47,6 +48,7 @@
>> import org.apache.geronimo.jaxws.client.EndpointInfo;
>> import org.apache.geronimo.jaxws.wsdl.CatalogJarWSDLLocator;
>> import org.apache.geronimo.jaxws.wsdl.CatalogWSDLLocator;
>> +import org.apache.geronimo.xbeans.geronimo.naming.GerPortPropertyType;
>> import org.apache.geronimo.xbeans.geronimo.naming.GerPortType;
>> import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
>> import org.apache.geronimo.xbeans.javaee.PortComponentRefType;
>> @@ -118,7 +120,8 @@
>>                        URL location = getLocation(gerPort);
>>                        String credentialsName =
>> getCredentialsName(gerPort);
>>                        boolean mtomEnabled = isMTOMEnabled(portName);
>> -                        EndpointInfo info = new EndpointInfo(location,
>> credentialsName, mtomEnabled);
>> +                        Map<String, Object> props =
>> getProperties(gerPort);
>> +                        EndpointInfo info = new EndpointInfo(location,
>> credentialsName, mtomEnabled, props);
>>                        this.portInfoMap.put(portName, info);
>>                    }
>>                }
>> @@ -240,7 +243,9 @@
>>
>>                boolean mtomEnabled = isMTOMEnabled(portType.getQName());
>>
>> -                EndpointInfo info = new EndpointInfo(location,
>> credentialsName, mtomEnabled);
>> +                Map<String, Object> props = getProperties(gerPort);
>> +
>> +                EndpointInfo info = new EndpointInfo(location,
>> credentialsName, mtomEnabled, props);
>>                this.portInfoMap.put(portName, info);
>>                // prefer first binding listed in wsdl
>>                if (!this.portInfoMap.containsKey(portType.getQName())) {
>> @@ -272,6 +277,16 @@
>>        return null;
>>    }
>>
>> +    private Map<String, Object> getProperties(GerPortType port) {
>> +        Map<String, Object> props = new HashMap<String, Object>();
>> +        if (port.getPropertyArray() != null) {
>> +            for (GerPortPropertyType propertyType :
>> port.getPropertyArray()) {
>> +                props.put(propertyType.getName(),
>> propertyType.getStringValue().trim());
>> +            }
>> +        }
>> +        return props;
>> +    }
>> +
>>    private String getCredentialsName(GerPortType port) {
>>        String credentialsName = port.getCredentialsName();
>>        return (credentialsName == null) ? null : credentialsName.trim();
>>
>> Modified:
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/EndpointInfo.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/EndpointInfo.java?rev=794318&r1=794317&r2=794318&view=diff
>>
>> ==============================================================================
>> ---
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/EndpointInfo.java
>> (original)
>> +++
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/EndpointInfo.java
>> Wed Jul 15 16:08:51 2009
>> @@ -18,17 +18,20 @@
>>
>> import java.io.Serializable;
>> import java.net.URL;
>> +import java.util.Map;
>>
>> public class EndpointInfo implements Serializable {
>>
>>    private URL location;
>>    private String credentialsName;
>>    private boolean mtomEnabled;
>> +    private Map<String, Object> properties;
>>
>> -    public EndpointInfo(URL location, String credentialsName, boolean
>> mtomEnabled) {
>> +    public EndpointInfo(URL location, String credentialsName, boolean
>> mtomEnabled, Map<String, Object> properties) {
>>        this.location = location;
>>        this.credentialsName = credentialsName;
>>        this.mtomEnabled = mtomEnabled;
>> +        this.properties = properties;
>>    }
>>
>>    public boolean isMTOMEnabled() {
>> @@ -43,7 +46,11 @@
>>        return this.credentialsName;
>>    }
>>
>> +    public Map<String, Object> getProperties() {
>> +        return properties;
>> +    }
>> +
>>    public String toString() {
>> -        return this.location + " " + this.credentialsName + " " +
>> this.mtomEnabled;
>> +        return this.location + " " + this.credentialsName + " " +
>> this.mtomEnabled + " " + this.properties;
>>    }
>> }
>>
>> Modified:
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java
>> URL:
>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java?rev=794318&r1=794317&r2=794318&view=diff
>>
>> ==============================================================================
>> ---
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java
>> (original)
>> +++
>> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/PortMethodInterceptor.java
>> Wed Jul 15 16:08:51 2009
>> @@ -97,7 +97,14 @@
>>        setProperties(proxy, info);
>>    }
>>
>> -    private void setProperties(BindingProvider proxy, EndpointInfo info)
>> {
>> +    protected void setProperties(BindingProvider proxy, EndpointInfo
>> info) {
>> +        if (info == null) {
>> +            return;
>> +        }
>> +        setProperties(proxy, info, info.getProperties());
>> +    }
>> +
>> +    protected void setProperties(BindingProvider proxy, EndpointInfo
>> info, Map<String, Object> properties) {
>>        if (info == null) {
>>            return;
>>        }
>> @@ -119,29 +126,35 @@
>>        // set credentials
>>        String credentialsName = info.getCredentialsName();
>>        if (credentialsName != null) {
>> -            Subject subject = ContextManager.getNextCaller();
>> -            if (subject == null) {
>> -                throw new IllegalStateException("Subject missing but
>> authentication turned on");
>> -            } else {
>> -                Set creds =
>> subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
>> -                boolean found = false;
>> -
>> -                for (Iterator iterator = creds.iterator();
>> iterator.hasNext();) {
>> -                    NamedUsernamePasswordCredential
>> namedUsernamePasswordCredential = (NamedUsernamePasswordCredential)
>> iterator.next();
>> -                    if
>> (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
>> -
>>  proxy.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
>> -
>>  namedUsernamePasswordCredential.getUsername());
>> -
>>  proxy.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
>> -                                                      new
>> String(namedUsernamePasswordCredential.getPassword()));
>> -                        LOG.debug("Set username/password property: "
+
>> credentialsName);
>> -                        found = true;
>> -                        break;
>> -                    }
>> -                }
>> -                if (!found) {
>> -                    throw new IllegalStateException("no
>> NamedUsernamePasswordCredential found for name " + credentialsName);
>> +            NamedUsernamePasswordCredential
>> namedUsernamePasswordCredential = findCredential(credentialsName);
>> +
>>  proxy.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
>> +
>>  namedUsernamePasswordCredential.getUsername());
>> +
>>  proxy.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
>> +                                         new
>> String(namedUsernamePasswordCredential.getPassword()));
>> +            LOG.debug("Set username/password property: " +
>> credentialsName);
>> +        }
>> +
>> +        // set user-specified properties
>> +        if (properties != null) {
>> +            for (Map.Entry<String, Object> entry : properties.entrySet())
>> {
>> +                proxy.getRequestContext().put(entry.getKey(),
>> entry.getValue());
>> +            }
>> +        }
>> +    }
>> +
>> +    protected NamedUsernamePasswordCredential findCredential(String
>> credentialsName) {
>> +        Subject subject = ContextManager.getNextCaller();
>> +        if (subject == null) {
>> +            throw new IllegalStateException("Subject missing but
>> authentication turned on");
>> +        } else {
>> +            Set creds =
>> subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
>> +            for (Iterator iterator = creds.iterator();
>> iterator.hasNext();) {
>> +                NamedUsernamePasswordCredential
>> namedUsernamePasswordCredential = (NamedUsernamePasswordCredential)
>> iterator.next();
>> +                if
>> (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
>> +                    return namedUsernamePasswordCredential;
>>                }
>>            }
>> +            throw new IllegalStateException("No
>> NamedUsernamePasswordCredential found for name " + credentialsName);
>>        }
>>    }
>> }
>>
>>
>

Mime
View raw message