Generified core & support module
This commit is contained in:
@@ -312,20 +312,17 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
|
||||
private void initMessageFactory(DefaultStrategiesHelper helper) throws BeanInitializationException {
|
||||
WebServiceMessageFactory messageFactory =
|
||||
(WebServiceMessageFactory) helper.getDefaultStrategy(WebServiceMessageFactory.class);
|
||||
WebServiceMessageFactory messageFactory = helper.getDefaultStrategy(WebServiceMessageFactory.class);
|
||||
setMessageFactory(messageFactory);
|
||||
}
|
||||
|
||||
private void initMessageSenders(DefaultStrategiesHelper helper) {
|
||||
List messageSenders = helper.getDefaultStrategies(WebServiceMessageSender.class);
|
||||
setMessageSenders(
|
||||
(WebServiceMessageSender[]) messageSenders.toArray(new WebServiceMessageSender[messageSenders.size()]));
|
||||
List<WebServiceMessageSender> messageSenders = helper.getDefaultStrategies(WebServiceMessageSender.class);
|
||||
setMessageSenders(messageSenders.toArray(new WebServiceMessageSender[messageSenders.size()]));
|
||||
}
|
||||
|
||||
private void initFaultMessageResolver(DefaultStrategiesHelper helper) throws BeanInitializationException {
|
||||
FaultMessageResolver faultMessageResolver =
|
||||
(FaultMessageResolver) helper.getDefaultStrategy(FaultMessageResolver.class);
|
||||
FaultMessageResolver faultMessageResolver = helper.getDefaultStrategy(FaultMessageResolver.class);
|
||||
setFaultMessageResolver(faultMessageResolver);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -102,9 +102,9 @@ public abstract class WebServiceAccessor extends TransformerObjectSupport implem
|
||||
protected WebServiceConnection createConnection(URI uri) throws IOException {
|
||||
Assert.notEmpty(getMessageSenders(), "Property 'messageSenders' is required");
|
||||
WebServiceMessageSender[] messageSenders = getMessageSenders();
|
||||
for (int i = 0; i < messageSenders.length; i++) {
|
||||
if (messageSenders[i].supports(uri)) {
|
||||
WebServiceConnection connection = messageSenders[i].createConnection(uri);
|
||||
for (WebServiceMessageSender messageSender : messageSenders) {
|
||||
if (messageSender.supports(uri)) {
|
||||
WebServiceConnection connection = messageSender.createConnection(uri);
|
||||
if (logger.isDebugEnabled()) {
|
||||
try {
|
||||
logger.debug("Opening [" + connection + "] to [" + connection.getUri() + "]");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,8 +19,6 @@ package org.springframework.ws.client.support.interceptor;
|
||||
import java.io.IOException;
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -36,6 +34,8 @@ import org.springframework.xml.validation.XmlValidatorFactory;
|
||||
import org.springframework.xml.xsd.XsdSchema;
|
||||
import org.springframework.xml.xsd.XsdSchemaCollection;
|
||||
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link ClientInterceptor} implementations that validate part of the message using a schema.
|
||||
* The exact message part is determined by the {@link #getValidationRequestSource(WebServiceMessage)} and {@link
|
||||
@@ -97,9 +97,9 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
*/
|
||||
public void setSchemas(Resource[] schemas) {
|
||||
Assert.notEmpty(schemas, "schemas must not be empty or null");
|
||||
for (int i = 0; i < schemas.length; i++) {
|
||||
Assert.notNull(schemas[i], "schema must not be null");
|
||||
Assert.isTrue(schemas[i].exists(), "schema \"" + schemas[i] + "\" does not exit");
|
||||
for (Resource schema : schemas) {
|
||||
Assert.notNull(schema, "schema must not be null");
|
||||
Assert.isTrue(schema.exists(), "schema \"" + schema + "\" does not exit");
|
||||
}
|
||||
this.schemas = schemas;
|
||||
}
|
||||
@@ -141,8 +141,8 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (validator == null && !ObjectUtils.isEmpty(schemas)) {
|
||||
Assert.hasLength(schemaLanguage, "schemaLanguage is required");
|
||||
for (int i = 0; i < schemas.length; i++) {
|
||||
Assert.isTrue(schemas[i].exists(), "schema [" + schemas[i] + "] does not exist");
|
||||
for (Resource schema : schemas) {
|
||||
Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist");
|
||||
}
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas));
|
||||
@@ -195,8 +195,8 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
* @return <code>true</code> to continue processing the request, <code>false</code> otherwise
|
||||
*/
|
||||
protected boolean handleRequestValidationErrors(MessageContext messageContext, SAXParseException[] errors) {
|
||||
for (int i = 0; i < errors.length; i++) {
|
||||
logger.error("XML validation error on request: " + errors[i].getMessage());
|
||||
for (SAXParseException error : errors) {
|
||||
logger.error("XML validation error on request: " + error.getMessage());
|
||||
}
|
||||
throw new WebServiceValidationException(errors);
|
||||
}
|
||||
@@ -246,8 +246,8 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
*/
|
||||
protected boolean handleResponseValidationErrors(MessageContext messageContext, SAXParseException[] errors)
|
||||
throws WebServiceValidationException {
|
||||
for (int i = 0; i < errors.length; i++) {
|
||||
logger.warn("XML validation error on response: " + errors[i].getMessage());
|
||||
for (SAXParseException error : errors) {
|
||||
logger.warn("XML validation error on response: " + error.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.ws.config;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -24,6 +23,7 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
@@ -49,11 +49,10 @@ class XPathEndpointsBeanDefinitionParser extends AbstractSimpleBeanDefinitionPar
|
||||
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder beanDefinitionBuilder) {
|
||||
List namespaceElements = DomUtils.getChildElementsByTagName(element, "namespace");
|
||||
List<Element> namespaceElements = DomUtils.getChildElementsByTagName(element, "namespace");
|
||||
if (!namespaceElements.isEmpty()) {
|
||||
Properties namespaces = new Properties();
|
||||
for (Iterator iterator = namespaceElements.iterator(); iterator.hasNext();) {
|
||||
Element namespaceElement = (Element) iterator.next();
|
||||
for (Element namespaceElement : namespaceElements) {
|
||||
String prefix = namespaceElement.getAttribute("prefix");
|
||||
String uri = namespaceElement.getAttribute("uri");
|
||||
namespaces.setProperty(prefix, uri);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,10 +30,10 @@ import org.springframework.util.StringUtils;
|
||||
public abstract class AbstractMessageContext implements MessageContext {
|
||||
|
||||
/**
|
||||
* Keys are <code>Strings</code>, values are <code>Objects</code>. Lazily initalized by
|
||||
* Keys are <code>Strings</code>, values are <code>Objects</code>. Lazily initialized by
|
||||
* <code>getProperties()</code>.
|
||||
*/
|
||||
private Map properties;
|
||||
private Map<String, Object> properties;
|
||||
|
||||
public boolean containsProperty(String name) {
|
||||
return getProperties().containsKey(name);
|
||||
@@ -55,9 +55,9 @@ public abstract class AbstractMessageContext implements MessageContext {
|
||||
getProperties().put(name, value);
|
||||
}
|
||||
|
||||
private Map getProperties() {
|
||||
private Map<String, Object> getProperties() {
|
||||
if (properties == null) {
|
||||
properties = new HashMap();
|
||||
properties = new HashMap<String, Object>();
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ws.mime;
|
||||
|
||||
import java.io.File;
|
||||
@@ -49,7 +65,7 @@ public interface MimeMessage extends WebServiceMessage {
|
||||
* @throws AttachmentException in case of errors
|
||||
* @see Attachment
|
||||
*/
|
||||
Iterator getAttachments() throws AttachmentException;
|
||||
Iterator<Attachment> getAttachments() throws AttachmentException;
|
||||
|
||||
/**
|
||||
* Add an attachment to the message, taking the content from a {@link File}.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,13 +20,9 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
@@ -52,6 +48,9 @@ import org.springframework.ws.soap.server.SoapMessageDispatcher;
|
||||
import org.springframework.ws.support.DefaultStrategiesHelper;
|
||||
import org.springframework.ws.transport.WebServiceMessageReceiver;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Central dispatcher for use within Spring-WS, dispatching Web service messages to registered endpoints.
|
||||
* <p/>
|
||||
@@ -103,13 +102,13 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
private String beanName;
|
||||
|
||||
/** List of EndpointAdapters used in this dispatcher. */
|
||||
private List endpointAdapters;
|
||||
private List<EndpointAdapter> endpointAdapters;
|
||||
|
||||
/** List of EndpointExceptionResolvers used in this dispatcher. */
|
||||
private List endpointExceptionResolvers;
|
||||
private List<EndpointExceptionResolver> endpointExceptionResolvers;
|
||||
|
||||
/** List of EndpointMappings used in this dispatcher. */
|
||||
private List endpointMappings;
|
||||
private List<EndpointMapping> endpointMappings;
|
||||
|
||||
/** Initializes a new instance of the <code>MessageDispatcher</code>. */
|
||||
public MessageDispatcher() {
|
||||
@@ -118,32 +117,32 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
}
|
||||
|
||||
/** Returns the <code>EndpointAdapter</code>s to use by this <code>MessageDispatcher</code>. */
|
||||
public List getEndpointAdapters() {
|
||||
public List<EndpointAdapter> getEndpointAdapters() {
|
||||
return endpointAdapters;
|
||||
}
|
||||
|
||||
/** Sets the <code>EndpointAdapter</code>s to use by this <code>MessageDispatcher</code>. */
|
||||
public void setEndpointAdapters(List endpointAdapters) {
|
||||
public void setEndpointAdapters(List<EndpointAdapter> endpointAdapters) {
|
||||
this.endpointAdapters = endpointAdapters;
|
||||
}
|
||||
|
||||
/** Returns the <code>EndpointExceptionResolver</code>s to use by this <code>MessageDispatcher</code>. */
|
||||
public List getEndpointExceptionResolvers() {
|
||||
public List<EndpointExceptionResolver> getEndpointExceptionResolvers() {
|
||||
return endpointExceptionResolvers;
|
||||
}
|
||||
|
||||
/** Sets the <code>EndpointExceptionResolver</code>s to use by this <code>MessageDispatcher</code>. */
|
||||
public void setEndpointExceptionResolvers(List endpointExceptionResolvers) {
|
||||
public void setEndpointExceptionResolvers(List<EndpointExceptionResolver> endpointExceptionResolvers) {
|
||||
this.endpointExceptionResolvers = endpointExceptionResolvers;
|
||||
}
|
||||
|
||||
/** Returns the <code>EndpointMapping</code>s to use by this <code>MessageDispatcher</code>. */
|
||||
public List getEndpointMappings() {
|
||||
public List<EndpointMapping> getEndpointMappings() {
|
||||
return endpointMappings;
|
||||
}
|
||||
|
||||
/** Sets the <code>EndpointMapping</code>s to use by this <code>MessageDispatcher</code>. */
|
||||
public void setEndpointMappings(List endpointMappings) {
|
||||
public void setEndpointMappings(List<EndpointMapping> endpointMappings) {
|
||||
this.endpointMappings = endpointMappings;
|
||||
}
|
||||
|
||||
@@ -250,8 +249,7 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
* @return the <code>EndpointInvocationChain</code>, or <code>null</code> if no endpoint could be found.
|
||||
*/
|
||||
protected EndpointInvocationChain getEndpoint(MessageContext messageContext) throws Exception {
|
||||
for (Iterator iterator = endpointMappings.iterator(); iterator.hasNext();) {
|
||||
EndpointMapping endpointMapping = (EndpointMapping) iterator.next();
|
||||
for (EndpointMapping endpointMapping : getEndpointMappings()) {
|
||||
EndpointInvocationChain endpoint = endpointMapping.getEndpoint(messageContext);
|
||||
if (endpoint != null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@@ -274,8 +272,7 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
* @return the adapter
|
||||
*/
|
||||
protected EndpointAdapter getEndpointAdapter(Object endpoint) {
|
||||
for (Iterator iterator = endpointAdapters.iterator(); iterator.hasNext();) {
|
||||
EndpointAdapter endpointAdapter = (EndpointAdapter) iterator.next();
|
||||
for (EndpointAdapter endpointAdapter : getEndpointAdapters()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Testing endpoint adapter [" + endpointAdapter + "]");
|
||||
}
|
||||
@@ -313,8 +310,7 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
*/
|
||||
protected void processEndpointException(MessageContext messageContext, Object endpoint, Exception ex)
|
||||
throws Exception {
|
||||
for (Iterator iterator = endpointExceptionResolvers.iterator(); iterator.hasNext();) {
|
||||
EndpointExceptionResolver resolver = (EndpointExceptionResolver) iterator.next();
|
||||
for (EndpointExceptionResolver resolver : getEndpointExceptionResolvers()) {
|
||||
if (resolver.resolveException(messageContext, endpoint, ex)) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Endpoint invocation resulted in exception - responding with Fault", ex);
|
||||
@@ -368,7 +364,7 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
*/
|
||||
private void initEndpointAdapters(ApplicationContext applicationContext) throws BeansException {
|
||||
if (endpointAdapters == null) {
|
||||
Map matchingBeans = BeanFactoryUtils
|
||||
Map<String, EndpointAdapter> matchingBeans = BeanFactoryUtils
|
||||
.beansOfTypeIncludingAncestors(applicationContext, EndpointAdapter.class, true, false);
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
endpointAdapters = new ArrayList(matchingBeans.values());
|
||||
@@ -392,7 +388,7 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
*/
|
||||
private void initEndpointExceptionResolvers(ApplicationContext applicationContext) throws BeansException {
|
||||
if (endpointExceptionResolvers == null) {
|
||||
Map matchingBeans = BeanFactoryUtils
|
||||
Map<String, EndpointExceptionResolver> matchingBeans = BeanFactoryUtils
|
||||
.beansOfTypeIncludingAncestors(applicationContext, EndpointExceptionResolver.class, true, false);
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
endpointExceptionResolvers = new ArrayList(matchingBeans.values());
|
||||
@@ -416,7 +412,7 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
*/
|
||||
private void initEndpointMappings(ApplicationContext applicationContext) throws BeansException {
|
||||
if (endpointMappings == null) {
|
||||
Map matchingBeans = BeanFactoryUtils
|
||||
Map<String, EndpointMapping> matchingBeans = BeanFactoryUtils
|
||||
.beansOfTypeIncludingAncestors(applicationContext, EndpointMapping.class, true, false);
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
endpointMappings = new ArrayList(matchingBeans.values());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,13 +18,13 @@ package org.springframework.ws.server.endpoint;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
import org.springframework.ws.server.EndpointExceptionResolver;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link EndpointExceptionResolver EndpointExceptionResolvers}.
|
||||
* <p/>
|
||||
@@ -41,7 +41,7 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
|
||||
|
||||
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
|
||||
|
||||
private Set mappedEndpoints;
|
||||
private Set<?> mappedEndpoints;
|
||||
|
||||
private Log warnLogger;
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
|
||||
* that a specified default fault will be used as fallback for all exceptions; any further
|
||||
* <code>EndpointExceptionResolvers</code> in the chain will be ignored in this case.
|
||||
*/
|
||||
public void setMappedEndpoints(Set mappedEndpoints) {
|
||||
public void setMappedEndpoints(Set<?> mappedEndpoints) {
|
||||
this.mappedEndpoints = mappedEndpoints;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,6 +47,7 @@ import org.springframework.xml.transform.TraxUtils;
|
||||
* @see XMLEventWriter
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPayloadEndpoint implements MessageEndpoint {
|
||||
|
||||
private XMLEventFactory eventFactory;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,6 +30,7 @@ import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
* @see XMLOutputFactory
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
public abstract class AbstractStaxPayloadEndpoint extends TransformerObjectSupport {
|
||||
|
||||
private XMLInputFactory inputFactory;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,6 +44,7 @@ import org.springframework.xml.transform.TraxUtils;
|
||||
* @see XMLStreamWriter
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayloadEndpoint implements MessageEndpoint {
|
||||
|
||||
public final void invoke(MessageContext messageContext) throws Exception {
|
||||
|
||||
@@ -79,8 +79,8 @@ public abstract class AbstractValidatingMarshallingPayloadEndpoint extends Abstr
|
||||
Validator[] validators = getValidators();
|
||||
if (validators != null) {
|
||||
Errors errors = new BindException(requestObject, getRequestName());
|
||||
for (int i = 0; i < validators.length; i++) {
|
||||
ValidationUtils.invokeValidator(validators[i], requestObject, errors);
|
||||
for (Validator validator : validators) {
|
||||
ValidationUtils.invokeValidator(validator, requestObject, errors);
|
||||
}
|
||||
if (errors.hasErrors()) {
|
||||
return onValidationErrors(messageContext, requestObject, errors);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,6 +30,11 @@ import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.springframework.xml.transform.TraxUtils;
|
||||
|
||||
import nu.xom.Attribute;
|
||||
import nu.xom.Builder;
|
||||
import nu.xom.Document;
|
||||
@@ -45,11 +50,6 @@ import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.springframework.xml.transform.TraxUtils;
|
||||
|
||||
/**
|
||||
* Abstract base class for endpoints that handle the message payload as XOM elements. Offers the message payload as a
|
||||
* XOM <code>Element</code>, and allows subclasses to create a response by returning an <code>Element</code>.
|
||||
@@ -61,6 +61,7 @@ import org.springframework.xml.transform.TraxUtils;
|
||||
* @see Element
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSupport implements PayloadEndpoint {
|
||||
|
||||
public final Source invoke(Source request) throws Exception {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public final class MethodEndpoint {
|
||||
* @param parameterTypes the method parameter types
|
||||
* @throws NoSuchMethodException when the method cannot be found
|
||||
*/
|
||||
public MethodEndpoint(Object bean, String methodName, Class[] parameterTypes) throws NoSuchMethodException {
|
||||
public MethodEndpoint(Object bean, String methodName, Class<?>[] parameterTypes) throws NoSuchMethodException {
|
||||
Assert.notNull(bean, "bean must not be null");
|
||||
Assert.notNull(methodName, "method must not be null");
|
||||
this.bean = bean;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,9 +20,6 @@ import java.io.IOException;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -39,6 +36,9 @@ import org.springframework.xml.validation.XmlValidatorFactory;
|
||||
import org.springframework.xml.xsd.XsdSchema;
|
||||
import org.springframework.xml.xsd.XsdSchemaCollection;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
* Abstract base class for <code>EndpointInterceptor</code> implementations that validate part of the message using a
|
||||
* schema. The exact message part is determined by the <code>getValidationRequestSource</code> and
|
||||
@@ -100,9 +100,9 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
*/
|
||||
public void setSchemas(Resource[] schemas) {
|
||||
Assert.notEmpty(schemas, "schemas must not be empty or null");
|
||||
for (int i = 0; i < schemas.length; i++) {
|
||||
Assert.notNull(schemas[i], "schema must not be null");
|
||||
Assert.isTrue(schemas[i].exists(), "schema \"" + schemas[i] + "\" does not exit");
|
||||
for (Resource schema : schemas) {
|
||||
Assert.notNull(schema, "schema must not be null");
|
||||
Assert.isTrue(schema.exists(), "schema \"" + schema + "\" does not exit");
|
||||
}
|
||||
this.schemas = schemas;
|
||||
}
|
||||
@@ -144,8 +144,8 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (validator == null && !ObjectUtils.isEmpty(schemas)) {
|
||||
Assert.hasLength(schemaLanguage, "schemaLanguage is required");
|
||||
for (int i = 0; i < schemas.length; i++) {
|
||||
Assert.isTrue(schemas[i].exists(), "schema [" + schemas[i] + "] does not exist");
|
||||
for (Resource schema : schemas) {
|
||||
Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist");
|
||||
}
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas));
|
||||
@@ -193,8 +193,8 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
*/
|
||||
protected boolean handleRequestValidationErrors(MessageContext messageContext, SAXParseException[] errors)
|
||||
throws TransformerException {
|
||||
for (int i = 0; i < errors.length; i++) {
|
||||
logger.warn("XML validation error on request: " + errors[i].getMessage());
|
||||
for (SAXParseException error : errors) {
|
||||
logger.warn("XML validation error on request: " + error.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -234,8 +234,8 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
* @return <code>true</code> to continue the reponse interceptor chain, <code>false</code> (the default) otherwise
|
||||
*/
|
||||
protected boolean handleResponseValidationErrors(MessageContext messageContext, SAXParseException[] errors) {
|
||||
for (int i = 0; i < errors.length; i++) {
|
||||
logger.error("XML validation error on response: " + errors[i].getMessage());
|
||||
for (SAXParseException error : errors) {
|
||||
logger.error("XML validation error on response: " + error.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,9 +64,8 @@ public abstract class AbstractAnnotationMethodEndpointMapping extends AbstractMe
|
||||
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(getApplicationContext(), Object.class) :
|
||||
getApplicationContext().getBeanNamesForType(Object.class));
|
||||
|
||||
for (int i = 0; i < beanNames.length; i++) {
|
||||
String beanName = beanNames[i];
|
||||
Class endpointClass = getApplicationContext().getType(beanName);
|
||||
for (String beanName : beanNames) {
|
||||
Class<?> endpointClass = getApplicationContext().getType(beanName);
|
||||
if (endpointClass != null &&
|
||||
AnnotationUtils.findAnnotation(endpointClass, getEndpointAnnotationType()) != null) {
|
||||
registerMethods(beanName);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.ws.server.endpoint.mapping;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -42,10 +41,10 @@ public abstract class AbstractMapBasedEndpointMapping extends AbstractEndpointMa
|
||||
|
||||
private boolean registerBeanNames = false;
|
||||
|
||||
private final Map endpointMap = new HashMap();
|
||||
private final Map<String, Object> endpointMap = new HashMap<String, Object>();
|
||||
|
||||
// holds mappings set via setEndpointMap and setMappings
|
||||
private Map temporaryEndpointMap = new HashMap();
|
||||
private Map<String, Object> temporaryEndpointMap = new HashMap<String, Object>();
|
||||
|
||||
/**
|
||||
* Set whether to lazily initialize endpoints. Only applicable to singleton endpoints, as prototypes are always
|
||||
@@ -74,7 +73,7 @@ public abstract class AbstractMapBasedEndpointMapping extends AbstractEndpointMa
|
||||
*
|
||||
* @throws IllegalArgumentException if the endpoint is invalid
|
||||
*/
|
||||
public final void setEndpointMap(Map endpointMap) {
|
||||
public final void setEndpointMap(Map<String, Object> endpointMap) {
|
||||
temporaryEndpointMap.putAll(endpointMap);
|
||||
}
|
||||
|
||||
@@ -83,7 +82,11 @@ public abstract class AbstractMapBasedEndpointMapping extends AbstractEndpointMa
|
||||
* be qualified names, for instance, or mime headers.
|
||||
*/
|
||||
public void setMappings(Properties mappings) {
|
||||
temporaryEndpointMap.putAll(mappings);
|
||||
for (Map.Entry<Object, Object> entry : mappings.entrySet()) {
|
||||
if (entry.getKey() instanceof String) {
|
||||
temporaryEndpointMap.put((String) entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Validates the given endpoint key. Should return <code>true</code> is the given string is valid. */
|
||||
@@ -164,8 +167,7 @@ public abstract class AbstractMapBasedEndpointMapping extends AbstractEndpointMa
|
||||
*/
|
||||
@Override
|
||||
protected final void initApplicationContext() throws BeansException {
|
||||
for (Iterator iter = temporaryEndpointMap.keySet().iterator(); iter.hasNext();) {
|
||||
String key = (String) iter.next();
|
||||
for (String key : temporaryEndpointMap.keySet()) {
|
||||
Object endpoint = temporaryEndpointMap.get(key);
|
||||
if (!validateLookupKey(key)) {
|
||||
throw new ApplicationContextException("Invalid key [" + key + "] for endpoint [" + endpoint + "]");
|
||||
@@ -178,14 +180,14 @@ public abstract class AbstractMapBasedEndpointMapping extends AbstractEndpointMa
|
||||
logger.debug("Looking for endpoint mappings in application context: [" + getApplicationContext() + "]");
|
||||
}
|
||||
String[] beanNames = getApplicationContext().getBeanDefinitionNames();
|
||||
for (int i = 0; i < beanNames.length; i++) {
|
||||
if (validateLookupKey(beanNames[i])) {
|
||||
registerEndpoint(beanNames[i], beanNames[i]);
|
||||
for (String beanName : beanNames) {
|
||||
if (validateLookupKey(beanName)) {
|
||||
registerEndpoint(beanName, beanName);
|
||||
}
|
||||
String[] aliases = getApplicationContext().getAliases(beanNames[i]);
|
||||
for (int j = 0; j < aliases.length; j++) {
|
||||
if (validateLookupKey(aliases[j])) {
|
||||
registerEndpoint(aliases[j], beanNames[i]);
|
||||
String[] aliases = getApplicationContext().getAliases(beanName);
|
||||
for (String aliase : aliases) {
|
||||
if (validateLookupKey(aliase)) {
|
||||
registerEndpoint(aliase, beanName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.ws.server.endpoint.MethodEndpoint;
|
||||
public abstract class AbstractMethodEndpointMapping extends AbstractEndpointMapping {
|
||||
|
||||
/** Keys are Strings, values are {@link MethodEndpoint}s. */
|
||||
private final Map endpointMap = new HashMap();
|
||||
private final Map<String, MethodEndpoint> endpointMap = new HashMap<String, MethodEndpoint>();
|
||||
|
||||
/**
|
||||
* Lookup an endpoint for the given message. The extraction of the endpoint key is delegated to the concrete
|
||||
@@ -112,7 +112,7 @@ public abstract class AbstractMethodEndpointMapping extends AbstractEndpointMapp
|
||||
*/
|
||||
protected void registerMethods(final Object endpoint) {
|
||||
Assert.notNull(endpoint, "'endpoint' must not be null");
|
||||
Class endpointClass = getEndpointClass(endpoint);
|
||||
Class<?> endpointClass = getEndpointClass(endpoint);
|
||||
ReflectionUtils.doWithMethods(endpointClass, new ReflectionUtils.MethodCallback() {
|
||||
|
||||
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
|
||||
@@ -133,7 +133,7 @@ public abstract class AbstractMethodEndpointMapping extends AbstractEndpointMapp
|
||||
*/
|
||||
protected void registerMethods(final String beanName) {
|
||||
Assert.hasText(beanName, "'beanName' must not be empty");
|
||||
Class endpointClass = getApplicationContext().getType(beanName);
|
||||
Class<?> endpointClass = getApplicationContext().getType(beanName);
|
||||
ReflectionUtils.doWithMethods(endpointClass, new ReflectionUtils.MethodCallback() {
|
||||
|
||||
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
|
||||
@@ -165,7 +165,7 @@ public abstract class AbstractMethodEndpointMapping extends AbstractEndpointMapp
|
||||
* @param endpoint the bean instance (might be an AOP proxy)
|
||||
* @return the bean class to expose
|
||||
*/
|
||||
protected Class getEndpointClass(Object endpoint) {
|
||||
protected Class<?> getEndpointClass(Object endpoint) {
|
||||
if (AopUtils.isJdkDynamicProxy(endpoint)) {
|
||||
throw new IllegalArgumentException(ClassUtils.getShortName(getClass()) +
|
||||
" does not work with JDK Dynamic Proxies. " +
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.ws.server.endpoint.mapping;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
|
||||
@@ -54,7 +53,7 @@ public class PayloadRootQNameEndpointMapping extends AbstractQNameEndpointMappin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QName resolveQName(MessageContext messageContext) throws TransformerException, XMLStreamException {
|
||||
protected QName resolveQName(MessageContext messageContext) throws TransformerException {
|
||||
return PayloadRootUtils.getPayloadRootQName(messageContext.getRequest().getPayloadSource(), transformerFactory);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.ws.server.endpoint.mapping;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
|
||||
@@ -131,7 +130,7 @@ public class SimpleMethodEndpointMapping extends AbstractMethodEndpointMapping i
|
||||
/** Returns the local part of the payload root element of the request. */
|
||||
@Override
|
||||
protected String getLookupKeyForMessage(MessageContext messageContext)
|
||||
throws TransformerException, XMLStreamException {
|
||||
throws TransformerException {
|
||||
WebServiceMessage request = messageContext.getRequest();
|
||||
QName rootQName = PayloadRootUtils.getPayloadRootQName(request.getPayloadSource(), transformerFactory);
|
||||
return rootQName.getLocalPart();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,18 +27,19 @@ import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMResult;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
import org.springframework.xml.transform.TraxUtils;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* Helper class for determining the root qualified name of a Web Service payload.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
public abstract class PayloadRootUtils {
|
||||
|
||||
private PayloadRootUtils() {
|
||||
@@ -53,7 +54,7 @@ public abstract class PayloadRootUtils {
|
||||
* @return the root element, or <code>null</code> if <code>source</code> is <code>null</code>
|
||||
*/
|
||||
public static QName getPayloadRootQName(Source source, TransformerFactory transformerFactory)
|
||||
throws TransformerException, XMLStreamException {
|
||||
throws TransformerException {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -72,7 +73,12 @@ public abstract class PayloadRootUtils {
|
||||
XMLStreamReader streamReader = TraxUtils.getXMLStreamReader(source);
|
||||
if (streamReader != null) {
|
||||
if (streamReader.getEventType() == XMLStreamConstants.START_DOCUMENT) {
|
||||
streamReader.nextTag();
|
||||
try {
|
||||
streamReader.nextTag();
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
throw new IllegalStateException("Could not read next tag: " + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
if (streamReader.getEventType() == XMLStreamConstants.START_ELEMENT ||
|
||||
streamReader.getEventType() == XMLStreamConstants.END_ELEMENT) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -72,7 +72,7 @@ public interface SoapElement {
|
||||
*
|
||||
* @return an iterator over all the attribute names
|
||||
*/
|
||||
Iterator getAllAttributes();
|
||||
Iterator<QName> getAllAttributes();
|
||||
|
||||
/**
|
||||
* Adds a namespace declaration with the specified prefix and URI to this element.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,6 +53,6 @@ public interface SoapFaultDetail extends SoapElement {
|
||||
* @return an iterator over all the <code>SoapFaultDetailElement</code>s
|
||||
* @see SoapFaultDetailElement
|
||||
*/
|
||||
Iterator getDetailEntries();
|
||||
Iterator<SoapFaultDetailElement> getDetailEntries();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -70,7 +70,7 @@ public interface SoapHeader extends SoapElement {
|
||||
* @throws SoapHeaderException if the headers cannot be returned
|
||||
* @see SoapHeaderElement
|
||||
*/
|
||||
Iterator examineMustUnderstandHeaderElements(String actorOrRole) throws SoapHeaderException;
|
||||
Iterator<SoapHeaderElement> examineMustUnderstandHeaderElements(String actorOrRole) throws SoapHeaderException;
|
||||
|
||||
/**
|
||||
* Returns an <code>Iterator</code> over all the <code>SoapHeaderElement</code>s in this header.
|
||||
@@ -79,6 +79,6 @@ public interface SoapHeader extends SoapElement {
|
||||
* @throws SoapHeaderException if the header cannot be returned
|
||||
* @see SoapHeaderElement
|
||||
*/
|
||||
Iterator examineAllHeaderElements() throws SoapHeaderException;
|
||||
Iterator<SoapHeaderElement> examineAllHeaderElements() throws SoapHeaderException;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,10 +21,10 @@ import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* Represents an Endpoint Reference, as defined in the WS-Addressing specification.
|
||||
*
|
||||
@@ -38,9 +38,9 @@ public final class EndpointReference implements Serializable {
|
||||
|
||||
private final URI address;
|
||||
|
||||
private final List referenceProperties;
|
||||
private final List<Node> referenceProperties;
|
||||
|
||||
private final List referenceParameters;
|
||||
private final List<Node> referenceParameters;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the {@link EndpointReference} class with the given address. The reference parameters
|
||||
@@ -51,8 +51,8 @@ public final class EndpointReference implements Serializable {
|
||||
public EndpointReference(URI address) {
|
||||
Assert.notNull(address, "address must not be null");
|
||||
this.address = address;
|
||||
this.referenceParameters = Collections.EMPTY_LIST;
|
||||
this.referenceProperties = Collections.EMPTY_LIST;
|
||||
this.referenceParameters = Collections.emptyList();
|
||||
this.referenceProperties = Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ public final class EndpointReference implements Serializable {
|
||||
* @param referenceProperties the reference properties, as a list of {@link Node}
|
||||
* @param referenceParameters the reference parameters, as a list of {@link Node}
|
||||
*/
|
||||
public EndpointReference(URI address, List referenceProperties, List referenceParameters) {
|
||||
public EndpointReference(URI address, List<Node> referenceProperties, List<Node> referenceParameters) {
|
||||
Assert.notNull(address, "address must not be null");
|
||||
Assert.notNull(referenceProperties, "referenceProperties must not be null");
|
||||
Assert.notNull(referenceParameters, "referenceParameters must not be null");
|
||||
@@ -78,12 +78,12 @@ public final class EndpointReference implements Serializable {
|
||||
}
|
||||
|
||||
/** Returns the reference properties of the endpoint, as a list of {@link Node} objects. */
|
||||
public List getReferenceProperties() {
|
||||
public List<Node> getReferenceProperties() {
|
||||
return referenceProperties;
|
||||
}
|
||||
|
||||
/** Returns the reference parameters of the endpoint, as a list of {@link Node} objects. */
|
||||
public List getReferenceParameters() {
|
||||
public List<Node> getReferenceParameters() {
|
||||
return referenceParameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,8 @@ import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* Represents a set of Message Addressing Properties, as defined in the WS-Addressing specification.
|
||||
* <p/>
|
||||
@@ -48,9 +50,9 @@ public final class MessageAddressingProperties implements Serializable {
|
||||
|
||||
private final URI relatesTo;
|
||||
|
||||
private final List referenceProperties;
|
||||
private final List<Node> referenceProperties;
|
||||
|
||||
private final List referenceParameters;
|
||||
private final List<Node> referenceParameters;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link MessageAddressingProperties} with the given parameters.
|
||||
@@ -75,8 +77,8 @@ public final class MessageAddressingProperties implements Serializable {
|
||||
this.action = action;
|
||||
this.messageId = messageId;
|
||||
this.relatesTo = null;
|
||||
this.referenceProperties = Collections.EMPTY_LIST;
|
||||
this.referenceParameters = Collections.EMPTY_LIST;
|
||||
this.referenceProperties = Collections.emptyList();
|
||||
this.referenceParameters = Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,12 +137,12 @@ public final class MessageAddressingProperties implements Serializable {
|
||||
}
|
||||
|
||||
/** Returns the endpoint properties. Returns an empty list of none are set. */
|
||||
public List getReferenceProperties() {
|
||||
public List<Node> getReferenceProperties() {
|
||||
return Collections.unmodifiableList(referenceProperties);
|
||||
}
|
||||
|
||||
/** Returns the endpoint parameters. Returns an empty list of none are set. */
|
||||
public List getReferenceParameters() {
|
||||
public List<Node> getReferenceParameters() {
|
||||
return Collections.unmodifiableList(referenceParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class AbstractActionEndpointMapping extends AbstractAddressingEn
|
||||
public static final String DEFAULT_FAULT_ACTION_SUFFIX = "Fault";
|
||||
|
||||
// keys are action URIs, values are endpoints
|
||||
private final Map endpointMap = new HashMap();
|
||||
private final Map<URI, Object> endpointMap = new HashMap<URI, Object>();
|
||||
|
||||
private String outputActionSuffix = DEFAULT_OUTPUT_ACTION_SUFFIX;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,14 +44,14 @@ public abstract class AbstractActionMethodEndpointMapping extends AbstractAction
|
||||
protected void registerMethods(Object endpoint) {
|
||||
Assert.notNull(endpoint, "'endpoint' must not be null");
|
||||
Method[] methods = AopUtils.getTargetClass(endpoint).getMethods();
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (JdkVersion.isAtLeastJava15() && methods[i].isSynthetic() ||
|
||||
methods[i].getDeclaringClass().equals(Object.class)) {
|
||||
for (Method method : methods) {
|
||||
if (JdkVersion.isAtLeastJava15() && method.isSynthetic() ||
|
||||
method.getDeclaringClass().equals(Object.class)) {
|
||||
continue;
|
||||
}
|
||||
URI action = getActionForMethod(methods[i]);
|
||||
URI action = getActionForMethod(method);
|
||||
if (action != null) {
|
||||
registerEndpoint(action, new MethodEndpoint(endpoint, methods[i]));
|
||||
registerEndpoint(action, new MethodEndpoint(endpoint, method));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public abstract class AbstractActionMethodEndpointMapping extends AbstractAction
|
||||
* @param endpoint the bean instance (might be an AOP proxy)
|
||||
* @return the bean class to expose
|
||||
*/
|
||||
protected Class getEndpointClass(Object endpoint) {
|
||||
protected Class<?> getEndpointClass(Object endpoint) {
|
||||
return AopUtils.getTargetClass(endpoint);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -171,12 +171,12 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
|
||||
public final EndpointInvocationChain getEndpoint(MessageContext messageContext) throws TransformerException {
|
||||
Assert.isInstanceOf(SoapMessage.class, messageContext.getRequest());
|
||||
SoapMessage request = (SoapMessage) messageContext.getRequest();
|
||||
for (int i = 0; i < versions.length; i++) {
|
||||
if (supports(versions[i], request)) {
|
||||
for (AddressingVersion version : versions) {
|
||||
if (supports(version, request)) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Request [" + request + "] uses [" + versions[i] + "]");
|
||||
logger.debug("Request [" + request + "] uses [" + version + "]");
|
||||
}
|
||||
MessageAddressingProperties requestMap = versions[i].getMessageAddressingProperties(request);
|
||||
MessageAddressingProperties requestMap = version.getMessageAddressingProperties(request);
|
||||
if (requestMap == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
|
||||
if (endpoint == null) {
|
||||
return null;
|
||||
}
|
||||
return getEndpointInvocationChain(endpoint, versions[i], requestMap);
|
||||
return getEndpointInvocationChain(endpoint, version, requestMap);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -212,8 +212,8 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
|
||||
private boolean supports(AddressingVersion version, SoapMessage request) {
|
||||
SoapHeader header = request.getSoapHeader();
|
||||
if (header != null) {
|
||||
for (Iterator iterator = header.examineAllHeaderElements(); iterator.hasNext();) {
|
||||
SoapHeaderElement headerElement = (SoapHeaderElement) iterator.next();
|
||||
for (Iterator<SoapHeaderElement> iterator = header.examineAllHeaderElements(); iterator.hasNext();) {
|
||||
SoapHeaderElement headerElement = iterator.next();
|
||||
if (version.understands(headerElement)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,9 +19,6 @@ package org.springframework.ws.soap.addressing.server;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
import org.springframework.ws.soap.SoapHeaderElement;
|
||||
@@ -34,6 +31,9 @@ import org.springframework.ws.soap.server.SoapEndpointInterceptor;
|
||||
import org.springframework.ws.transport.WebServiceConnection;
|
||||
import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* {@link SoapEndpointInterceptor} implementation that deals with WS-Addressing headers. Stateful, and instatiated by
|
||||
* the {@link AbstractAddressingEndpointMapping}.
|
||||
@@ -147,12 +147,12 @@ class AddressingEndpointInterceptor implements SoapEndpointInterceptor {
|
||||
}
|
||||
|
||||
boolean supported = false;
|
||||
for (int i = 0; i < messageSenders.length; i++) {
|
||||
if (messageSenders[i].supports(replyEpr.getAddress())) {
|
||||
for (WebServiceMessageSender messageSender : messageSenders) {
|
||||
if (messageSender.supports(replyEpr.getAddress())) {
|
||||
supported = true;
|
||||
WebServiceConnection connection = null;
|
||||
try {
|
||||
connection = messageSenders[i].createConnection(replyEpr.getAddress());
|
||||
connection = messageSender.createConnection(replyEpr.getAddress());
|
||||
connection.send(messageContext.getResponse());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class AnnotationActionEndpointMapping extends AbstractActionMethodEndpoin
|
||||
@Override
|
||||
protected URI getEndpointAddress(Object endpoint) {
|
||||
MethodEndpoint methodEndpoint = (MethodEndpoint) endpoint;
|
||||
Class endpointClass = methodEndpoint.getMethod().getDeclaringClass();
|
||||
Class<?> endpointClass = methodEndpoint.getMethod().getDeclaringClass();
|
||||
Address address = AnnotationUtils.findAnnotation(endpointClass, Address.class);
|
||||
if (address != null && StringUtils.hasText(address.value())) {
|
||||
return getActionUri(address.value(), methodEndpoint);
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.ws.soap.addressing.server;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -52,7 +51,7 @@ import org.springframework.beans.BeansException;
|
||||
public class SimpleActionEndpointMapping extends AbstractActionEndpointMapping {
|
||||
|
||||
// contents will be copied over to endpointMap
|
||||
private final Map actionMap = new HashMap();
|
||||
private final Map<URI, Object> actionMap = new HashMap();
|
||||
|
||||
private URI address;
|
||||
|
||||
@@ -73,10 +72,8 @@ public class SimpleActionEndpointMapping extends AbstractActionEndpointMapping {
|
||||
* @param actionMap map with action URIs as keys and beans as values
|
||||
* @see #setMappings
|
||||
*/
|
||||
public void setActionMap(Map actionMap) throws URISyntaxException {
|
||||
Iterator it = actionMap.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
public void setActionMap(Map<?, Object> actionMap) throws URISyntaxException {
|
||||
for (Map.Entry<?, Object> entry : actionMap.entrySet()) {
|
||||
URI action;
|
||||
if (entry.getKey() instanceof String) {
|
||||
action = new URI((String) entry.getKey());
|
||||
@@ -115,14 +112,13 @@ public class SimpleActionEndpointMapping extends AbstractActionEndpointMapping {
|
||||
* @throws BeansException if an endpoint couldn't be registered
|
||||
* @throws IllegalStateException if there is a conflicting endpoint registered
|
||||
*/
|
||||
protected void registerEndpoints(Map actionMap) throws BeansException {
|
||||
protected void registerEndpoints(Map<URI, Object> actionMap) throws BeansException {
|
||||
if (actionMap.isEmpty()) {
|
||||
logger.warn("Neither 'actionMap' nor 'mappings' set on SimpleActionEndpointMapping");
|
||||
}
|
||||
else {
|
||||
for (Iterator iterator = actionMap.entrySet().iterator(); iterator.hasNext();) {
|
||||
Map.Entry entry = (Map.Entry) iterator.next();
|
||||
URI action = (URI) entry.getKey();
|
||||
for (Map.Entry<URI, Object> entry : actionMap.entrySet()) {
|
||||
URI action = entry.getKey();
|
||||
Object endpoint = entry.getValue();
|
||||
// Remove whitespace from endpoint bean name.
|
||||
if (endpoint instanceof String) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -182,12 +181,12 @@ public abstract class AbstractAddressingVersion extends TransformerObjectSupport
|
||||
if (address == null) {
|
||||
return null;
|
||||
}
|
||||
List referenceProperties =
|
||||
List<Node> referenceProperties =
|
||||
referencePropertiesExpression != null ? referencePropertiesExpression.evaluateAsNodeList(node) :
|
||||
Collections.EMPTY_LIST;
|
||||
List referenceParameters =
|
||||
Collections.<Node>emptyList();
|
||||
List<Node> referenceParameters =
|
||||
referenceParametersExpression != null ? referenceParametersExpression.evaluateAsNodeList(node) :
|
||||
Collections.EMPTY_LIST;
|
||||
Collections.<Node>emptyList();
|
||||
return new EndpointReference(address, referenceProperties, referenceParameters);
|
||||
}
|
||||
|
||||
@@ -268,10 +267,9 @@ public abstract class AbstractAddressingVersion extends TransformerObjectSupport
|
||||
}
|
||||
}
|
||||
|
||||
protected void addReferenceNodes(Result result, List nodes) {
|
||||
protected void addReferenceNodes(Result result, List<Node> nodes) {
|
||||
try {
|
||||
for (Iterator iterator = nodes.iterator(); iterator.hasNext();) {
|
||||
Node node = (Node) iterator.next();
|
||||
for (Node node : nodes) {
|
||||
DOMSource source = new DOMSource(node);
|
||||
transform(source, result);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,12 +18,14 @@ package org.springframework.ws.soap.axiom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.stream.XMLStreamConstants;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
import org.apache.axiom.om.OMAttribute;
|
||||
import org.apache.axiom.om.OMContainer;
|
||||
import org.apache.axiom.om.OMElement;
|
||||
@@ -35,9 +37,6 @@ import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
/**
|
||||
* Specific SAX {@link ContentHandler} and {@link LexicalHandler} that adds the resulting AXIOM OMElement to a specified
|
||||
* parent element when <code>endDocument</code> is called. Used for returing <code>SAXResult</code>s from Axiom
|
||||
@@ -46,13 +45,14 @@ import org.springframework.xml.namespace.QNameUtils;
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
class AxiomHandler implements ContentHandler, LexicalHandler {
|
||||
|
||||
private final OMFactory factory;
|
||||
|
||||
private final List elements = new ArrayList();
|
||||
private final List<OMContainer> elements = new ArrayList<OMContainer>();
|
||||
|
||||
private Map namespaces = new HashMap();
|
||||
private Map<String, String> namespaces = new HashMap<String, String>();
|
||||
|
||||
private final OMContainer container;
|
||||
|
||||
@@ -85,9 +85,8 @@ class AxiomHandler implements ContentHandler, LexicalHandler {
|
||||
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
|
||||
OMContainer parent = getParent();
|
||||
OMElement element = factory.createOMElement(localName, null, parent);
|
||||
for (Iterator iterator = namespaces.entrySet().iterator(); iterator.hasNext();) {
|
||||
Map.Entry entry = (Map.Entry) iterator.next();
|
||||
String prefix = (String) entry.getKey();
|
||||
for (Map.Entry<String, String> entry : namespaces.entrySet()) {
|
||||
String prefix = entry.getKey();
|
||||
if (prefix.length() == 0) {
|
||||
element.declareDefaultNamespace((String) entry.getValue());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,11 +20,14 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.ws.soap.SoapHeaderElement;
|
||||
import org.springframework.ws.soap.soap11.Soap11Header;
|
||||
|
||||
import org.apache.axiom.soap.RolePlayer;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPHeader;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.ws.soap.soap11.Soap11Header;
|
||||
import org.apache.axiom.soap.SOAPHeaderBlock;
|
||||
|
||||
/**
|
||||
* Axiom-specific version of <code>org.springframework.ws.soap.Soap11Header</code>.
|
||||
@@ -38,12 +41,13 @@ class AxiomSoap11Header extends AxiomSoapHeader implements Soap11Header {
|
||||
super(axiomHeader, axiomFactory);
|
||||
}
|
||||
|
||||
public Iterator examineHeaderElementsToProcess(final String[] actors) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(final String[] actors) {
|
||||
RolePlayer rolePlayer = null;
|
||||
if (!ObjectUtils.isEmpty(actors)) {
|
||||
rolePlayer = new RolePlayer() {
|
||||
|
||||
public List getRoles() {
|
||||
public List<?> getRoles() {
|
||||
return Arrays.asList(actors);
|
||||
}
|
||||
|
||||
@@ -52,7 +56,7 @@ class AxiomSoap11Header extends AxiomSoapHeader implements Soap11Header {
|
||||
}
|
||||
};
|
||||
}
|
||||
Iterator result = getAxiomHeader().getHeadersToProcess(rolePlayer);
|
||||
Iterator<SOAPHeaderBlock> result = (Iterator<SOAPHeaderBlock>)getAxiomHeader().getHeadersToProcess(rolePlayer);
|
||||
return new AxiomSoapHeaderElementIterator(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,11 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.ws.soap.axiom.support.AxiomUtils;
|
||||
import org.springframework.ws.soap.soap12.Soap12Fault;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
import org.apache.axiom.om.OMNamespace;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPFault;
|
||||
@@ -32,10 +37,6 @@ import org.apache.axiom.soap.SOAPFaultSubCode;
|
||||
import org.apache.axiom.soap.SOAPFaultText;
|
||||
import org.apache.axiom.soap.SOAPFaultValue;
|
||||
import org.apache.axiom.soap.SOAPProcessingException;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.ws.soap.axiom.support.AxiomUtils;
|
||||
import org.springframework.ws.soap.soap12.Soap12Fault;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
/** Axiom-specific version of <code>org.springframework.ws.soap.Soap12Fault</code>. */
|
||||
class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
|
||||
@@ -48,8 +49,8 @@ class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
|
||||
return getAxiomFault().getCode().getValue().getTextAsQName();
|
||||
}
|
||||
|
||||
public Iterator getFaultSubcodes() {
|
||||
List subcodes = new ArrayList();
|
||||
public Iterator<QName> getFaultSubcodes() {
|
||||
List<QName> subcodes = new ArrayList<QName>();
|
||||
SOAPFaultSubCode subcode = getAxiomFault().getCode().getSubCode();
|
||||
while (subcode != null) {
|
||||
subcodes.add(subcode.getValue().getTextAsQName());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,12 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.ws.soap.SoapHeaderElement;
|
||||
import org.springframework.ws.soap.SoapHeaderException;
|
||||
import org.springframework.ws.soap.soap12.Soap12Header;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
import org.apache.axiom.om.OMElement;
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.om.OMNamespace;
|
||||
@@ -29,11 +35,6 @@ import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPHeader;
|
||||
import org.apache.axiom.soap.SOAPHeaderBlock;
|
||||
import org.apache.axiom.soap.SOAPProcessingException;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.ws.soap.SoapHeaderElement;
|
||||
import org.springframework.ws.soap.SoapHeaderException;
|
||||
import org.springframework.ws.soap.soap12.Soap12Header;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
/**
|
||||
* Axiom-specific version of <code>org.springframework.ws.soap.Soap12Header</code>.
|
||||
@@ -64,10 +65,10 @@ class AxiomSoap12Header extends AxiomSoapHeader implements Soap12Header {
|
||||
public SoapHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris) {
|
||||
try {
|
||||
SOAPHeaderBlock upgrade = getAxiomHeader().addHeaderBlock("Upgrade", getAxiomHeader().getNamespace());
|
||||
for (int i = 0; i < supportedSoapUris.length; i++) {
|
||||
for (String supportedSoapUri : supportedSoapUris) {
|
||||
OMElement supportedEnvelope = getAxiomFactory()
|
||||
.createOMElement("SupportedEnvelope", getAxiomHeader().getNamespace(), upgrade);
|
||||
OMNamespace namespace = supportedEnvelope.declareNamespace(supportedSoapUris[i], "");
|
||||
OMNamespace namespace = supportedEnvelope.declareNamespace(supportedSoapUri, "");
|
||||
supportedEnvelope.addAttribute("qname", namespace.getPrefix() + ":Envelope", null);
|
||||
}
|
||||
return new AxiomSoapHeaderElement(upgrade, getAxiomFactory());
|
||||
@@ -77,13 +78,14 @@ class AxiomSoap12Header extends AxiomSoapHeader implements Soap12Header {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator examineHeaderElementsToProcess(final String[] roles, final boolean isUltimateDestination)
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(final String[] roles, final boolean isUltimateDestination)
|
||||
throws SoapHeaderException {
|
||||
RolePlayer rolePlayer = null;
|
||||
if (!ObjectUtils.isEmpty(roles)) {
|
||||
rolePlayer = new RolePlayer() {
|
||||
|
||||
public List getRoles() {
|
||||
public List<?> getRoles() {
|
||||
return Arrays.asList(roles);
|
||||
}
|
||||
|
||||
@@ -92,7 +94,7 @@ class AxiomSoap12Header extends AxiomSoapHeader implements Soap12Header {
|
||||
}
|
||||
};
|
||||
}
|
||||
Iterator result = getAxiomHeader().getHeadersToProcess(rolePlayer);
|
||||
Iterator<SOAPHeaderBlock> result = (Iterator<SOAPHeaderBlock>)getAxiomHeader().getHeadersToProcess(rolePlayer);
|
||||
return new AxiomSoapHeaderElementIterator(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,17 +22,17 @@ import java.util.List;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.ws.soap.SoapElement;
|
||||
import org.springframework.xml.transform.StaxSource;
|
||||
|
||||
import org.apache.axiom.om.OMAttribute;
|
||||
import org.apache.axiom.om.OMElement;
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.om.OMNamespace;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.ws.soap.SoapElement;
|
||||
import org.springframework.xml.transform.StaxSource;
|
||||
|
||||
/**
|
||||
* Axiom-specific version of {@link SoapElement}.
|
||||
*
|
||||
@@ -102,10 +102,10 @@ class AxiomSoapElement implements SoapElement {
|
||||
}
|
||||
}
|
||||
|
||||
public final Iterator getAllAttributes() {
|
||||
public final Iterator<QName> getAllAttributes() {
|
||||
try {
|
||||
List results = new ArrayList();
|
||||
for (Iterator iterator = getAxiomElement().getAllAttributes(); iterator.hasNext();) {
|
||||
List<QName> results = new ArrayList<QName>();
|
||||
for (Iterator<?> iterator = getAxiomElement().getAllAttributes(); iterator.hasNext();) {
|
||||
OMAttribute attribute = (OMAttribute) iterator.next();
|
||||
results.add(attribute.getQName());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,14 +20,14 @@ import java.util.Iterator;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.Result;
|
||||
|
||||
import org.springframework.ws.soap.SoapFaultDetail;
|
||||
import org.springframework.ws.soap.SoapFaultDetailElement;
|
||||
|
||||
import org.apache.axiom.om.OMElement;
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPFaultDetail;
|
||||
|
||||
import org.springframework.ws.soap.SoapFaultDetail;
|
||||
import org.springframework.ws.soap.SoapFaultDetailElement;
|
||||
|
||||
/**
|
||||
* Axiom-specific version of <code>org.springframework.ws.soap.SoapFaultDetail</code>.
|
||||
*
|
||||
@@ -51,7 +51,7 @@ class AxiomSoapFaultDetail extends AxiomSoapElement implements SoapFaultDetail {
|
||||
|
||||
}
|
||||
|
||||
public Iterator getDetailEntries() {
|
||||
public Iterator<SoapFaultDetailElement> getDetailEntries() {
|
||||
return new AxiomSoapFaultDetailElementIterator(getAxiomFaultDetail().getChildElements());
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ class AxiomSoapFaultDetail extends AxiomSoapElement implements SoapFaultDetail {
|
||||
return (SOAPFaultDetail) getAxiomElement();
|
||||
}
|
||||
|
||||
private class AxiomSoapFaultDetailElementIterator implements Iterator {
|
||||
private class AxiomSoapFaultDetailElementIterator implements Iterator<SoapFaultDetailElement> {
|
||||
|
||||
private final Iterator axiomIterator;
|
||||
private final Iterator<OMElement> axiomIterator;
|
||||
|
||||
private AxiomSoapFaultDetailElementIterator(Iterator axiomIterator) {
|
||||
private AxiomSoapFaultDetailElementIterator(Iterator<OMElement> axiomIterator) {
|
||||
this.axiomIterator = axiomIterator;
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ class AxiomSoapFaultDetail extends AxiomSoapElement implements SoapFaultDetail {
|
||||
return axiomIterator.hasNext();
|
||||
}
|
||||
|
||||
public Object next() {
|
||||
public SoapFaultDetailElement next() {
|
||||
try {
|
||||
OMElement axiomElement = (OMElement) axiomIterator.next();
|
||||
OMElement axiomElement = axiomIterator.next();
|
||||
return new AxiomSoapFaultDetailElement(axiomElement, getAxiomFactory());
|
||||
}
|
||||
catch (OMException ex) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,11 @@ import java.util.Iterator;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.Result;
|
||||
|
||||
import org.springframework.ws.soap.SoapHeader;
|
||||
import org.springframework.ws.soap.SoapHeaderElement;
|
||||
import org.springframework.ws.soap.SoapHeaderException;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
import org.apache.axiom.om.OMElement;
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.om.OMNamespace;
|
||||
@@ -27,11 +32,6 @@ import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPHeader;
|
||||
import org.apache.axiom.soap.SOAPHeaderBlock;
|
||||
|
||||
import org.springframework.ws.soap.SoapHeader;
|
||||
import org.springframework.ws.soap.SoapHeaderElement;
|
||||
import org.springframework.ws.soap.SoapHeaderException;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
/**
|
||||
* Axiom-specific version of <code>org.springframework.ws.soap.SoapHeader</code>.
|
||||
*
|
||||
@@ -72,7 +72,8 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator examineMustUnderstandHeaderElements(String role) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SoapHeaderElement> examineMustUnderstandHeaderElements(String role) {
|
||||
try {
|
||||
return new AxiomSoapHeaderElementIterator(getAxiomHeader().examineMustUnderstandHeaderBlocks(role));
|
||||
}
|
||||
@@ -81,7 +82,8 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator examineAllHeaderElements() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SoapHeaderElement> examineAllHeaderElements() {
|
||||
try {
|
||||
return new AxiomSoapHeaderElementIterator(getAxiomHeader().examineAllHeaderBlocks());
|
||||
}
|
||||
@@ -90,7 +92,8 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator examineHeaderElements(QName name) throws SoapHeaderException {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SoapHeaderElement> examineHeaderElements(QName name) throws SoapHeaderException {
|
||||
try {
|
||||
return new AxiomSoapHeaderElementIterator(getAxiomHeader().getChildrenWithName(name));
|
||||
}
|
||||
@@ -103,11 +106,11 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
|
||||
return (SOAPHeader) getAxiomElement();
|
||||
}
|
||||
|
||||
protected class AxiomSoapHeaderElementIterator implements Iterator {
|
||||
protected class AxiomSoapHeaderElementIterator implements Iterator<SoapHeaderElement> {
|
||||
|
||||
private final Iterator axiomIterator;
|
||||
private final Iterator<SOAPHeaderBlock> axiomIterator;
|
||||
|
||||
protected AxiomSoapHeaderElementIterator(Iterator axiomIterator) {
|
||||
protected AxiomSoapHeaderElementIterator(Iterator<SOAPHeaderBlock> axiomIterator) {
|
||||
this.axiomIterator = axiomIterator;
|
||||
}
|
||||
|
||||
@@ -115,9 +118,9 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
|
||||
return axiomIterator.hasNext();
|
||||
}
|
||||
|
||||
public Object next() {
|
||||
public SoapHeaderElement next() {
|
||||
try {
|
||||
SOAPHeaderBlock axiomHeaderBlock = (SOAPHeaderBlock) axiomIterator.next();
|
||||
SOAPHeaderBlock axiomHeaderBlock = axiomIterator.next();
|
||||
return new AxiomSoapHeaderElement(axiomHeaderBlock, getAxiomFactory());
|
||||
}
|
||||
catch (OMException ex) {
|
||||
|
||||
@@ -55,6 +55,7 @@ import org.apache.axiom.soap.SOAPProcessingException;
|
||||
* @see SOAPMessage
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
public class AxiomSoapMessage extends AbstractSoapMessage {
|
||||
|
||||
private static final String EMPTY_SOAP_ACTION = "\"\"";
|
||||
@@ -210,7 +211,7 @@ public class AxiomSoapMessage extends AbstractSoapMessage {
|
||||
return dataHandler != null ? new AxiomAttachment(contentId, dataHandler) : null;
|
||||
}
|
||||
|
||||
public Iterator getAttachments() {
|
||||
public Iterator<Attachment> getAttachments() {
|
||||
return new AxiomAttachmentIterator();
|
||||
}
|
||||
|
||||
@@ -321,10 +322,11 @@ public class AxiomSoapMessage extends AbstractSoapMessage {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private class AxiomAttachmentIterator implements Iterator {
|
||||
private class AxiomAttachmentIterator implements Iterator<Attachment> {
|
||||
|
||||
private final Iterator iterator;
|
||||
private final Iterator<String> iterator;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private AxiomAttachmentIterator() {
|
||||
iterator = attachments.getContentIDSet().iterator();
|
||||
}
|
||||
@@ -333,8 +335,8 @@ public class AxiomSoapMessage extends AbstractSoapMessage {
|
||||
return iterator.hasNext();
|
||||
}
|
||||
|
||||
public Object next() {
|
||||
String contentId = (String) iterator.next();
|
||||
public Attachment next() {
|
||||
String contentId = iterator.next();
|
||||
DataHandler dataHandler = attachments.getDataHandler(contentId);
|
||||
return new AxiomAttachment(contentId, dataHandler);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
* @see #setPayloadCaching(boolean)
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
public class AxiomSoapMessageFactory implements SoapMessageFactory, InitializingBean {
|
||||
|
||||
private static final String CHARSET_PARAMETER = "charset";
|
||||
@@ -228,9 +229,9 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
|
||||
|
||||
private String getHeaderValue(TransportInputStream transportInputStream, String header) throws IOException {
|
||||
String contentType = null;
|
||||
Iterator iterator = transportInputStream.getHeaders(header);
|
||||
Iterator<String> iterator = transportInputStream.getHeaders(header);
|
||||
if (iterator.hasNext()) {
|
||||
contentType = (String) iterator.next();
|
||||
contentType = iterator.next();
|
||||
}
|
||||
return contentType;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.apache.axiom.soap.SOAPFactory;
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.2
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
class CachingPayload extends Payload {
|
||||
|
||||
CachingPayload(SOAPBody axiomBody, SOAPFactory axiomFactory) {
|
||||
|
||||
@@ -24,6 +24,8 @@ import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
import javax.xml.transform.Result;
|
||||
|
||||
import org.springframework.xml.transform.StaxResult;
|
||||
|
||||
import org.apache.axiom.om.OMDataSource;
|
||||
import org.apache.axiom.om.OMElement;
|
||||
import org.apache.axiom.om.OMNamespace;
|
||||
@@ -32,8 +34,6 @@ import org.apache.axiom.om.util.StAXUtils;
|
||||
import org.apache.axiom.soap.SOAPBody;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
|
||||
import org.springframework.xml.transform.StaxResult;
|
||||
|
||||
/**
|
||||
* Non-caching payload in Axiom.
|
||||
*
|
||||
@@ -41,6 +41,7 @@ import org.springframework.xml.transform.StaxResult;
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.2
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
class NonCachingPayload extends Payload {
|
||||
|
||||
private static final int BUF_SIZE = 1024;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,15 +20,15 @@ import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.soap.axiom.support.AxiomUtils;
|
||||
import org.springframework.xml.transform.StaxSource;
|
||||
|
||||
import org.apache.axiom.om.OMElement;
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.soap.SOAPBody;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.soap.axiom.support.AxiomUtils;
|
||||
import org.springframework.xml.transform.StaxSource;
|
||||
|
||||
/**
|
||||
* Abstract base class for payloads in Axiom. Comes in two flavors: {@link CachingPayload} and {@link
|
||||
* NonCachingPayload}.
|
||||
@@ -36,6 +36,7 @@ import org.springframework.xml.transform.StaxSource;
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.2
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
abstract class Payload {
|
||||
|
||||
private final SOAPBody axiomBody;
|
||||
|
||||
@@ -26,6 +26,10 @@ import javax.xml.namespace.QName;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
import org.apache.axiom.om.OMContainer;
|
||||
import org.apache.axiom.om.OMElement;
|
||||
import org.apache.axiom.om.OMException;
|
||||
@@ -40,10 +44,6 @@ import org.w3c.dom.ls.DOMImplementationLS;
|
||||
import org.w3c.dom.ls.LSOutput;
|
||||
import org.w3c.dom.ls.LSSerializer;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
/**
|
||||
* Collection of generic utility methods to work with Axiom. Includes conversion from <code>OMNamespace</code>s to
|
||||
* <code>QName</code>s.
|
||||
@@ -54,6 +54,7 @@ import org.springframework.xml.namespace.QNameUtils;
|
||||
* @see javax.xml.namespace.QName
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("Since15")
|
||||
public abstract class AxiomUtils {
|
||||
|
||||
/**
|
||||
@@ -103,7 +104,7 @@ public abstract class AxiomUtils {
|
||||
|
||||
/** Removes the contents (i.e. children) of the container. */
|
||||
public static void removeContents(OMContainer container) {
|
||||
for (Iterator iterator = container.getChildren(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = container.getChildren(); iterator.hasNext();) {
|
||||
OMNode child = (OMNode) iterator.next();
|
||||
child.detach();
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@ import javax.xml.transform.Source;
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
import javax.xml.transform.sax.SAXSource;
|
||||
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.ws.soap.SoapVersion;
|
||||
@@ -55,6 +53,8 @@ import org.springframework.ws.transport.TransportConstants;
|
||||
import org.springframework.ws.transport.TransportOutputStream;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* SAAJ 1.1 specific implementation of the <code>SaajImplementation</code> interface.
|
||||
*
|
||||
@@ -116,9 +116,9 @@ class Saaj11Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAllAttibutes(SOAPElement element) {
|
||||
List results = new ArrayList();
|
||||
for (Iterator iterator = element.getAllAttributes(); iterator.hasNext();) {
|
||||
public Iterator<QName> getAllAttributes(SOAPElement element) {
|
||||
List<QName> results = new ArrayList<QName>();
|
||||
for (Iterator<?> iterator = element.getAllAttributes(); iterator.hasNext();) {
|
||||
Name attributeName = (Name) iterator.next();
|
||||
results.add(SaajUtils.toQName(attributeName));
|
||||
}
|
||||
@@ -193,15 +193,23 @@ class Saaj11Implementation extends SaajImplementation {
|
||||
|
||||
/** Returns all header elements. */
|
||||
@Override
|
||||
public Iterator examineAllHeaderElements(SOAPHeader header) {
|
||||
return header.getChildElements();
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SOAPHeaderElement> examineAllHeaderElements(SOAPHeader header) {
|
||||
List<SOAPHeaderElement> result = new ArrayList<SOAPHeaderElement>();
|
||||
for (Iterator<?> iterator = header.getChildElements(); iterator.hasNext();) {
|
||||
Object o = iterator.next();
|
||||
if (o instanceof SOAPHeaderElement) {
|
||||
result.add((SOAPHeaderElement) o);
|
||||
}
|
||||
}
|
||||
return result.iterator();
|
||||
}
|
||||
|
||||
/** Returns all header elements for which the must understand attribute is true, given the actor or role. */
|
||||
@Override
|
||||
public Iterator examineMustUnderstandHeaderElements(SOAPHeader header, String actorOrRole) {
|
||||
List result = new ArrayList();
|
||||
for (Iterator iterator = header.examineHeaderElements(actorOrRole); iterator.hasNext();) {
|
||||
public Iterator<SOAPHeaderElement> examineMustUnderstandHeaderElements(SOAPHeader header, String actorOrRole) {
|
||||
List<SOAPHeaderElement> result = new ArrayList<SOAPHeaderElement>();
|
||||
for (Iterator<?> iterator = header.examineHeaderElements(actorOrRole); iterator.hasNext();) {
|
||||
SOAPHeaderElement headerElement = (SOAPHeaderElement) iterator.next();
|
||||
if (headerElement.getMustUnderstand()) {
|
||||
result.add(headerElement);
|
||||
@@ -289,13 +297,14 @@ class Saaj11Implementation extends SaajImplementation {
|
||||
|
||||
/** Returns an iteration over all detail entries. */
|
||||
@Override
|
||||
public Iterator getDetailEntries(Detail detail) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<DetailEntry> getDetailEntries(Detail detail) {
|
||||
return detail.getDetailEntries();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement getFirstBodyElement(SOAPBody body) {
|
||||
for (Iterator iterator = body.getChildElements(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = body.getChildElements(); iterator.hasNext();) {
|
||||
Object child = iterator.next();
|
||||
if (child instanceof SOAPElement) {
|
||||
return (SOAPElement) child;
|
||||
@@ -306,14 +315,15 @@ class Saaj11Implementation extends SaajImplementation {
|
||||
|
||||
@Override
|
||||
public void removeContents(SOAPElement element) {
|
||||
for (Iterator iterator = element.getChildElements(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = element.getChildElements(); iterator.hasNext();) {
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
Iterator getChildElements(SOAPElement element, QName name) throws SOAPException {
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterator<SOAPElement> getChildElements(SOAPElement element, QName name) throws SOAPException {
|
||||
Name elementName = SaajUtils.toName(name, element);
|
||||
return element.getChildElements(elementName);
|
||||
}
|
||||
@@ -338,7 +348,7 @@ class Saaj11Implementation extends SaajImplementation {
|
||||
message.saveChanges();
|
||||
}
|
||||
}
|
||||
for (Iterator iterator = headers.getAllHeaders(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = headers.getAllHeaders(); iterator.hasNext();) {
|
||||
MimeHeader mimeHeader = (MimeHeader) iterator.next();
|
||||
transportOutputStream.addHeader(mimeHeader.getName(), mimeHeader.getValue());
|
||||
}
|
||||
@@ -353,12 +363,14 @@ class Saaj11Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAttachments(SOAPMessage message) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<AttachmentPart> getAttachments(SOAPMessage message) {
|
||||
return message.getAttachments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAttachment(SOAPMessage message, MimeHeaders mimeHeaders) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<AttachmentPart> getAttachment(SOAPMessage message, MimeHeaders mimeHeaders) {
|
||||
return message.getAttachments(mimeHeaders);
|
||||
}
|
||||
|
||||
@@ -394,7 +406,7 @@ class Saaj11Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getFaultSubcodes(SOAPFault fault) {
|
||||
public Iterator<QName> getFaultSubcodes(SOAPFault fault) {
|
||||
throw new UnsupportedOperationException("SAAJ 1.1 does not support SOAP 1.2");
|
||||
}
|
||||
|
||||
|
||||
@@ -132,9 +132,9 @@ class Saaj12Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAllAttibutes(SOAPElement element) {
|
||||
List results = new ArrayList();
|
||||
for (Iterator iterator = element.getAllAttributes(); iterator.hasNext();) {
|
||||
public Iterator<QName> getAllAttributes(SOAPElement element) {
|
||||
List<QName> results = new ArrayList<QName>();
|
||||
for (Iterator<?> iterator = element.getAllAttributes(); iterator.hasNext();) {
|
||||
Name attributeName = (Name) iterator.next();
|
||||
results.add(SaajUtils.toQName(attributeName));
|
||||
}
|
||||
@@ -167,12 +167,14 @@ class Saaj12Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator examineAllHeaderElements(SOAPHeader header) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SOAPHeaderElement> examineAllHeaderElements(SOAPHeader header) {
|
||||
return header.examineAllHeaderElements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator examineMustUnderstandHeaderElements(SOAPHeader header, String actorOrRole) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SOAPHeaderElement> examineMustUnderstandHeaderElements(SOAPHeader header, String actorOrRole) {
|
||||
return header.examineMustUnderstandHeaderElements(actorOrRole);
|
||||
}
|
||||
|
||||
@@ -242,13 +244,14 @@ class Saaj12Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getDetailEntries(Detail detail) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<DetailEntry> getDetailEntries(Detail detail) {
|
||||
return detail.getDetailEntries();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement getFirstBodyElement(SOAPBody body) {
|
||||
for (Iterator iterator = body.getChildElements(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = body.getChildElements(); iterator.hasNext();) {
|
||||
Object child = iterator.next();
|
||||
if (child instanceof SOAPElement) {
|
||||
return (SOAPElement) child;
|
||||
@@ -263,7 +266,8 @@ class Saaj12Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
Iterator getChildElements(SOAPElement element, QName name) throws SOAPException {
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterator<SOAPElement> getChildElements(SOAPElement element, QName name) throws SOAPException {
|
||||
Name elementName = SaajUtils.toName(name, element);
|
||||
return element.getChildElements(elementName);
|
||||
}
|
||||
@@ -288,7 +292,7 @@ class Saaj12Implementation extends SaajImplementation {
|
||||
message.saveChanges();
|
||||
}
|
||||
}
|
||||
for (Iterator iterator = headers.getAllHeaders(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = headers.getAllHeaders(); iterator.hasNext();) {
|
||||
MimeHeader mimeHeader = (MimeHeader) iterator.next();
|
||||
transportOutputStream.addHeader(mimeHeader.getName(), mimeHeader.getValue());
|
||||
}
|
||||
@@ -303,12 +307,14 @@ class Saaj12Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAttachments(SOAPMessage message) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<AttachmentPart> getAttachments(SOAPMessage message) {
|
||||
return message.getAttachments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAttachment(SOAPMessage message, MimeHeaders mimeHeaders) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<AttachmentPart> getAttachment(SOAPMessage message, MimeHeaders mimeHeaders) {
|
||||
return message.getAttachments(mimeHeaders);
|
||||
}
|
||||
|
||||
@@ -344,7 +350,7 @@ class Saaj12Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getFaultSubcodes(SOAPFault fault) {
|
||||
public Iterator<QName> getFaultSubcodes(SOAPFault fault) {
|
||||
throw new UnsupportedOperationException("SAAJ 1.2 does not support SOAP 1.2");
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,8 @@ class Saaj13Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getFaultSubcodes(SOAPFault fault) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<QName> getFaultSubcodes(SOAPFault fault) {
|
||||
return fault.getFaultSubcodes();
|
||||
}
|
||||
|
||||
@@ -184,7 +185,8 @@ class Saaj13Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAllAttibutes(SOAPElement element) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<QName> getAllAttributes(SOAPElement element) {
|
||||
return element.getAllAttributesAsQNames();
|
||||
}
|
||||
|
||||
@@ -204,12 +206,14 @@ class Saaj13Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator examineAllHeaderElements(SOAPHeader header) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SOAPHeaderElement> examineAllHeaderElements(SOAPHeader header) {
|
||||
return header.examineAllHeaderElements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator examineMustUnderstandHeaderElements(SOAPHeader header, String actorOrRole) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SOAPHeaderElement> examineMustUnderstandHeaderElements(SOAPHeader header, String actorOrRole) {
|
||||
return header.examineMustUnderstandHeaderElements(actorOrRole);
|
||||
}
|
||||
|
||||
@@ -279,13 +283,14 @@ class Saaj13Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getDetailEntries(Detail detail) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<DetailEntry> getDetailEntries(Detail detail) {
|
||||
return detail.getDetailEntries();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement getFirstBodyElement(SOAPBody body) {
|
||||
for (Iterator iterator = body.getChildElements(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = body.getChildElements(); iterator.hasNext();) {
|
||||
Object child = iterator.next();
|
||||
if (child instanceof SOAPElement) {
|
||||
return (SOAPElement) child;
|
||||
@@ -300,7 +305,8 @@ class Saaj13Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
Iterator getChildElements(SOAPElement element, QName name) throws SOAPException {
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterator<SOAPElement> getChildElements(SOAPElement element, QName name) throws SOAPException {
|
||||
return element.getChildElements(name);
|
||||
}
|
||||
|
||||
@@ -331,7 +337,7 @@ class Saaj13Implementation extends SaajImplementation {
|
||||
message.saveChanges();
|
||||
}
|
||||
}
|
||||
for (Iterator iterator = headers.getAllHeaders(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = headers.getAllHeaders(); iterator.hasNext();) {
|
||||
MimeHeader mimeHeader = (MimeHeader) iterator.next();
|
||||
transportOutputStream.addHeader(mimeHeader.getName(), mimeHeader.getValue());
|
||||
}
|
||||
@@ -346,12 +352,14 @@ class Saaj13Implementation extends SaajImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAttachments(SOAPMessage message) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<AttachmentPart> getAttachments(SOAPMessage message) {
|
||||
return message.getAttachments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAttachment(SOAPMessage message, MimeHeaders mimeHeaders) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<AttachmentPart> getAttachment(SOAPMessage message, MimeHeaders mimeHeaders) {
|
||||
return message.getAttachments(mimeHeaders);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -74,13 +74,13 @@ abstract class SaajImplementation {
|
||||
abstract String getAttributeValue(SOAPElement element, QName name) throws SOAPException;
|
||||
|
||||
/** Returns all attributes as an iterator of QNames. * */
|
||||
abstract Iterator getAllAttibutes(SOAPElement element);
|
||||
abstract Iterator<QName> getAllAttributes(SOAPElement element);
|
||||
|
||||
/** Removes the contents (i.e. children) of the element. */
|
||||
abstract void removeContents(SOAPElement element);
|
||||
|
||||
/** Returns an iterator over all the child elements with the specified name. */
|
||||
abstract Iterator getChildElements(SOAPElement element, QName name) throws SOAPException;
|
||||
abstract Iterator<SOAPElement> getChildElements(SOAPElement element, QName name) throws SOAPException;
|
||||
|
||||
/** Declares a namespace. */
|
||||
abstract void addNamespaceDeclaration(SOAPElement element, String prefix, String namespaceUri) throws SOAPException;
|
||||
@@ -99,10 +99,10 @@ abstract class SaajImplementation {
|
||||
abstract MimeHeaders getMimeHeaders(SOAPMessage message);
|
||||
|
||||
/** Returns an iteration over all attachments in the message. */
|
||||
abstract Iterator getAttachments(SOAPMessage message);
|
||||
abstract Iterator<AttachmentPart> getAttachments(SOAPMessage message);
|
||||
|
||||
/** Returns an iteration over all attachments in the message with the given headers. */
|
||||
abstract Iterator getAttachment(SOAPMessage message, MimeHeaders mimeHeaders);
|
||||
abstract Iterator<AttachmentPart> getAttachment(SOAPMessage message, MimeHeaders mimeHeaders);
|
||||
|
||||
/** Adds an attachment to the given message. */
|
||||
abstract AttachmentPart addAttachmentPart(SOAPMessage message, DataHandler dataHandler);
|
||||
@@ -125,10 +125,10 @@ abstract class SaajImplementation {
|
||||
abstract SOAPHeaderElement addHeaderElement(SOAPHeader header, QName name) throws SOAPException;
|
||||
|
||||
/** Returns all header elements. */
|
||||
abstract Iterator examineAllHeaderElements(SOAPHeader header);
|
||||
abstract Iterator<SOAPHeaderElement> examineAllHeaderElements(SOAPHeader header);
|
||||
|
||||
/** Returns all header elements for which the must understand attribute is true, given the actor or role. */
|
||||
abstract Iterator examineMustUnderstandHeaderElements(SOAPHeader header, String actorOrRole);
|
||||
abstract Iterator<SOAPHeaderElement> examineMustUnderstandHeaderElements(SOAPHeader header, String actorOrRole);
|
||||
|
||||
/** Adds a not understood header element to the given header. */
|
||||
abstract SOAPHeaderElement addNotUnderstoodHeaderElement(SOAPHeader header, QName name) throws SOAPException;
|
||||
@@ -201,7 +201,7 @@ abstract class SaajImplementation {
|
||||
abstract void setFaultRole(SOAPFault fault, String role) throws SOAPException;
|
||||
|
||||
/** Returns the fault sub code. */
|
||||
abstract Iterator getFaultSubcodes(SOAPFault fault);
|
||||
abstract Iterator<QName> getFaultSubcodes(SOAPFault fault);
|
||||
|
||||
/** Adds a fault sub code. */
|
||||
abstract void appendFaultSubcode(SOAPFault fault, QName subcode) throws SOAPException;
|
||||
@@ -226,7 +226,7 @@ abstract class SaajImplementation {
|
||||
abstract DetailEntry addDetailEntry(Detail detail, QName name) throws SOAPException;
|
||||
|
||||
/** Returns an iteration over all detail entries. */
|
||||
abstract Iterator getDetailEntries(Detail detail);
|
||||
abstract Iterator<DetailEntry> getDetailEntries(Detail detail);
|
||||
|
||||
/*
|
||||
* DetailEntry
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,13 +19,13 @@ package org.springframework.ws.soap.saaj;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.xml.soap.Node;
|
||||
import javax.xml.soap.SOAPConstants;
|
||||
import javax.xml.soap.SOAPHeader;
|
||||
import javax.xml.soap.SOAPHeaderElement;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.ws.soap.SoapHeaderElement;
|
||||
import org.springframework.ws.soap.soap11.Soap11Header;
|
||||
|
||||
/**
|
||||
@@ -40,17 +40,14 @@ class SaajSoap11Header extends SaajSoapHeader implements Soap11Header {
|
||||
super(header);
|
||||
}
|
||||
|
||||
public Iterator examineHeaderElementsToProcess(String[] actors) {
|
||||
List result = new ArrayList();
|
||||
Iterator iterator = getImplementation().examineAllHeaderElements(getSaajHeader());
|
||||
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] actors) {
|
||||
List<SOAPHeaderElement> result = new ArrayList<SOAPHeaderElement>();
|
||||
Iterator<SOAPHeaderElement> iterator = getImplementation().examineAllHeaderElements(getSaajHeader());
|
||||
while (iterator.hasNext()) {
|
||||
Node node = (Node) iterator.next();
|
||||
if (node instanceof SOAPHeaderElement) {
|
||||
SOAPHeaderElement saajHeaderElement = (SOAPHeaderElement) node;
|
||||
String headerActor = saajHeaderElement.getActor();
|
||||
if (shouldProcess(headerActor, actors)) {
|
||||
result.add(saajHeaderElement);
|
||||
}
|
||||
SOAPHeaderElement saajHeaderElement = iterator.next();
|
||||
String headerActor = saajHeaderElement.getActor();
|
||||
if (shouldProcess(headerActor, actors)) {
|
||||
result.add(saajHeaderElement);
|
||||
}
|
||||
}
|
||||
return new SaajSoapHeaderElementIterator(result.iterator());
|
||||
@@ -64,8 +61,8 @@ class SaajSoap11Header extends SaajSoapHeader implements Soap11Header {
|
||||
return true;
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(actors)) {
|
||||
for (int i = 0; i < actors.length; i++) {
|
||||
if (actors[i].equals(headerActor)) {
|
||||
for (String actor : actors) {
|
||||
if (actor.equals(headerActor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,8 +64,8 @@ class SaajSoap12Body extends SaajSoapBody implements Soap12Body {
|
||||
public Soap12Fault addDataEncodingUnknownFault(QName[] subcodes, String reason, Locale locale) {
|
||||
QName name = new QName(SoapVersion.SOAP_12.getEnvelopeNamespaceUri(), "DataEncodingUnknown");
|
||||
Soap12Fault fault = addFault(name, reason, locale);
|
||||
for (int i = 0; i < subcodes.length; i++) {
|
||||
fault.addFaultSubcode(subcodes[i]);
|
||||
for (QName subcode : subcodes) {
|
||||
fault.addFaultSubcode(subcode);
|
||||
}
|
||||
return fault;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,7 +47,7 @@ class SaajSoap12Fault extends SaajSoapFault implements Soap12Fault {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator getFaultSubcodes() {
|
||||
public Iterator<QName> getFaultSubcodes() {
|
||||
return getImplementation().getFaultSubcodes(getSaajFault());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.soap.Node;
|
||||
import javax.xml.soap.SOAPConstants;
|
||||
import javax.xml.soap.SOAPException;
|
||||
import javax.xml.soap.SOAPHeader;
|
||||
@@ -66,18 +65,15 @@ class SaajSoap12Header extends SaajSoapHeader implements Soap12Header {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator examineHeaderElementsToProcess(String[] roles, boolean isUltimateDestination)
|
||||
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] roles, boolean isUltimateDestination)
|
||||
throws SoapHeaderException {
|
||||
List result = new ArrayList();
|
||||
Iterator iterator = getImplementation().examineAllHeaderElements(getSaajHeader());
|
||||
List<SOAPHeaderElement> result = new ArrayList<SOAPHeaderElement>();
|
||||
Iterator<SOAPHeaderElement> iterator = getImplementation().examineAllHeaderElements(getSaajHeader());
|
||||
while (iterator.hasNext()) {
|
||||
Node node = (Node) iterator.next();
|
||||
if (node instanceof SOAPHeaderElement) {
|
||||
SOAPHeaderElement saajHeaderElement = (SOAPHeaderElement) node;
|
||||
String headerRole = saajHeaderElement.getRole();
|
||||
if (shouldProcess(headerRole, roles, isUltimateDestination)) {
|
||||
result.add(saajHeaderElement);
|
||||
}
|
||||
SOAPHeaderElement saajHeaderElement = iterator.next();
|
||||
String headerRole = saajHeaderElement.getRole();
|
||||
if (shouldProcess(headerRole, roles, isUltimateDestination)) {
|
||||
result.add(saajHeaderElement);
|
||||
}
|
||||
}
|
||||
return new SaajSoapHeaderElementIterator(result.iterator());
|
||||
@@ -98,8 +94,8 @@ class SaajSoap12Header extends SaajSoapHeader implements Soap12Header {
|
||||
return false;
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(roles)) {
|
||||
for (int i = 0; i < roles.length; i++) {
|
||||
if (roles[i].equals(headerRole)) {
|
||||
for (String role : roles) {
|
||||
if (role.equals(headerRole)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -78,8 +78,8 @@ class SaajSoapElement implements SoapElement {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator getAllAttributes() {
|
||||
return getImplementation().getAllAttibutes(element);
|
||||
public Iterator<QName> getAllAttributes() {
|
||||
return getImplementation().getAllAttributes(element);
|
||||
}
|
||||
|
||||
public void addNamespaceDeclaration(String prefix, String namespaceUri) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,8 +55,8 @@ class SaajSoapFaultDetail extends SaajSoapElement implements SoapFaultDetail {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator getDetailEntries() {
|
||||
Iterator iterator = getImplementation().getDetailEntries(getSaajDetail());
|
||||
public Iterator<SoapFaultDetailElement> getDetailEntries() {
|
||||
Iterator<DetailEntry> iterator = getImplementation().getDetailEntries(getSaajDetail());
|
||||
return new SaajSoapFaultDetailElementIterator(iterator);
|
||||
}
|
||||
|
||||
@@ -64,11 +64,11 @@ class SaajSoapFaultDetail extends SaajSoapElement implements SoapFaultDetail {
|
||||
return (Detail) getSaajElement();
|
||||
}
|
||||
|
||||
private static class SaajSoapFaultDetailElementIterator implements Iterator {
|
||||
private static class SaajSoapFaultDetailElementIterator implements Iterator<SoapFaultDetailElement> {
|
||||
|
||||
private final Iterator iterator;
|
||||
private final Iterator<DetailEntry> iterator;
|
||||
|
||||
private SaajSoapFaultDetailElementIterator(Iterator iterator) {
|
||||
private SaajSoapFaultDetailElementIterator(Iterator<DetailEntry> iterator) {
|
||||
Assert.notNull(iterator, "No iterator given");
|
||||
this.iterator = iterator;
|
||||
}
|
||||
@@ -77,8 +77,8 @@ class SaajSoapFaultDetail extends SaajSoapElement implements SoapFaultDetail {
|
||||
return iterator.hasNext();
|
||||
}
|
||||
|
||||
public Object next() {
|
||||
DetailEntry saajDetailEntry = (DetailEntry) iterator.next();
|
||||
public SoapFaultDetailElement next() {
|
||||
DetailEntry saajDetailEntry = iterator.next();
|
||||
return new SaajSoapFaultDetailElement(saajDetailEntry);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,9 +16,7 @@
|
||||
|
||||
package org.springframework.ws.soap.saaj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPException;
|
||||
@@ -43,14 +41,14 @@ abstract class SaajSoapHeader extends SaajSoapElement implements SoapHeader {
|
||||
super(header);
|
||||
}
|
||||
|
||||
public Iterator examineAllHeaderElements() throws SoapHeaderException {
|
||||
Iterator iterator = getImplementation().examineAllHeaderElements(getSaajHeader());
|
||||
return createSaajSoapHeaderElementIterator(iterator);
|
||||
public Iterator<SoapHeaderElement> examineAllHeaderElements() throws SoapHeaderException {
|
||||
Iterator<SOAPHeaderElement> iterator = getImplementation().examineAllHeaderElements(getSaajHeader());
|
||||
return new SaajSoapHeaderElementIterator(iterator);
|
||||
}
|
||||
|
||||
public Iterator examineMustUnderstandHeaderElements(String actorOrRole) throws SoapHeaderException {
|
||||
Iterator iterator = getImplementation().examineMustUnderstandHeaderElements(getSaajHeader(), actorOrRole);
|
||||
return createSaajSoapHeaderElementIterator(iterator);
|
||||
public Iterator<SoapHeaderElement> examineMustUnderstandHeaderElements(String actorOrRole) throws SoapHeaderException {
|
||||
Iterator<SOAPHeaderElement> iterator = getImplementation().examineMustUnderstandHeaderElements(getSaajHeader(), actorOrRole);
|
||||
return new SaajSoapHeaderElementIterator(iterator);
|
||||
}
|
||||
|
||||
public SoapHeaderElement addHeaderElement(QName name) throws SoapHeaderException {
|
||||
@@ -65,9 +63,9 @@ abstract class SaajSoapHeader extends SaajSoapElement implements SoapHeader {
|
||||
|
||||
public void removeHeaderElement(QName name) throws SoapHeaderException {
|
||||
try {
|
||||
Iterator iterator = getImplementation().getChildElements(getSaajHeader(), name);
|
||||
Iterator<SOAPElement> iterator = getImplementation().getChildElements(getSaajHeader(), name);
|
||||
if (iterator.hasNext()) {
|
||||
SOAPElement element = (SOAPElement) iterator.next();
|
||||
SOAPElement element = iterator.next();
|
||||
element.detachNode();
|
||||
}
|
||||
}
|
||||
@@ -84,22 +82,11 @@ abstract class SaajSoapHeader extends SaajSoapElement implements SoapHeader {
|
||||
return getImplementation().getResult(getSaajHeader());
|
||||
}
|
||||
|
||||
private Iterator createSaajSoapHeaderElementIterator(Iterator iterator) {
|
||||
List result = new ArrayList();
|
||||
while (iterator.hasNext()) {
|
||||
Object o = iterator.next();
|
||||
if (o instanceof SOAPHeaderElement) {
|
||||
result.add(o);
|
||||
}
|
||||
}
|
||||
return new SaajSoapHeaderElementIterator(result.iterator());
|
||||
}
|
||||
protected static class SaajSoapHeaderElementIterator implements Iterator<SoapHeaderElement> {
|
||||
|
||||
protected static class SaajSoapHeaderElementIterator implements Iterator {
|
||||
private final Iterator<SOAPHeaderElement> iterator;
|
||||
|
||||
private final Iterator iterator;
|
||||
|
||||
protected SaajSoapHeaderElementIterator(Iterator iterator) {
|
||||
protected SaajSoapHeaderElementIterator(Iterator<SOAPHeaderElement> iterator) {
|
||||
Assert.notNull(iterator, "iterator must not be null");
|
||||
this.iterator = iterator;
|
||||
}
|
||||
@@ -108,8 +95,8 @@ abstract class SaajSoapHeader extends SaajSoapElement implements SoapHeader {
|
||||
return iterator.hasNext();
|
||||
}
|
||||
|
||||
public Object next() {
|
||||
SOAPHeaderElement saajHeaderElement = (SOAPHeaderElement) iterator.next();
|
||||
public SoapHeaderElement next() {
|
||||
SOAPHeaderElement saajHeaderElement = iterator.next();
|
||||
return new SaajSoapHeaderElement(saajHeaderElement);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,8 +174,8 @@ public class SaajSoapMessage extends AbstractSoapMessage {
|
||||
if (SaajUtils.getSaajVersion(saajMessage) >= SaajUtils.SAAJ_13) {
|
||||
SOAPPart saajPart = saajMessage.getSOAPPart();
|
||||
String[] contentTypes = saajPart.getMimeHeader(TransportConstants.HEADER_CONTENT_TYPE);
|
||||
for (int i = 0; i < contentTypes.length; i++) {
|
||||
if (contentTypes[i].indexOf(CONTENT_TYPE_XOP) != -1) {
|
||||
for (String contentType : contentTypes) {
|
||||
if (contentType.indexOf(CONTENT_TYPE_XOP) != -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -220,8 +220,8 @@ public class SaajSoapMessage extends AbstractSoapMessage {
|
||||
saajPart.setMimeHeader(TransportConstants.HEADER_CONTENT_TYPE, builder.toString());
|
||||
}
|
||||
|
||||
public Iterator getAttachments() throws AttachmentException {
|
||||
Iterator iterator = getImplementation().getAttachments(getSaajMessage());
|
||||
public Iterator<Attachment> getAttachments() throws AttachmentException {
|
||||
Iterator<AttachmentPart> iterator = getImplementation().getAttachments(getSaajMessage());
|
||||
return new SaajAttachmentIterator(iterator);
|
||||
}
|
||||
|
||||
@@ -229,11 +229,11 @@ public class SaajSoapMessage extends AbstractSoapMessage {
|
||||
Assert.hasLength(contentId, "contentId must not be empty");
|
||||
MimeHeaders mimeHeaders = new MimeHeaders();
|
||||
mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_ID, contentId);
|
||||
Iterator iterator = getImplementation().getAttachment(getSaajMessage(), mimeHeaders);
|
||||
Iterator<AttachmentPart> iterator = getImplementation().getAttachment(getSaajMessage(), mimeHeaders);
|
||||
if (!iterator.hasNext()) {
|
||||
return null;
|
||||
}
|
||||
AttachmentPart saajAttachment = (AttachmentPart) iterator.next();
|
||||
AttachmentPart saajAttachment = iterator.next();
|
||||
return new SaajAttachment(saajAttachment);
|
||||
}
|
||||
|
||||
@@ -285,11 +285,11 @@ public class SaajSoapMessage extends AbstractSoapMessage {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private static class SaajAttachmentIterator implements Iterator {
|
||||
private static class SaajAttachmentIterator implements Iterator<Attachment> {
|
||||
|
||||
private final Iterator saajIterator;
|
||||
private final Iterator<AttachmentPart> saajIterator;
|
||||
|
||||
private SaajAttachmentIterator(Iterator saajIterator) {
|
||||
private SaajAttachmentIterator(Iterator<AttachmentPart> saajIterator) {
|
||||
this.saajIterator = saajIterator;
|
||||
}
|
||||
|
||||
@@ -297,8 +297,8 @@ public class SaajSoapMessage extends AbstractSoapMessage {
|
||||
return saajIterator.hasNext();
|
||||
}
|
||||
|
||||
public Object next() {
|
||||
AttachmentPart saajAttachment = (AttachmentPart) saajIterator.next();
|
||||
public Attachment next() {
|
||||
AttachmentPart saajAttachment = saajIterator.next();
|
||||
return new SaajAttachment(saajAttachment);
|
||||
}
|
||||
|
||||
|
||||
@@ -191,10 +191,10 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
|
||||
MimeHeaders mimeHeaders = new MimeHeaders();
|
||||
if (inputStream instanceof TransportInputStream) {
|
||||
TransportInputStream transportInputStream = (TransportInputStream) inputStream;
|
||||
for (Iterator headerNames = transportInputStream.getHeaderNames(); headerNames.hasNext();) {
|
||||
String headerName = (String) headerNames.next();
|
||||
for (Iterator headerValues = transportInputStream.getHeaders(headerName); headerValues.hasNext();) {
|
||||
String headerValue = (String) headerValues.next();
|
||||
for (Iterator<String> headerNames = transportInputStream.getHeaderNames(); headerNames.hasNext();) {
|
||||
String headerName = headerNames.next();
|
||||
for (Iterator<String> headerValues = transportInputStream.getHeaders(headerName); headerValues.hasNext();) {
|
||||
String headerValue = headerValues.next();
|
||||
StringTokenizer tokenizer = new StringTokenizer(headerValue, ",");
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
mimeHeaders.addHeader(headerName, tokenizer.nextToken().trim());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.ws.soap.saaj.support;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import javax.xml.soap.Name;
|
||||
@@ -24,14 +23,14 @@ import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPEnvelope;
|
||||
import javax.xml.soap.SOAPException;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* SAX <code>ContentHandler</code> that transforms callback calls to the creation of SAAJ <code>Node</code>s and
|
||||
* <code>SOAPElement</code>s.
|
||||
@@ -47,7 +46,7 @@ public class SaajContentHandler implements ContentHandler {
|
||||
|
||||
private final SOAPEnvelope envelope;
|
||||
|
||||
private Map namespaces = new LinkedHashMap();
|
||||
private Map<String, String> namespaces = new LinkedHashMap<String, String>();
|
||||
|
||||
/**
|
||||
* Constructs a new instance of the <code>SaajContentHandler</code> that creates children of the given
|
||||
@@ -89,9 +88,8 @@ public class SaajContentHandler implements ContentHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Iterator iterator = namespaces.keySet().iterator(); iterator.hasNext();) {
|
||||
String namespacePrefix = (String) iterator.next();
|
||||
String namespaceUri = (String) namespaces.get(namespacePrefix);
|
||||
for (String namespacePrefix : namespaces.keySet()) {
|
||||
String namespaceUri = namespaces.get(namespacePrefix);
|
||||
if (!findParentNamespaceDeclaration(child, namespacePrefix, namespaceUri)) {
|
||||
child.addNamespaceDeclaration(namespacePrefix, namespaceUri);
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ public abstract class SaajUtils {
|
||||
*/
|
||||
public static int getSaajVersion(SOAPElement soapElement) {
|
||||
Assert.notNull(soapElement, "'soapElement' must not be null");
|
||||
Class soapElementClass = soapElement.getClass();
|
||||
Integer saajVersion = saajVersions.get(soapElementClass.getName());
|
||||
String soapElementClassName = soapElement.getClass().getName();
|
||||
Integer saajVersion = saajVersions.get(soapElementClassName);
|
||||
if (saajVersion == null) {
|
||||
if (isSaaj12(soapElement)) {
|
||||
if (isSaaj13(soapElement)) {
|
||||
@@ -187,7 +187,7 @@ public abstract class SaajUtils {
|
||||
} else {
|
||||
saajVersion = SAAJ_11;
|
||||
}
|
||||
saajVersions.put(soapElementClass.getName(), saajVersion);
|
||||
saajVersions.put(soapElementClassName, saajVersion);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("SOAPElement [" + soapElement.getClass().getName() + "] implements " +
|
||||
getSaajVersionString(saajVersion));
|
||||
@@ -294,7 +294,7 @@ public abstract class SaajUtils {
|
||||
return envelope.createName(qName.getLocalPart(), qNamePrefix, qName.getNamespaceURI());
|
||||
}
|
||||
else if (StringUtils.hasLength(qName.getNamespaceURI())) {
|
||||
Iterator prefixes;
|
||||
Iterator<?> prefixes;
|
||||
if (getSaajVersion(resolveElement) == SAAJ_11) {
|
||||
prefixes = resolveElement.getNamespacePrefixes();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ import javax.xml.soap.Node;
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.Text;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.xml.sax.AbstractXmlReader;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
@@ -29,9 +32,6 @@ import org.xml.sax.SAXNotRecognizedException;
|
||||
import org.xml.sax.SAXNotSupportedException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.xml.sax.AbstractXmlReader;
|
||||
|
||||
/**
|
||||
* SAX <code>XMLReader</code> that reads from a SAAJ <code>Node</code>. Consumes <code>XMLEvents</code> from an
|
||||
* <code>XMLEventReader</code>, and calls the corresponding methods on the SAX callback interfaces.
|
||||
@@ -136,7 +136,7 @@ public class SaajXmlReader extends AbstractXmlReader {
|
||||
Name elementName = element.getElementName();
|
||||
if (getContentHandler() != null) {
|
||||
if (namespacesFeature) {
|
||||
for (Iterator iterator = element.getNamespacePrefixes(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = element.getNamespacePrefixes(); iterator.hasNext();) {
|
||||
String prefix = (String) iterator.next();
|
||||
String namespaceUri = element.getNamespaceURI(prefix);
|
||||
getContentHandler().startPrefixMapping(prefix, namespaceUri);
|
||||
@@ -149,7 +149,7 @@ public class SaajXmlReader extends AbstractXmlReader {
|
||||
getContentHandler().startElement("", "", elementName.getQualifiedName(), getAttributes(element));
|
||||
}
|
||||
}
|
||||
for (Iterator iterator = element.getChildElements(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = element.getChildElements(); iterator.hasNext();) {
|
||||
Node child = (Node) iterator.next();
|
||||
handleNode(child);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class SaajXmlReader extends AbstractXmlReader {
|
||||
if (namespacesFeature) {
|
||||
getContentHandler()
|
||||
.endElement(elementName.getURI(), elementName.getLocalName(), elementName.getQualifiedName());
|
||||
for (Iterator iterator = element.getNamespacePrefixes(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = element.getNamespacePrefixes(); iterator.hasNext();) {
|
||||
String prefix = (String) iterator.next();
|
||||
getContentHandler().endPrefixMapping(prefix);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ public class SaajXmlReader extends AbstractXmlReader {
|
||||
private Attributes getAttributes(SOAPElement element) {
|
||||
AttributesImpl attributes = new AttributesImpl();
|
||||
|
||||
for (Iterator iterator = element.getAllAttributes(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = element.getAllAttributes(); iterator.hasNext();) {
|
||||
Name attributeName = (Name) iterator.next();
|
||||
String namespace = attributeName.getURI();
|
||||
if (namespace == null || !namespacesFeature) {
|
||||
@@ -189,7 +189,7 @@ public class SaajXmlReader extends AbstractXmlReader {
|
||||
attributeValue);
|
||||
}
|
||||
if (namespacePrefixesFeature) {
|
||||
for (Iterator iterator = element.getNamespacePrefixes(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = element.getNamespacePrefixes(); iterator.hasNext();) {
|
||||
String prefix = (String) iterator.next();
|
||||
String namespaceUri = element.getNamespaceURI(prefix);
|
||||
String qName;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class SoapMessageDispatcher extends MessageDispatcher {
|
||||
if (soapHeader == null) {
|
||||
return true;
|
||||
}
|
||||
Iterator headerIterator;
|
||||
Iterator<SoapHeaderElement> headerIterator;
|
||||
if (soapHeader instanceof Soap11Header) {
|
||||
headerIterator = ((Soap11Header) soapHeader).examineHeaderElementsToProcess(actorsOrRoles);
|
||||
}
|
||||
@@ -112,9 +112,9 @@ public class SoapMessageDispatcher extends MessageDispatcher {
|
||||
headerIterator =
|
||||
((Soap12Header) soapHeader).examineHeaderElementsToProcess(actorsOrRoles, isUltimateReceiver);
|
||||
}
|
||||
List notUnderstoodHeaderNames = new ArrayList();
|
||||
List<QName> notUnderstoodHeaderNames = new ArrayList<QName>();
|
||||
while (headerIterator.hasNext()) {
|
||||
SoapHeaderElement headerElement = (SoapHeaderElement) headerIterator.next();
|
||||
SoapHeaderElement headerElement = headerIterator.next();
|
||||
QName headerName = headerElement.getName();
|
||||
if (headerElement.getMustUnderstand() && logger.isDebugEnabled()) {
|
||||
logger.debug("Handling MustUnderstand header " + headerName);
|
||||
@@ -146,8 +146,7 @@ public class SoapMessageDispatcher extends MessageDispatcher {
|
||||
if (ObjectUtils.isEmpty(interceptors)) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < interceptors.length; i++) {
|
||||
EndpointInterceptor interceptor = interceptors[i];
|
||||
for (EndpointInterceptor interceptor : interceptors) {
|
||||
if (interceptor instanceof SoapEndpointInterceptor &&
|
||||
((SoapEndpointInterceptor) interceptor).understands(headerElement)) {
|
||||
return true;
|
||||
@@ -157,7 +156,7 @@ public class SoapMessageDispatcher extends MessageDispatcher {
|
||||
}
|
||||
|
||||
private void createMustUnderstandFault(SoapMessage soapResponse,
|
||||
List notUnderstoodHeaderNames,
|
||||
List<QName> notUnderstoodHeaderNames,
|
||||
String[] actorsOrRoles) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Could not handle mustUnderstand headers: " +
|
||||
@@ -172,8 +171,7 @@ public class SoapMessageDispatcher extends MessageDispatcher {
|
||||
SoapHeader header = soapResponse.getSoapHeader();
|
||||
if (header instanceof Soap12Header) {
|
||||
Soap12Header soap12Header = (Soap12Header) header;
|
||||
for (Iterator iterator = notUnderstoodHeaderNames.iterator(); iterator.hasNext();) {
|
||||
QName headerName = (QName) iterator.next();
|
||||
for (QName headerName : notUnderstoodHeaderNames) {
|
||||
soap12Header.addNotUnderstoodHeaderElement(headerName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.ws.soap.server.endpoint;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
@@ -158,8 +157,7 @@ public abstract class AbstractFaultCreatingValidatingMarshallingPayloadEndpoint
|
||||
*/
|
||||
@Override
|
||||
protected final boolean onValidationErrors(MessageContext messageContext, Object requestObject, Errors errors) {
|
||||
for (Iterator iterator = errors.getAllErrors().iterator(); iterator.hasNext();) {
|
||||
ObjectError objectError = (ObjectError) iterator.next();
|
||||
for (ObjectError objectError : errors.getAllErrors()) {
|
||||
String msg = messageSource.getMessage(objectError, getFaultLocale());
|
||||
logger.warn("Validation error on request object[" + requestObject + "]: " + msg);
|
||||
}
|
||||
@@ -169,8 +167,7 @@ public abstract class AbstractFaultCreatingValidatingMarshallingPayloadEndpoint
|
||||
SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultLocale());
|
||||
if (getAddValidationErrorDetail()) {
|
||||
SoapFaultDetail detail = fault.addFaultDetail();
|
||||
for (Iterator iterator = errors.getAllErrors().iterator(); iterator.hasNext();) {
|
||||
ObjectError objectError = (ObjectError) iterator.next();
|
||||
for (ObjectError objectError : errors.getAllErrors()) {
|
||||
String msg = messageSource.getMessage(objectError, getFaultLocale());
|
||||
SoapFaultDetailElement detailElement = detail.addFaultDetailElement(getDetailElementName());
|
||||
detailElement.addText(msg);
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.ws.soap.server.endpoint;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -30,7 +31,7 @@ import org.springframework.util.CollectionUtils;
|
||||
*/
|
||||
public class SoapFaultMappingExceptionResolver extends AbstractSoapFaultDefinitionExceptionResolver {
|
||||
|
||||
private Properties exceptionMappings;
|
||||
private Map<String, String> exceptionMappings = new LinkedHashMap<String, String>();
|
||||
|
||||
/**
|
||||
* Set the mappings between exception class names and SOAP Faults. The exception class name can be a substring, with
|
||||
@@ -46,7 +47,11 @@ public class SoapFaultMappingExceptionResolver extends AbstractSoapFaultDefiniti
|
||||
* @see SoapFaultDefinitionEditor
|
||||
*/
|
||||
public void setExceptionMappings(Properties mappings) {
|
||||
exceptionMappings = mappings;
|
||||
for (Map.Entry<Object, Object> entry : mappings.entrySet()) {
|
||||
if (entry.getKey() instanceof String && entry.getValue() instanceof String) {
|
||||
exceptionMappings.put((String)entry.getKey(), (String)entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,12 +59,11 @@ public class SoapFaultMappingExceptionResolver extends AbstractSoapFaultDefiniti
|
||||
if (!CollectionUtils.isEmpty(exceptionMappings)) {
|
||||
String definitionText = null;
|
||||
int deepest = Integer.MAX_VALUE;
|
||||
for (Iterator iterator = exceptionMappings.keySet().iterator(); iterator.hasNext();) {
|
||||
String exceptionMapping = (String) iterator.next();
|
||||
for (String exceptionMapping : exceptionMappings.keySet()) {
|
||||
int depth = getDepth(exceptionMapping, ex);
|
||||
if (depth >= 0 && depth < deepest) {
|
||||
deepest = depth;
|
||||
definitionText = exceptionMappings.getProperty(exceptionMapping);
|
||||
definitionText = exceptionMappings.get(exceptionMapping);
|
||||
}
|
||||
}
|
||||
if (definitionText != null) {
|
||||
@@ -81,14 +85,15 @@ public class SoapFaultMappingExceptionResolver extends AbstractSoapFaultDefiniti
|
||||
return getDepth(exceptionMapping, ex.getClass(), 0);
|
||||
}
|
||||
|
||||
private int getDepth(String exceptionMapping, Class exceptionClass, int depth) {
|
||||
@SuppressWarnings("unchecked")
|
||||
private int getDepth(String exceptionMapping, Class<? extends Exception> exceptionClass, int depth) {
|
||||
if (exceptionClass.getName().indexOf(exceptionMapping) != -1) {
|
||||
return depth;
|
||||
}
|
||||
if (exceptionClass.equals(Throwable.class)) {
|
||||
return -1;
|
||||
}
|
||||
return getDepth(exceptionMapping, exceptionClass.getSuperclass(), depth + 1);
|
||||
return getDepth(exceptionMapping, (Class<? extends Exception>) exceptionClass.getSuperclass(), depth + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.ws.soap.SoapFaultDetail;
|
||||
import org.springframework.ws.soap.SoapFaultDetailElement;
|
||||
import org.springframework.ws.soap.SoapMessage;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
@@ -151,8 +152,8 @@ public abstract class AbstractFaultCreatingValidatingInterceptor extends Abstrac
|
||||
@Override
|
||||
protected boolean handleRequestValidationErrors(MessageContext messageContext, SAXParseException[] errors)
|
||||
throws TransformerException {
|
||||
for (int i = 0; i < errors.length; i++) {
|
||||
logger.warn("XML validation error on request: " + errors[i].getMessage());
|
||||
for (SAXParseException error : errors) {
|
||||
logger.warn("XML validation error on request: " + error.getMessage());
|
||||
}
|
||||
if (messageContext.getResponse() instanceof SoapMessage) {
|
||||
SoapMessage response = (SoapMessage) messageContext.getResponse();
|
||||
@@ -160,9 +161,9 @@ public abstract class AbstractFaultCreatingValidatingInterceptor extends Abstrac
|
||||
SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultStringOrReasonLocale());
|
||||
if (getAddValidationErrorDetail()) {
|
||||
SoapFaultDetail detail = fault.addFaultDetail();
|
||||
for (int i = 0; i < errors.length; i++) {
|
||||
for (SAXParseException error : errors) {
|
||||
SoapFaultDetailElement detailElement = detail.addFaultDetailElement(getDetailElementName());
|
||||
detailElement.addText(errors[i].getMessage());
|
||||
detailElement.addText(error.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public interface Soap11Header extends SoapHeader {
|
||||
* @throws SoapHeaderException if the headers cannot be returned
|
||||
* @see SoapHeaderElement
|
||||
*/
|
||||
Iterator examineHeaderElementsToProcess(String[] actors) throws SoapHeaderException;
|
||||
Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] actors) throws SoapHeaderException;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,7 +36,7 @@ public interface Soap12Fault extends SoapFault {
|
||||
*
|
||||
* @return an Iterator that contains <code>QNames</code> representing the fault subcodes
|
||||
*/
|
||||
Iterator getFaultSubcodes();
|
||||
Iterator<QName> getFaultSubcodes();
|
||||
|
||||
/**
|
||||
* Adds a fault subcode this fault.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,7 +62,7 @@ public interface Soap12Header extends SoapHeader {
|
||||
* @throws SoapHeaderException if the headers cannot be returned
|
||||
* @see SoapHeaderElement
|
||||
*/
|
||||
Iterator examineHeaderElementsToProcess(String[] roles, boolean isUltimateReceiver) throws SoapHeaderException;
|
||||
Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] roles, boolean isUltimateReceiver) throws SoapHeaderException;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -86,7 +86,7 @@ public class DefaultStrategiesHelper {
|
||||
* @return a list of corresponding strategy objects
|
||||
* @throws BeansException if initialization failed
|
||||
*/
|
||||
public List getDefaultStrategies(Class strategyInterface) throws BeanInitializationException {
|
||||
public <T> List<T> getDefaultStrategies(Class<T> strategyInterface) throws BeanInitializationException {
|
||||
return getDefaultStrategies(strategyInterface, null);
|
||||
}
|
||||
|
||||
@@ -101,23 +101,25 @@ public class DefaultStrategiesHelper {
|
||||
* @return a list of corresponding strategy objects
|
||||
* @throws BeansException if initialization failed
|
||||
*/
|
||||
public List getDefaultStrategies(Class strategyInterface, ApplicationContext applicationContext)
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> List<T> getDefaultStrategies(Class<T> strategyInterface, ApplicationContext applicationContext)
|
||||
throws BeanInitializationException {
|
||||
String key = strategyInterface.getName();
|
||||
try {
|
||||
List result;
|
||||
List<T> result;
|
||||
String value = defaultStrategies.getProperty(key);
|
||||
if (value != null) {
|
||||
String[] classNames = StringUtils.commaDelimitedListToStringArray(value);
|
||||
result = new ArrayList(classNames.length);
|
||||
for (int i = 0; i < classNames.length; i++) {
|
||||
Class clazz = ClassUtils.forName(classNames[i]);
|
||||
Object strategy = instantiateBean(clazz, applicationContext);
|
||||
result = new ArrayList<T>(classNames.length);
|
||||
for (String className : classNames) {
|
||||
Class<T> clazz =
|
||||
(Class<T>) ClassUtils.forName(className, DefaultStrategiesHelper.class.getClassLoader());
|
||||
T strategy = instantiateBean(clazz, applicationContext);
|
||||
result.add(strategy);
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = Collections.EMPTY_LIST;
|
||||
result = Collections.emptyList();
|
||||
}
|
||||
Collections.sort(result, new OrderComparator());
|
||||
return result;
|
||||
@@ -129,8 +131,8 @@ public class DefaultStrategiesHelper {
|
||||
}
|
||||
|
||||
/** Instantiates the given bean, simulating the standard bean lifecycle. */
|
||||
private Object instantiateBean(Class clazz, ApplicationContext applicationContext) {
|
||||
Object strategy = BeanUtils.instantiateClass(clazz);
|
||||
private <T> T instantiateBean(Class<T> clazz, ApplicationContext applicationContext) {
|
||||
T strategy = BeanUtils.instantiateClass(clazz);
|
||||
if (strategy instanceof BeanNameAware) {
|
||||
BeanNameAware beanNameAware = (BeanNameAware) strategy;
|
||||
beanNameAware.setBeanName(clazz.getName());
|
||||
@@ -180,7 +182,7 @@ public class DefaultStrategiesHelper {
|
||||
* @throws BeansException if initialization failed
|
||||
* @see #getDefaultStrategies
|
||||
*/
|
||||
public Object getDefaultStrategy(Class strategyInterface) throws BeanInitializationException {
|
||||
public <T> T getDefaultStrategy(Class<T> strategyInterface) throws BeanInitializationException {
|
||||
return getDefaultStrategy(strategyInterface, null);
|
||||
}
|
||||
|
||||
@@ -195,9 +197,9 @@ public class DefaultStrategiesHelper {
|
||||
* @return the corresponding strategy object
|
||||
* @throws BeansException if initialization failed
|
||||
*/
|
||||
public Object getDefaultStrategy(Class strategyInterface, ApplicationContext applicationContext)
|
||||
public <T> T getDefaultStrategy(Class<T> strategyInterface, ApplicationContext applicationContext)
|
||||
throws BeanInitializationException {
|
||||
List result = getDefaultStrategies(strategyInterface, applicationContext);
|
||||
List<T> result = getDefaultStrategies(strategyInterface, applicationContext);
|
||||
if (result.size() != 1) {
|
||||
throw new BeanInitializationException(
|
||||
"Could not find exactly 1 strategy for interface [" + strategyInterface.getName() + "]");
|
||||
|
||||
@@ -18,8 +18,7 @@ package org.springframework.ws.transport.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
@@ -166,9 +165,8 @@ public class CommonsHttpMessageSender extends AbstractHttpWebServiceMessageSende
|
||||
* @see org.apache.commons.httpclient.params.HttpConnectionManagerParams#setMaxConnectionsPerHost(org.apache.commons.httpclient.HostConfiguration,
|
||||
* int)
|
||||
*/
|
||||
public void setMaxConnectionsPerHost(Properties maxConnectionsPerHost) throws URIException {
|
||||
for (Iterator<?> iterator = maxConnectionsPerHost.keySet().iterator(); iterator.hasNext();) {
|
||||
String host = (String) iterator.next();
|
||||
public void setMaxConnectionsPerHost(Map<String, String> maxConnectionsPerHost) throws URIException {
|
||||
for (String host : maxConnectionsPerHost.keySet()) {
|
||||
HostConfiguration hostConfiguration = new HostConfiguration();
|
||||
if ("*".equals(host)) {
|
||||
hostConfiguration = HostConfiguration.ANY_HOST_CONFIGURATION;
|
||||
@@ -184,7 +182,7 @@ public class CommonsHttpMessageSender extends AbstractHttpWebServiceMessageSende
|
||||
else {
|
||||
hostConfiguration.setHost(host);
|
||||
}
|
||||
int maxHostConnections = Integer.parseInt(maxConnectionsPerHost.getProperty(host));
|
||||
int maxHostConnections = Integer.parseInt(maxConnectionsPerHost.get(host));
|
||||
getHttpClient().getHttpConnectionManager().getParams()
|
||||
.setMaxConnectionsPerHost(hostConfiguration, maxHostConnections);
|
||||
}
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.provider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.Fault;
|
||||
import javax.wsdl.Input;
|
||||
@@ -33,6 +30,8 @@ import javax.wsdl.WSDLException;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -94,18 +93,12 @@ public abstract class AbstractPortTypesProvider implements PortTypesProvider {
|
||||
}
|
||||
|
||||
private void createOperations(Definition definition, PortType portType) throws WSDLException {
|
||||
// TODO: use MultivaluedMap
|
||||
Map<String, List<Message>> operations = new HashMap<String, List<Message>>();
|
||||
MultiValueMap<String, Message> operations = new LinkedMultiValueMap<String, Message>();
|
||||
for (Iterator<?> iterator = definition.getMessages().values().iterator(); iterator.hasNext();) {
|
||||
Message message = (Message) iterator.next();
|
||||
String operationName = getOperationName(message);
|
||||
if (StringUtils.hasText(operationName)) {
|
||||
List<Message> messages = operations.get(operationName);
|
||||
if (messages == null) {
|
||||
messages = new ArrayList<Message>();
|
||||
operations.put(operationName, messages);
|
||||
}
|
||||
messages.add(message);
|
||||
operations.add(operationName,message);
|
||||
}
|
||||
}
|
||||
if (operations.isEmpty() && logger.isWarnEnabled()) {
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
package org.springframework.ws.soap.soap11;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
import org.springframework.ws.mime.Attachment;
|
||||
@@ -40,10 +41,10 @@ public abstract class AbstractSoap11MessageFactoryTestCase extends AbstractSoapM
|
||||
@Override
|
||||
public void testCreateSoapMessageNoAttachment() throws Exception {
|
||||
InputStream is = AbstractSoap11MessageFactoryTestCase.class.getResourceAsStream("soap11.xml");
|
||||
Properties headers = new Properties();
|
||||
headers.setProperty("Content-Type", "text/xml");
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "text/xml");
|
||||
String soapAction = "\"http://springframework.org/spring-ws/Action\"";
|
||||
headers.setProperty("SOAPAction", soapAction);
|
||||
headers.put("SOAPAction", soapAction);
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
|
||||
WebServiceMessage message = messageFactory.createWebServiceMessage(tis);
|
||||
@@ -57,8 +58,8 @@ public abstract class AbstractSoap11MessageFactoryTestCase extends AbstractSoapM
|
||||
@Override
|
||||
public void testCreateSoapMessageSwA() throws Exception {
|
||||
InputStream is = AbstractSoap11MessageFactoryTestCase.class.getResourceAsStream("soap11-attachment.bin");
|
||||
Properties headers = new Properties();
|
||||
headers.setProperty("Content-Type",
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type",
|
||||
"multipart/related;" + "type=\"text/xml\";" + "boundary=\"----=_Part_0_11416420.1149699787554\"");
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
|
||||
@@ -77,8 +78,8 @@ public abstract class AbstractSoap11MessageFactoryTestCase extends AbstractSoapM
|
||||
@Override
|
||||
public void testCreateSoapMessageMtom() throws Exception {
|
||||
InputStream is = AbstractSoap11MessageFactoryTestCase.class.getResourceAsStream("soap11-mtom.bin");
|
||||
Properties headers = new Properties();
|
||||
headers.setProperty("Content-Type", "multipart/related;" + "start-info=\"text/xml\";" +
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "multipart/related;" + "start-info=\"text/xml\";" +
|
||||
"type=\"application/xop+xml\";" + "start=\"<0.urn:uuid:492264AB42E57108E01176731445508@apache.org>\";" +
|
||||
"boundary=\"MIMEBoundaryurn_uuid_492264AB42E57108E01176731445507\"");
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
@@ -97,8 +98,8 @@ public abstract class AbstractSoap11MessageFactoryTestCase extends AbstractSoapM
|
||||
|
||||
public void testCreateSoapMessageMtomWeirdStartInfo() throws Exception {
|
||||
InputStream is = AbstractSoap11MessageFactoryTestCase.class.getResourceAsStream("soap11-mtom.bin");
|
||||
Properties headers = new Properties();
|
||||
headers.setProperty("Content-Type", "multipart/related;" + "startinfo=\"text/xml\";" +
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "multipart/related;" + "startinfo=\"text/xml\";" +
|
||||
"type=\"application/xop+xml\";" + "start=\"<0.urn:uuid:492264AB42E57108E01176731445508@apache.org>\";" +
|
||||
"boundary=\"MIMEBoundaryurn_uuid_492264AB42E57108E01176731445507\"");
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
@@ -117,8 +118,8 @@ public abstract class AbstractSoap11MessageFactoryTestCase extends AbstractSoapM
|
||||
|
||||
public void testCreateSoapMessageUtf8ByteOrderMark() throws Exception {
|
||||
InputStream is = AbstractSoap11MessageFactoryTestCase.class.getResourceAsStream("soap11-utf8-bom.xml");
|
||||
Properties headers = new Properties();
|
||||
headers.setProperty("Content-Type", "text/xml; charset=UTF-8");
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "text/xml; charset=UTF-8");
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
|
||||
SoapMessage message = (SoapMessage) messageFactory.createWebServiceMessage(tis);
|
||||
@@ -127,8 +128,8 @@ public abstract class AbstractSoap11MessageFactoryTestCase extends AbstractSoapM
|
||||
|
||||
public void testCreateSoapMessageUtf16BigEndianByteOrderMark() throws Exception {
|
||||
InputStream is = AbstractSoap11MessageFactoryTestCase.class.getResourceAsStream("soap11-utf16-be-bom.xml");
|
||||
Properties headers = new Properties();
|
||||
headers.setProperty("Content-Type", "text/xml; charset=UTF-16");
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "text/xml; charset=UTF-16");
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
|
||||
SoapMessage message = (SoapMessage) messageFactory.createWebServiceMessage(tis);
|
||||
@@ -137,8 +138,8 @@ public abstract class AbstractSoap11MessageFactoryTestCase extends AbstractSoapM
|
||||
|
||||
public void testCreateSoapMessageUtf16LittleEndianByteOrderMark() throws Exception {
|
||||
InputStream is = AbstractSoap11MessageFactoryTestCase.class.getResourceAsStream("soap11-utf16-le-bom.xml");
|
||||
Properties headers = new Properties();
|
||||
headers.setProperty("Content-Type", "text/xml; charset=UTF-16");
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "text/xml; charset=UTF-16");
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
|
||||
SoapMessage message = (SoapMessage) messageFactory.createWebServiceMessage(tis);
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
package org.springframework.ws.soap.soap12;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
import org.springframework.ws.mime.Attachment;
|
||||
@@ -26,8 +27,8 @@ import org.springframework.ws.soap.AbstractSoapMessageFactoryTestCase;
|
||||
import org.springframework.ws.soap.SoapMessage;
|
||||
import org.springframework.ws.soap.SoapVersion;
|
||||
import org.springframework.ws.transport.MockTransportInputStream;
|
||||
import org.springframework.ws.transport.TransportInputStream;
|
||||
import org.springframework.ws.transport.TransportConstants;
|
||||
import org.springframework.ws.transport.TransportInputStream;
|
||||
|
||||
public abstract class AbstractSoap12MessageFactoryTestCase extends AbstractSoapMessageFactoryTestCase {
|
||||
|
||||
@@ -42,9 +43,9 @@ public abstract class AbstractSoap12MessageFactoryTestCase extends AbstractSoapM
|
||||
@Override
|
||||
public void testCreateSoapMessageNoAttachment() throws Exception {
|
||||
InputStream is = AbstractSoap12MessageFactoryTestCase.class.getResourceAsStream("soap12.xml");
|
||||
final Properties headers = new Properties();
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
String soapAction = "\"http://springframework.org/spring-ws/Action\"";
|
||||
headers.setProperty(TransportConstants.HEADER_CONTENT_TYPE, "application/soap+xml; action=" + soapAction);
|
||||
headers.put(TransportConstants.HEADER_CONTENT_TYPE, "application/soap+xml; action=" + soapAction);
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
|
||||
WebServiceMessage message = messageFactory.createWebServiceMessage(tis);
|
||||
@@ -58,8 +59,8 @@ public abstract class AbstractSoap12MessageFactoryTestCase extends AbstractSoapM
|
||||
@Override
|
||||
public void testCreateSoapMessageSwA() throws Exception {
|
||||
InputStream is = AbstractSoap12MessageFactoryTestCase.class.getResourceAsStream("soap12-attachment.bin");
|
||||
Properties headers = new Properties();
|
||||
headers.setProperty("Content-Type", "multipart/related;" + "type=\"application/soap+xml\";" +
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "multipart/related;" + "type=\"application/soap+xml\";" +
|
||||
"boundary=\"----=_Part_0_11416420.1149699787554\"");
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
|
||||
@@ -75,8 +76,8 @@ public abstract class AbstractSoap12MessageFactoryTestCase extends AbstractSoapM
|
||||
@Override
|
||||
public void testCreateSoapMessageMtom() throws Exception {
|
||||
InputStream is = AbstractSoap12MessageFactoryTestCase.class.getResourceAsStream("soap12-mtom.bin");
|
||||
Properties headers = new Properties();
|
||||
headers.setProperty("Content-Type", "multipart/related;" + "start-info=\"application/soap+xml\";" +
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Content-Type", "multipart/related;" + "start-info=\"application/soap+xml\";" +
|
||||
"type=\"application/xop+xml\";" + "start=\"<0.urn:uuid:40864869929B855F971176851454456@apache.org>\";" +
|
||||
"boundary=\"MIMEBoundaryurn_uuid_40864869929B855F971176851454455\"");
|
||||
TransportInputStream tis = new MockTransportInputStream(is, headers);
|
||||
|
||||
@@ -28,6 +28,8 @@ import javax.xml.XMLConstants;
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
/**
|
||||
* Simple <code>javax.xml.namespace.NamespaceContext</code> implementation. Follows the standard
|
||||
@@ -41,9 +43,7 @@ public class SimpleNamespaceContext implements NamespaceContext {
|
||||
|
||||
private Map<String, String> prefixToNamespaceUri = new HashMap<String, String>();
|
||||
|
||||
/** Maps a <code>String</code> namespaceUri to a <code>List</code> of prefixes */
|
||||
// TODO: replace with MultiValuedMap
|
||||
private Map<String, List<String>> namespaceUriToPrefixes = new HashMap<String, List<String>>();
|
||||
private MultiValueMap<String, String> namespaceUriToPrefixes = new LinkedMultiValueMap<String, String>();
|
||||
|
||||
public String getNamespaceURI(String prefix) {
|
||||
Assert.notNull(prefix, "prefix is null");
|
||||
|
||||
Reference in New Issue
Block a user