Added @Override annotation to interface implementations

This commit is contained in:
Arjen Poutsma
2014-04-14 16:07:59 +02:00
parent 06d735659c
commit da629278e6
230 changed files with 1407 additions and 598 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007 the original author or authors.
* Copyright 2005-2014 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.ws.client.WebServiceFaultException;
public class SimpleFaultMessageResolver implements FaultMessageResolver {
/** Throws a new <code>WebServiceFaultException</code>. */
@Override
public void resolveFault(WebServiceMessage message) {
if (message instanceof FaultAwareWebServiceMessage) {
throw new WebServiceFaultException((FaultAwareWebServiceMessage) message);

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -26,6 +26,9 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
@@ -56,9 +59,6 @@ import org.springframework.ws.transport.context.TransportContextHolder;
import org.springframework.ws.transport.http.HttpUrlConnectionMessageSender;
import org.springframework.ws.transport.support.TransportUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* <strong>The central class for client-side Web services.</strong> It provides a message-driven approach to sending and
* receiving {@link WebServiceMessage} instances.
@@ -368,18 +368,22 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
// Marshalling methods
//
@Override
public Object marshalSendAndReceive(final Object requestPayload) {
return marshalSendAndReceive(requestPayload, null);
}
@Override
public Object marshalSendAndReceive(String uri, final Object requestPayload) {
return marshalSendAndReceive(uri, requestPayload, null);
}
@Override
public Object marshalSendAndReceive(final Object requestPayload, final WebServiceMessageCallback requestCallback) {
return marshalSendAndReceive(getDefaultUri(), requestPayload, requestCallback);
}
@Override
public Object marshalSendAndReceive(String uri,
final Object requestPayload,
final WebServiceMessageCallback requestCallback) {
@@ -415,20 +419,24 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
// Result-handling methods
//
@Override
public boolean sendSourceAndReceiveToResult(Source requestPayload, Result responseResult) {
return sendSourceAndReceiveToResult(requestPayload, null, responseResult);
}
@Override
public boolean sendSourceAndReceiveToResult(String uri, Source requestPayload, Result responseResult) {
return sendSourceAndReceiveToResult(uri, requestPayload, null, responseResult);
}
@Override
public boolean sendSourceAndReceiveToResult(Source requestPayload,
WebServiceMessageCallback requestCallback,
final Result responseResult) {
return sendSourceAndReceiveToResult(getDefaultUri(), requestPayload, requestCallback, responseResult);
}
@Override
public boolean sendSourceAndReceiveToResult(String uri,
Source requestPayload,
WebServiceMessageCallback requestCallback,
@@ -456,22 +464,26 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
// Source-handling methods
//
@Override
public <T> T sendSourceAndReceive(final Source requestPayload, final SourceExtractor<T> responseExtractor) {
return sendSourceAndReceive(requestPayload, null, responseExtractor);
}
@Override
public <T> T sendSourceAndReceive(String uri,
final Source requestPayload,
final SourceExtractor<T> responseExtractor) {
return sendSourceAndReceive(uri, requestPayload, null, responseExtractor);
}
@Override
public <T> T sendSourceAndReceive(final Source requestPayload,
final WebServiceMessageCallback requestCallback,
final SourceExtractor<T> responseExtractor) {
return sendSourceAndReceive(getDefaultUri(), requestPayload, requestCallback, responseExtractor);
}
@Override
public <T> T sendSourceAndReceive(String uri,
final Source requestPayload,
final WebServiceMessageCallback requestCallback,
@@ -505,11 +517,13 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
// WebServiceMessage-handling methods
//
@Override
public boolean sendAndReceive(WebServiceMessageCallback requestCallback,
WebServiceMessageCallback responseCallback) {
return sendAndReceive(getDefaultUri(), requestCallback, responseCallback);
}
@Override
public boolean sendAndReceive(String uri,
WebServiceMessageCallback requestCallback,
WebServiceMessageCallback responseCallback) {
@@ -519,11 +533,13 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
return result != null && result;
}
@Override
public <T> T sendAndReceive(WebServiceMessageCallback requestCallback,
WebServiceMessageExtractor<T> responseExtractor) {
return sendAndReceive(getDefaultUri(), requestCallback, responseExtractor);
}
@Override
public <T> T sendAndReceive(String uriString,
WebServiceMessageCallback requestCallback,
WebServiceMessageExtractor<T> responseExtractor) {
@@ -824,6 +840,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
this.callback = callback;
}
@Override
public Boolean extractData(WebServiceMessage message) throws IOException, TransformerException {
callback.doWithMessage(message);
return Boolean.TRUE;
@@ -839,6 +856,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
this.sourceExtractor = sourceExtractor;
}
@Override
public T extractData(WebServiceMessage message) throws IOException, TransformerException {
return sourceExtractor.extractData(message.getPayloadSource());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007 the original author or authors.
* Copyright 2005-2014 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.
@@ -177,6 +177,7 @@ public abstract class WebServiceGatewaySupport implements InitializingBean {
webServiceTemplate.setInterceptors(interceptors);
}
@Override
public final void afterPropertiesSet() throws Exception {
webServiceTemplate.afterPropertiesSet();
initGateway();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -82,6 +82,7 @@ public abstract class WebServiceAccessor extends TransformerObjectSupport implem
this.messageSenders = messageSenders;
}
@Override
public void afterPropertiesSet() {
Assert.notNull(getMessageFactory(), "Property 'messageFactory' is required");
Assert.notEmpty(getMessageSenders(), "Property 'messageSenders' is required");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008 the original author or authors.
* Copyright 2005-2014 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.
@@ -48,6 +48,7 @@ public abstract class AbstractCachingDestinationProvider implements DestinationP
this.cache = cache;
}
@Override
public final URI getDestination() {
if (cache) {
if (cachedUri == null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,6 +19,8 @@ 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;
@@ -34,8 +36,6 @@ 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
@@ -138,6 +138,7 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
this.validateResponse = validateResponse;
}
@Override
public void afterPropertiesSet() throws Exception {
if (validator == null && !ObjectUtils.isEmpty(schemas)) {
Assert.hasLength(schemaLanguage, "schemaLanguage is required");
@@ -162,6 +163,7 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
* @return <code>true</code> if the message is valid; <code>false</code> otherwise
* @see #setValidateRequest(boolean)
*/
@Override
public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException {
if (validateRequest) {
Source requestSource = getValidationRequestSource(messageContext.getRequest());
@@ -212,6 +214,7 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
* @return <code>true</code> if the response is valid; <code>false</code> otherwise
* @see #setValidateResponse(boolean)
*/
@Override
public boolean handleResponse(MessageContext messageContext) throws WebServiceClientException {
if (validateResponse) {
Source responseSource = getValidationResponseSource(messageContext.getResponse());
@@ -253,11 +256,13 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
}
/** Does nothing by default. Faults are not validated. */
@Override
public boolean handleFault(MessageContext messageContext) throws WebServiceClientException {
return true;
}
/** Does nothing by default.*/
@Override
public void afterCompletion(MessageContext messageContext, Exception ex)
throws WebServiceClientException {
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2012 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -16,6 +16,8 @@
package org.springframework.ws.config;
import org.w3c.dom.Element;
import org.springframework.beans.BeanMetadataElement;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.RuntimeBeanReference;
@@ -47,8 +49,6 @@ import org.springframework.ws.soap.server.endpoint.adapter.method.SoapHeaderElem
import org.springframework.ws.soap.server.endpoint.adapter.method.SoapMethodArgumentResolver;
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping;
import org.w3c.dom.Element;
/**
* {@link BeanDefinitionParser} that parses the {@code annotation-driven} element to configure a Spring WS application.
*
@@ -72,6 +72,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
private static final boolean xomPresent =
ClassUtils.isPresent("nu.xom.Element", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
Object source = parserContext.extractSource(element);

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -18,6 +18,8 @@ package org.springframework.ws.config;
import java.util.List;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.config.BeanReference;
@@ -34,8 +36,6 @@ import org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSo
import org.springframework.ws.soap.server.endpoint.interceptor.PayloadRootSmartSoapEndpointInterceptor;
import org.springframework.ws.soap.server.endpoint.interceptor.SoapActionSmartEndpointInterceptor;
import org.w3c.dom.Element;
/**
* Parser for the {@code &lt;sws:interceptors/&gt;} element.
*
@@ -44,6 +44,7 @@ import org.w3c.dom.Element;
*/
class InterceptorsBeanDefinitionParser implements BeanDefinitionParser {
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
CompositeComponentDefinition compDefinition =
new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element));

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -27,6 +27,7 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
*/
public class WebServicesNamespaceHandler extends NamespaceHandlerSupport {
@Override
public void init() {
registerBeanDefinitionParser("annotation-driven", new AnnotationDrivenBeanDefinitionParser());
registerBeanDefinitionParser("interceptors", new InterceptorsBeanDefinitionParser());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -35,22 +35,27 @@ public abstract class AbstractMessageContext implements MessageContext {
*/
private Map<String, Object> properties;
@Override
public boolean containsProperty(String name) {
return getProperties().containsKey(name);
}
@Override
public Object getProperty(String name) {
return getProperties().get(name);
}
@Override
public String[] getPropertyNames() {
return StringUtils.toStringArray(getProperties().keySet());
}
@Override
public void removeProperty(String name) {
getProperties().remove(name);
}
@Override
public void setProperty(String name, Object value) {
getProperties().put(name, value);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2014 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,14 +53,17 @@ public class DefaultMessageContext extends AbstractMessageContext {
this.messageFactory = messageFactory;
}
@Override
public WebServiceMessage getRequest() {
return request;
}
@Override
public boolean hasResponse() {
return response != null;
}
@Override
public WebServiceMessage getResponse() {
if (response == null) {
response = messageFactory.createWebServiceMessage();
@@ -68,15 +71,18 @@ public class DefaultMessageContext extends AbstractMessageContext {
return response;
}
@Override
public void setResponse(WebServiceMessage response) {
checkForResponse();
this.response = response;
}
@Override
public void clearResponse() {
response = null;
}
@Override
public void readResponse(InputStream inputStream) throws IOException {
checkForResponse();
response = messageFactory.createWebServiceMessage(inputStream);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007 the original author or authors.
* Copyright 2005-2014 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,6 +36,7 @@ import org.springframework.util.Assert;
*/
public abstract class AbstractMimeMessage implements MimeMessage {
@Override
public final Attachment addAttachment(String contentId, File file) throws AttachmentException {
Assert.hasLength(contentId, "contentId must not be empty");
Assert.notNull(file, "File must not be null");
@@ -43,6 +44,7 @@ public abstract class AbstractMimeMessage implements MimeMessage {
return addAttachment(contentId, dataHandler);
}
@Override
public final Attachment addAttachment(String contentId, InputStreamSource inputStreamSource, String contentType) {
Assert.hasLength(contentId, "contentId must not be empty");
Assert.notNull(inputStreamSource, "InputStreamSource must not be null");
@@ -71,18 +73,22 @@ public abstract class AbstractMimeMessage implements MimeMessage {
this.contentType = contentType;
}
@Override
public InputStream getInputStream() throws IOException {
return inputStreamSource.getInputStream();
}
@Override
public OutputStream getOutputStream() {
throw new UnsupportedOperationException("Read-only javax.activation.DataSource");
}
@Override
public String getContentType() {
return contentType;
}
@Override
public String getName() {
if (inputStreamSource instanceof Resource) {
Resource resource = (Resource) inputStreamSource;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -26,16 +26,16 @@ import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.springframework.util.Assert;
import org.springframework.ws.pox.PoxMessage;
import org.springframework.ws.transport.TransportConstants;
import org.springframework.ws.transport.TransportOutputStream;
import org.springframework.xml.namespace.QNameUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/**
* Implementation of the <code>PoxMessage</code> interface that is based on a DOM Document.
*
@@ -70,6 +70,7 @@ public class DomPoxMessage implements PoxMessage {
return document;
}
@Override
public Result getPayloadResult() {
NodeList children = document.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
@@ -78,6 +79,7 @@ public class DomPoxMessage implements PoxMessage {
return new DOMResult(document);
}
@Override
public Source getPayloadSource() {
return new DOMSource(document);
}
@@ -100,6 +102,7 @@ public class DomPoxMessage implements PoxMessage {
return builder.toString();
}
@Override
public void writeTo(OutputStream outputStream) throws IOException {
try {
if (outputStream instanceof TransportOutputStream) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2005-2014 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.
@@ -76,6 +76,7 @@ public class DomPoxMessageFactory extends TransformerObjectSupport implements We
documentBuilderFactory.setExpandEntityReferences(expandEntityRef);
}
@Override
public DomPoxMessage createWebServiceMessage() {
try {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
@@ -90,6 +91,7 @@ public class DomPoxMessageFactory extends TransformerObjectSupport implements We
}
}
@Override
public DomPoxMessage createWebServiceMessage(InputStream inputStream) throws IOException {
try {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2012 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -23,6 +23,9 @@ import java.util.Collections;
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;
@@ -44,9 +47,6 @@ 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/>
@@ -148,16 +148,19 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
this.endpointMappings = endpointMappings;
}
@Override
public final void setBeanName(String beanName) {
this.beanName = beanName;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
initEndpointAdapters(applicationContext);
initEndpointExceptionResolvers(applicationContext);
initEndpointMappings(applicationContext);
}
@Override
public void receive(MessageContext messageContext) throws Exception {
// Let's keep a reference to the request content as it came in, it might be changed by interceptors in dispatch()
String requestContent = "";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,8 +20,6 @@ import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMSource;
import org.springframework.xml.transform.TransformerObjectSupport;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
@@ -30,6 +28,8 @@ import org.dom4j.io.DocumentResult;
import org.dom4j.io.DocumentSource;
import org.w3c.dom.Node;
import org.springframework.xml.transform.TransformerObjectSupport;
/**
* Abstract base class for endpoints that handle the message payload as dom4j elements. Offers the message payload as a
* dom4j <code>Element</code>, and allows subclasses to create a response by returning an <code>Element</code>.
@@ -56,6 +56,7 @@ public abstract class AbstractDom4jPayloadEndpoint extends TransformerObjectSupp
this.alwaysTransform = alwaysTransform;
}
@Override
public final Source invoke(Source request) throws Exception {
Element requestElement = null;
if (request != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2005-2014 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,6 +86,7 @@ public abstract class AbstractDomPayloadEndpoint extends TransformerObjectSuppor
this.alwaysTransform = alwaysTransform;
}
@Override
public final Source invoke(Source request) throws Exception {
if (documentBuilderFactory == null) {
documentBuilderFactory = createDocumentBuilderFactory();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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/>
@@ -83,6 +83,7 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
this.order = order;
}
@Override
public final int getOrder() {
return order;
}
@@ -93,6 +94,7 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
*
* @see #resolveExceptionInternal(MessageContext,Object,Exception)
*/
@Override
public final boolean resolveException(MessageContext messageContext, Object endpoint, Exception ex) {
Object mappedEndpoint = endpoint instanceof MethodEndpoint ? ((MethodEndpoint) endpoint).getBean() : endpoint;
if (mappedEndpoints != null && !mappedEndpoints.contains(mappedEndpoint)) {

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2012 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -20,8 +20,6 @@ import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMSource;
import org.springframework.xml.transform.TransformerObjectSupport;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.DOMBuilder;
@@ -29,6 +27,8 @@ import org.jdom2.transform.JDOMResult;
import org.jdom2.transform.JDOMSource;
import org.w3c.dom.Node;
import org.springframework.xml.transform.TransformerObjectSupport;
/**
* Abstract base class for endpoints that handle the message payload as JDOM elements.
* <p/>
@@ -56,6 +56,7 @@ public abstract class AbstractJDomPayloadEndpoint extends TransformerObjectSuppo
this.alwaysTransform = alwaysTransform;
}
@Override
public final Source invoke(Source request) throws Exception {
Element requestElement = getDocumentElement(request);
Element responseElement = invokeInternal(requestElement);

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -24,14 +24,14 @@ import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.stream.StreamResult;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.EndpointInterceptor;
import org.springframework.xml.transform.TransformerObjectSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Abstract base class for <code>EndpointInterceptor</code> instances that log a part of a
* <code>WebServiceMessage</code>. By default, both request and response messages are logged, but this behaviour can be
@@ -84,6 +84,7 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
* @return <code>true</code>
* @throws TransformerException when the payload cannot be transformed to a string
*/
@Override
public final boolean handleRequest(MessageContext messageContext, Object endpoint) throws TransformerException {
if (logRequest && isLogEnabled()) {
logMessageSource("Request: ", getSource(messageContext.getRequest()));
@@ -99,6 +100,7 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
* @return <code>true</code>
* @throws TransformerException when the payload cannot be transformed to a string
*/
@Override
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception {
if (logResponse && isLogEnabled()) {
logMessageSource("Response: ", getSource(messageContext.getResponse()));
@@ -107,11 +109,13 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
}
/** Does nothing by default. Faults are not logged. */
@Override
public boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception {
return true;
}
/** Does nothing by default*/
@Override
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,6 +18,9 @@ package org.springframework.ws.server.endpoint;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
@@ -26,9 +29,6 @@ import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.support.MarshallingUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Endpoint that unmarshals the request payload, and marshals the response object. This endpoint needs a
* <code>Marshaller</code> and <code>Unmarshaller</code>, both of which can be set using properties. An abstract
@@ -122,10 +122,12 @@ public abstract class AbstractMarshallingPayloadEndpoint implements MessageEndpo
this.unmarshaller = unmarshaller;
}
@Override
public void afterPropertiesSet() throws Exception {
afterMarshallerSet();
}
@Override
public final void invoke(MessageContext messageContext) throws Exception {
WebServiceMessage request = messageContext.getRequest();
Object requestObject = unmarshalRequest(request);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,10 +19,10 @@ package org.springframework.ws.server.endpoint;
import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXResult;
import org.springframework.xml.transform.TransformerObjectSupport;
import org.xml.sax.ContentHandler;
import org.springframework.xml.transform.TransformerObjectSupport;
/**
* Abstract base class for endpoints that handle the message payload with a SAX <code>ContentHandler</code>. Allows
* subclasses to create a response by returning a <code>Source</code>.
@@ -47,6 +47,7 @@ public abstract class AbstractSaxPayloadEndpoint extends TransformerObjectSuppor
* @see #createContentHandler()
* @see #getResponse(org.xml.sax.ContentHandler)
*/
@Override
public final Source invoke(Source request) throws Exception {
ContentHandler contentHandler = null;
if (request != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,7 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
private XMLEventFactory eventFactory;
@Override
public final void invoke(MessageContext messageContext) throws Exception {
XMLEventReader eventReader = getEventReader(messageContext.getRequest().getPayloadSource());
XMLEventWriter streamWriter = new ResponseCreatingEventWriter(messageContext);
@@ -163,15 +164,18 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
this.messageContext = messageContext;
}
@Override
public NamespaceContext getNamespaceContext() {
return eventWriter.getNamespaceContext();
}
@Override
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
createEventWriter();
eventWriter.setNamespaceContext(context);
}
@Override
public void add(XMLEventReader reader) throws XMLStreamException {
createEventWriter();
while (reader.hasNext()) {
@@ -179,6 +183,7 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
}
}
@Override
public void add(XMLEvent event) throws XMLStreamException {
createEventWriter();
eventWriter.add(event);
@@ -197,28 +202,33 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
}
}
@Override
public void close() throws XMLStreamException {
if (eventWriter != null) {
eventWriter.close();
}
}
@Override
public void flush() throws XMLStreamException {
if (eventWriter != null) {
eventWriter.flush();
}
}
@Override
public String getPrefix(String uri) throws XMLStreamException {
createEventWriter();
return eventWriter.getPrefix(uri);
}
@Override
public void setDefaultNamespace(String uri) throws XMLStreamException {
createEventWriter();
eventWriter.setDefaultNamespace(uri);
}
@Override
public void setPrefix(String prefix, String uri) throws XMLStreamException {
createEventWriter();
eventWriter.setPrefix(prefix, uri);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -48,6 +48,7 @@ import org.springframework.ws.context.MessageContext;
@SuppressWarnings("Since15")
public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayloadEndpoint implements MessageEndpoint {
@Override
public final void invoke(MessageContext messageContext) throws Exception {
XMLStreamReader streamReader = getStreamReader(messageContext.getRequest().getPayloadSource());
XMLStreamWriter streamWriter = new ResponseCreatingStreamWriter(messageContext);
@@ -137,15 +138,18 @@ public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayl
this.messageContext = messageContext;
}
@Override
public NamespaceContext getNamespaceContext() {
return streamWriter.getNamespaceContext();
}
@Override
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
createStreamWriter();
streamWriter.setNamespaceContext(context);
}
@Override
public void close() throws XMLStreamException {
if (streamWriter != null) {
streamWriter.close();
@@ -166,147 +170,176 @@ public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayl
}
@Override
public void flush() throws XMLStreamException {
if (streamWriter != null) {
streamWriter.flush();
}
}
@Override
public String getPrefix(String uri) throws XMLStreamException {
createStreamWriter();
return streamWriter.getPrefix(uri);
}
@Override
public Object getProperty(String name) throws IllegalArgumentException {
return streamWriter.getProperty(name);
}
@Override
public void setDefaultNamespace(String uri) throws XMLStreamException {
createStreamWriter();
streamWriter.setDefaultNamespace(uri);
}
@Override
public void setPrefix(String prefix, String uri) throws XMLStreamException {
createStreamWriter();
streamWriter.setPrefix(prefix, uri);
}
@Override
public void writeAttribute(String localName, String value) throws XMLStreamException {
createStreamWriter();
streamWriter.writeAttribute(localName, value);
}
@Override
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException {
createStreamWriter();
streamWriter.writeAttribute(namespaceURI, localName, value);
}
@Override
public void writeAttribute(String prefix, String namespaceURI, String localName, String value)
throws XMLStreamException {
createStreamWriter();
streamWriter.writeAttribute(prefix, namespaceURI, localName, value);
}
@Override
public void writeCData(String data) throws XMLStreamException {
createStreamWriter();
streamWriter.writeCData(data);
}
@Override
public void writeCharacters(String text) throws XMLStreamException {
createStreamWriter();
streamWriter.writeCharacters(text);
}
@Override
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
createStreamWriter();
streamWriter.writeCharacters(text, start, len);
}
@Override
public void writeComment(String data) throws XMLStreamException {
createStreamWriter();
streamWriter.writeComment(data);
}
@Override
public void writeDTD(String dtd) throws XMLStreamException {
createStreamWriter();
streamWriter.writeDTD(dtd);
}
@Override
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException {
createStreamWriter();
streamWriter.writeDefaultNamespace(namespaceURI);
}
@Override
public void writeEmptyElement(String localName) throws XMLStreamException {
createStreamWriter();
streamWriter.writeEmptyElement(localName);
}
@Override
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException {
createStreamWriter();
streamWriter.writeEmptyElement(namespaceURI, localName);
}
@Override
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
createStreamWriter();
streamWriter.writeEmptyElement(prefix, localName, namespaceURI);
}
@Override
public void writeEndDocument() throws XMLStreamException {
createStreamWriter();
streamWriter.writeEndDocument();
}
@Override
public void writeEndElement() throws XMLStreamException {
createStreamWriter();
streamWriter.writeEndElement();
}
@Override
public void writeEntityRef(String name) throws XMLStreamException {
createStreamWriter();
streamWriter.writeEntityRef(name);
}
@Override
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException {
createStreamWriter();
streamWriter.writeNamespace(prefix, namespaceURI);
}
@Override
public void writeProcessingInstruction(String target) throws XMLStreamException {
createStreamWriter();
streamWriter.writeProcessingInstruction(target);
}
@Override
public void writeProcessingInstruction(String target, String data) throws XMLStreamException {
createStreamWriter();
streamWriter.writeProcessingInstruction(target, data);
}
@Override
public void writeStartDocument() throws XMLStreamException {
createStreamWriter();
streamWriter.writeStartDocument();
}
@Override
public void writeStartDocument(String version) throws XMLStreamException {
createStreamWriter();
streamWriter.writeStartDocument(version);
}
@Override
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
createStreamWriter();
streamWriter.writeStartDocument(encoding, version);
}
@Override
public void writeStartElement(String localName) throws XMLStreamException {
createStreamWriter();
streamWriter.writeStartElement(localName);
}
@Override
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException {
createStreamWriter();
streamWriter.writeStartElement(namespaceURI, localName);
}
@Override
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
createStreamWriter();
streamWriter.writeStartElement(prefix, localName, namespaceURI);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,11 +30,6 @@ 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;
@@ -50,6 +45,11 @@ 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>.
@@ -66,6 +66,7 @@ import org.xml.sax.XMLReader;
@SuppressWarnings("Since15")
public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSupport implements PayloadEndpoint {
@Override
public final Source invoke(Source request) throws Exception {
Element requestElement = null;
if (request != null) {
@@ -120,6 +121,7 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
private Element element;
@Override
public void domSource(Node node) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
element = DOMConverter.convert((org.w3c.dom.Element) node);
@@ -133,6 +135,7 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
}
}
@Override
public void saxSource(XMLReader reader, InputSource inputSource) throws IOException, SAXException {
try {
Builder builder = new Builder(reader);
@@ -157,15 +160,18 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
}
}
@Override
public void staxSource(XMLEventReader eventReader) throws XMLStreamException {
throw new IllegalArgumentException("XMLEventReader not supported");
}
@Override
public void staxSource(XMLStreamReader streamReader) throws XMLStreamException {
Document document = StaxStreamConverter.convert(streamReader);
element = document.getRootElement();
}
@Override
public void streamSource(InputStream inputStream) throws IOException {
try {
Builder builder = new Builder();
@@ -177,6 +183,7 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
}
}
@Override
public void streamSource(Reader reader) throws IOException {
try {
Builder builder = new Builder();
@@ -188,6 +195,7 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
}
}
@Override
public void source(String systemId) throws Exception {
try {
Builder builder = new Builder();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,6 +36,7 @@ public abstract class AbstractMethodEndpointAdapter extends TransformerObjectSup
* @param endpoint endpoint object to check
* @return whether or not this adapter can adapt the given endpoint
*/
@Override
public final boolean supports(Object endpoint) {
return endpoint instanceof MethodEndpoint && supportsInternal((MethodEndpoint) endpoint);
}
@@ -49,6 +50,7 @@ public abstract class AbstractMethodEndpointAdapter extends TransformerObjectSup
* <code>true</code>
* @throws Exception in case of errors
*/
@Override
public final void invoke(MessageContext messageContext, Object endpoint) throws Exception {
invokeInternal(messageContext, (MethodEndpoint) endpoint);
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2012 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -143,10 +143,12 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
return this.classLoader != null ? this.classLoader : DefaultMethodEndpointAdapter.class.getClassLoader();
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
@Override
public void afterPropertiesSet() throws Exception {
initDefaultStrategies();
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -128,6 +128,7 @@ public class MarshallingMethodEndpointAdapter extends AbstractMethodEndpointAdap
this.unmarshaller = unmarshaller;
}
@Override
public void afterPropertiesSet() throws Exception {
Assert.notNull(getMarshaller(), "marshaller is required");
Assert.notNull(getUnmarshaller(), "unmarshaller is required");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005 the original author or authors.
* Copyright 2005-2014 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.
@@ -33,10 +33,12 @@ import org.springframework.ws.soap.server.SoapMessageDispatcher;
*/
public class MessageEndpointAdapter implements EndpointAdapter {
@Override
public boolean supports(Object endpoint) {
return endpoint instanceof MessageEndpoint;
}
@Override
public void invoke(MessageContext messageContext, Object endpoint) throws Exception {
((MessageEndpoint) endpoint).invoke(messageContext);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005 the original author or authors.
* Copyright 2005-2014 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.
@@ -38,10 +38,12 @@ import org.springframework.xml.transform.TransformerObjectSupport;
*/
public class PayloadEndpointAdapter extends TransformerObjectSupport implements EndpointAdapter {
@Override
public boolean supports(Object endpoint) {
return endpoint instanceof PayloadEndpoint;
}
@Override
public void invoke(MessageContext messageContext, Object endpoint) throws Exception {
PayloadEndpoint payloadEndpoint = (PayloadEndpoint) endpoint;
Source requestSource = messageContext.getRequest().getPayloadSource();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -28,6 +28,11 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.context.MessageContext;
@@ -35,11 +40,6 @@ import org.springframework.ws.server.endpoint.MethodEndpoint;
import org.springframework.ws.server.endpoint.annotation.XPathParam;
import org.springframework.xml.namespace.SimpleNamespaceContext;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Adapter that supports endpoint methods that use XPath expressions. Supports methods with the following signature:
* <pre>
@@ -74,6 +74,7 @@ public class XPathParamAnnotationMethodEndpointAdapter extends AbstractMethodEnd
this.namespaces = namespaces;
}
@Override
public void afterPropertiesSet() throws Exception {
xpathFactory = XPathFactory.newInstance();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -46,6 +46,7 @@ public abstract class AbstractPayloadMethodProcessor extends TransformerObjectSu
* This implementation gets checks if the given parameter is annotated with {@link RequestPayload}, and invokes
* {@link #supportsRequestPayloadParameter(org.springframework.core.MethodParameter)} afterwards.
*/
@Override
public final boolean supportsParameter(MethodParameter parameter) {
Assert.isTrue(parameter.getParameterIndex() >= 0, "Parameter index larger smaller than 0");
if (parameter.getParameterAnnotation(RequestPayload.class) == null) {
@@ -73,6 +74,7 @@ public abstract class AbstractPayloadMethodProcessor extends TransformerObjectSu
* This implementation gets checks if the method of the given return type is annotated with {@link ResponsePayload},
* and invokes {@link #supportsResponsePayloadReturnType(org.springframework.core.MethodParameter)} afterwards.
*/
@Override
public final boolean supportsReturnType(MethodParameter returnType) {
Assert.isTrue(returnType.getParameterIndex() == -1, "Parameter index is not -1");
if (returnType.getMethodAnnotation(ResponsePayload.class) == null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -34,6 +34,7 @@ public abstract class AbstractPayloadSourceMethodProcessor extends AbstractPaylo
// MethodArgumentResolver
@Override
public final Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws Exception {
Source requestPayload = getRequestPayload(messageContext);
return requestPayload != null ? resolveRequestPayloadArgument(parameter, requestPayload) : null;
@@ -58,6 +59,7 @@ public abstract class AbstractPayloadSourceMethodProcessor extends AbstractPaylo
// MethodReturnValueHandler
@Override
public final void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue)
throws Exception {
if (returnValue != null) {

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -122,6 +122,7 @@ public class MarshallingPayloadMethodProcessor extends AbstractPayloadMethodProc
}
}
@Override
public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws Exception {
Unmarshaller unmarshaller = getUnmarshaller();
Assert.state(unmarshaller != null, "unmarshaller must not be null");
@@ -149,6 +150,7 @@ public class MarshallingPayloadMethodProcessor extends AbstractPayloadMethodProc
}
}
@Override
public void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue)
throws Exception {
if (returnValue == null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,10 +27,12 @@ import org.springframework.ws.context.MessageContext;
*/
public class MessageContextMethodArgumentResolver implements MethodArgumentResolver {
@Override
public boolean supportsParameter(MethodParameter parameter) {
return MessageContext.class.equals(parameter.getParameterType());
}
@Override
public MessageContext resolveArgument(MessageContext messageContext, MethodParameter parameter) throws Exception {
return messageContext;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -43,6 +43,7 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
private final XMLInputFactory inputFactory = createXmlInputFactory();
@Override
public boolean supportsParameter(MethodParameter parameter) {
if (parameter.getParameterAnnotation(RequestPayload.class) == null) {
return false;
@@ -53,6 +54,7 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
}
}
@Override
public Object resolveArgument(MessageContext messageContext, MethodParameter parameter)
throws TransformerException, XMLStreamException {
Source source = messageContext.getRequest().getPayloadSource();

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -25,6 +25,11 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.springframework.core.MethodParameter;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
@@ -33,11 +38,6 @@ import org.springframework.ws.server.endpoint.annotation.XPathParam;
import org.springframework.ws.server.endpoint.support.NamespaceUtils;
import org.springframework.xml.transform.TransformerHelper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Implementation of {@link MethodArgumentResolver} that supports the {@link XPathParam @XPathParam} annotation.
* <p/>
@@ -71,6 +71,7 @@ public class XPathParamMethodArgumentResolver implements MethodArgumentResolver
this.transformerHelper = transformerHelper;
}
@Override
public boolean supportsParameter(MethodParameter parameter) {
if (parameter.getParameterAnnotation(XPathParam.class) == null) {
return false;
@@ -87,6 +88,7 @@ public class XPathParamMethodArgumentResolver implements MethodArgumentResolver
}
}
@Override
public Object resolveArgument(MessageContext messageContext, MethodParameter parameter)
throws TransformerException, XPathExpressionException {
Class<?> parameterType = parameter.getParameterType();

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -243,30 +243,37 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
this.unmarshaller = createUnmarshaller(clazz);
}
@Override
public void domSource(Node node) throws JAXBException {
result = unmarshaller.unmarshal(node);
}
@Override
public void saxSource(XMLReader reader, InputSource inputSource) throws JAXBException {
result = unmarshaller.unmarshal(inputSource);
}
@Override
public void staxSource(XMLEventReader eventReader) throws JAXBException {
result = unmarshaller.unmarshal(eventReader);
}
@Override
public void staxSource(XMLStreamReader streamReader) throws JAXBException {
result = unmarshaller.unmarshal(streamReader);
}
@Override
public void streamSource(InputStream inputStream) throws IOException, JAXBException {
result = unmarshaller.unmarshal(inputStream);
}
@Override
public void streamSource(Reader reader) throws IOException, JAXBException {
result = unmarshaller.unmarshal(reader);
}
@Override
public void source(String systemId) throws Exception {
result = unmarshaller.unmarshal(new URL(systemId));
}
@@ -285,30 +292,37 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
this.declaredType = declaredType;
}
@Override
public void domSource(Node node) throws JAXBException {
result = unmarshaller.unmarshal(node, declaredType);
}
@Override
public void saxSource(XMLReader reader, InputSource inputSource) throws JAXBException {
result = unmarshaller.unmarshal(new SAXSource(reader, inputSource), declaredType);
}
@Override
public void staxSource(XMLEventReader eventReader) throws JAXBException {
result = unmarshaller.unmarshal(eventReader, declaredType);
}
@Override
public void staxSource(XMLStreamReader streamReader) throws JAXBException {
result = unmarshaller.unmarshal(streamReader, declaredType);
}
@Override
public void streamSource(InputStream inputStream) throws IOException, JAXBException {
result = unmarshaller.unmarshal(new StreamSource(inputStream), declaredType);
}
@Override
public void streamSource(Reader reader) throws IOException, JAXBException {
result = unmarshaller.unmarshal(new StreamSource(reader), declaredType);
}
@Override
public void source(String systemId) throws Exception {
result = unmarshaller.unmarshal(new StreamSource(systemId), declaredType);
}
@@ -325,30 +339,37 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
this.jaxbElement = jaxbElement;
}
@Override
public void domResult(Node node) throws JAXBException {
marshaller.marshal(jaxbElement, node);
}
@Override
public void saxResult(ContentHandler contentHandler, LexicalHandler lexicalHandler) throws JAXBException {
marshaller.marshal(jaxbElement, contentHandler);
}
@Override
public void staxResult(XMLEventWriter eventWriter) throws JAXBException {
marshaller.marshal(jaxbElement, eventWriter);
}
@Override
public void staxResult(XMLStreamWriter streamWriter) throws JAXBException {
marshaller.marshal(jaxbElement, streamWriter);
}
@Override
public void streamResult(OutputStream outputStream) throws JAXBException {
marshaller.marshal(jaxbElement, outputStream);
}
@Override
public void streamResult(Writer writer) throws JAXBException {
marshaller.marshal(jaxbElement, writer);
}
@Override
public void result(String systemId) throws Exception {
marshaller.marshal(jaxbElement, new StreamResult(systemId));
}
@@ -371,10 +392,12 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
this.name = introspector.getElementName(jaxbElement);
}
@Override
public QName getName() {
return name;
}
@Override
public void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException {
try {
marshaller.marshal(jaxbElement, streamWriter);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -41,6 +41,7 @@ public class JaxbElementPayloadMethodProcessor extends AbstractJaxb2PayloadMetho
return JAXBElement.class.equals(parameterType) && genericType instanceof ParameterizedType;
}
@Override
public JAXBElement<?> resolveArgument(MessageContext messageContext, MethodParameter parameter)
throws JAXBException {
ParameterizedType parameterizedType = (ParameterizedType) parameter.getGenericParameterType();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -42,6 +42,7 @@ public class XmlRootElementPayloadMethodProcessor extends AbstractJaxb2PayloadMe
parameterType.isAnnotationPresent(XmlType.class);
}
@Override
public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws JAXBException {
Class<?> parameterType = parameter.getParameterType();

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -153,6 +153,7 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
this.validateResponse = validateResponse;
}
@Override
public void afterPropertiesSet() throws Exception {
if (validator == null && !ObjectUtils.isEmpty(schemas)) {
Assert.hasLength(schemaLanguage, "schemaLanguage is required");
@@ -178,6 +179,7 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
* @return <code>true</code> if the message is valid; <code>false</code> otherwise
* @see #setValidateRequest(boolean)
*/
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint)
throws IOException, SAXException, TransformerException {
if (validateRequest) {
@@ -221,6 +223,7 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
* @return <code>true</code> if the response is valid; <code>false</code> otherwise
* @see #setValidateResponse(boolean)
*/
@Override
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws IOException, SAXException {
if (validateResponse) {
Source responseSource = getValidationResponseSource(messageContext.getResponse());
@@ -253,11 +256,13 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
}
/** Does nothing by default. Faults are not validated. */
@Override
public boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception {
return true;
}
/** Does nothing by default.*/
@Override
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) {
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -56,6 +56,7 @@ public class DelegatingSmartEndpointInterceptor implements SmartEndpointIntercep
* <p/>
* This implementation delegates to {@link #shouldIntercept(WebServiceMessage, Object)}.
*/
@Override
public boolean shouldIntercept(MessageContext messageContext, Object endpoint) {
WebServiceMessage request = messageContext.getRequest();
return request != null && shouldIntercept(request, endpoint);
@@ -74,18 +75,22 @@ public class DelegatingSmartEndpointInterceptor implements SmartEndpointIntercep
return true;
}
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
return getDelegate().handleRequest(messageContext, endpoint);
}
@Override
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception {
return getDelegate().handleResponse(messageContext, endpoint);
}
@Override
public boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception {
return getDelegate().handleFault(messageContext, endpoint);
}
@Override
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) throws Exception {
getDelegate().afterCompletion(messageContext, endpoint, ex);
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -16,13 +16,13 @@
package org.springframework.ws.server.endpoint.interceptor;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.EndpointInterceptor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Element;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.EndpointInterceptor;
/**
* Default implementation of the <code>EndpointInterceptor</code> interface, for simplified implementation of
* pre-only/post-only interceptors.
@@ -45,6 +45,7 @@ public class EndpointInterceptorAdapter implements EndpointInterceptor {
*
* @return <code>true</code>
*/
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
return true;
}
@@ -54,6 +55,7 @@ public class EndpointInterceptorAdapter implements EndpointInterceptor {
*
* @return <code>true</code>
*/
@Override
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception {
return true;
}
@@ -63,6 +65,7 @@ public class EndpointInterceptorAdapter implements EndpointInterceptor {
*
* @return <code>true</code>
*/
@Override
public boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception {
return true;
}
@@ -70,6 +73,7 @@ public class EndpointInterceptorAdapter implements EndpointInterceptor {
/**
* Does nothing by default.
*/
@Override
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) throws Exception {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -26,6 +26,11 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
@@ -35,11 +40,6 @@ import org.springframework.ws.server.EndpointInterceptor;
import org.springframework.xml.transform.ResourceSource;
import org.springframework.xml.transform.TransformerObjectSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
/**
* Interceptor that transforms the payload of <code>WebServiceMessage</code>s using XSLT stylesheet. Allows for seperate
* stylesheets for request and response. This interceptor is especially useful when supporting with multiple version of
@@ -85,6 +85,7 @@ public class PayloadTransformingInterceptor extends TransformerObjectSupport
* @return always returns <code>true</code>
* @see #setRequestXslt(org.springframework.core.io.Resource)
*/
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
if (requestTemplates != null) {
WebServiceMessage request = messageContext.getRequest();
@@ -103,6 +104,7 @@ public class PayloadTransformingInterceptor extends TransformerObjectSupport
* @return always returns <code>true</code>
* @see #setResponseXslt(org.springframework.core.io.Resource)
*/
@Override
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception {
if (responseTemplates != null) {
WebServiceMessage response = messageContext.getResponse();
@@ -121,14 +123,17 @@ public class PayloadTransformingInterceptor extends TransformerObjectSupport
}
/** Does nothing by default. Faults are not transformed. */
@Override
public boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception {
return true;
}
/** Does nothing by default.*/
@Override
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) {
}
@Override
public void afterPropertiesSet() throws Exception {
if (requestXslt == null && responseXslt == null) {
throw new IllegalArgumentException("Setting either 'requestXslt' or 'responseXslt' is required");

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -67,6 +67,7 @@ public abstract class AbstractEndpointMapping extends ApplicationObjectSupport i
this.interceptors = interceptors;
}
@Override
public final int getOrder() {
return order;
}
@@ -113,6 +114,7 @@ public abstract class AbstractEndpointMapping extends ApplicationObjectSupport i
* @return the looked up endpoint instance, or the default endpoint
* @see #getEndpointInternal(org.springframework.ws.context.MessageContext)
*/
@Override
public final EndpointInvocationChain getEndpoint(MessageContext messageContext) throws Exception {
Object endpoint = getEndpointInternal(messageContext);
if (endpoint == null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -105,6 +105,7 @@ public class SimpleMethodEndpointMapping extends AbstractMethodEndpointMapping<S
this.methodSuffix = methodSuffix;
}
@Override
public final void afterPropertiesSet() throws Exception {
Assert.notEmpty(getEndpoints(), "'endpoints' is required");
transformerFactory = TransformerFactory.newInstance();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,8 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import org.w3c.dom.Element;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -30,8 +32,6 @@ import org.springframework.ws.context.MessageContext;
import org.springframework.xml.xpath.XPathExpression;
import org.springframework.xml.xpath.XPathExpressionFactory;
import org.w3c.dom.Element;
/**
* Implementation of the <code>EndpointMapping</code> interface that maps to endpoint using an XPath expression.
* Supports both mapping to bean instances and mapping to bean names: the latter is required for prototype endpoints.
@@ -77,6 +77,7 @@ public class XPathPayloadEndpointMapping extends AbstractMapBasedEndpointMapping
this.namespaces = namespaces;
}
@Override
public void afterPropertiesSet() throws Exception {
Assert.notNull(expressionString, "expression is required");
if (namespaces == null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -29,15 +29,15 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import org.springframework.xml.namespace.QNameUtils;
import org.springframework.xml.transform.TransformerHelper;
import org.springframework.xml.transform.TraxUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.springframework.xml.namespace.QNameUtils;
import org.springframework.xml.transform.TransformerHelper;
import org.springframework.xml.transform.TraxUtils;
/**
* Helper class for determining the root qualified name of a Web Service payload.
*
@@ -92,6 +92,7 @@ public abstract class PayloadRootUtils {
private QName result;
@Override
public void domSource(Node node) throws Exception {
if (node.getNodeType() == Node.ELEMENT_NODE) {
result = QNameUtils.getQNameForNode(node);
@@ -102,6 +103,7 @@ public abstract class PayloadRootUtils {
}
}
@Override
public void staxSource(XMLEventReader eventReader) throws Exception {
XMLEvent event = eventReader.peek();
if (event != null && event.isStartDocument()) {
@@ -117,6 +119,7 @@ public abstract class PayloadRootUtils {
}
}
@Override
public void staxSource(XMLStreamReader streamReader) throws Exception {
if (streamReader.getEventType() == XMLStreamConstants.START_DOCUMENT) {
try {
@@ -132,18 +135,22 @@ public abstract class PayloadRootUtils {
}
}
@Override
public void saxSource(XMLReader reader, InputSource inputSource) throws Exception {
// Do nothing
}
@Override
public void streamSource(InputStream inputStream) throws Exception {
// Do nothing
}
@Override
public void streamSource(Reader reader) throws Exception {
// Do nothing
}
@Override
public void source(String systemId) throws Exception {
// Do nothing
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2014 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.
@@ -32,31 +32,37 @@ public abstract class AbstractSoapMessage extends AbstractMimeMessage implements
private SoapVersion version;
/** Returns <code>getEnvelope().getBody()</code>. */
@Override
public final SoapBody getSoapBody() {
return getEnvelope().getBody();
}
/** Returns <code>getEnvelope().getHeader()</code>. */
@Override
public final SoapHeader getSoapHeader() {
return getEnvelope().getHeader();
}
/** Returns <code>getSoapBody().getPayloadSource()</code>. */
@Override
public final Source getPayloadSource() {
return getSoapBody().getPayloadSource();
}
/** Returns <code>getSoapBody().getPayloadResult()</code>. */
@Override
public final Result getPayloadResult() {
return getSoapBody().getPayloadResult();
}
/** Returns <code>getSoapBody().hasFault()</code>. */
@Override
public final boolean hasFault() {
return getSoapBody().hasFault();
}
/** Returns <code>getSoapBody().getFault().getFaultStringOrReason()</code>. */
@Override
public final String getFaultReason() {
if (hasFault()) {
return getSoapBody().getFault().getFaultStringOrReason();
@@ -66,6 +72,7 @@ public abstract class AbstractSoapMessage extends AbstractMimeMessage implements
}
}
@Override
public SoapVersion getVersion() {
if (version == null) {
String envelopeNamespace = getEnvelope().getName().getNamespaceURI();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -46,6 +46,7 @@ public interface SoapMessageFactory extends WebServiceMessageFactory {
*
* @return the empty message
*/
@Override
SoapMessage createWebServiceMessage();
/**
@@ -58,6 +59,7 @@ public interface SoapMessageFactory extends WebServiceMessageFactory {
* @return the created message
* @throws java.io.IOException if an I/O exception occurs
*/
@Override
SoapMessage createWebServiceMessage(InputStream inputStream) throws IOException;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -234,6 +234,7 @@ public class ActionCallback implements WebServiceMessageCallback {
}
}
@Override
public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
Assert.isInstanceOf(SoapMessage.class, message);
SoapMessage soapMessage = (SoapMessage) message;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007 the original author or authors.
* Copyright 2005-2014 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.
@@ -35,10 +35,12 @@ public class UuidMessageIdStrategy implements MessageIdStrategy {
public static final String PREFIX = "urn:uuid:";
/** Returns <code>false</code>. */
@Override
public boolean isDuplicate(URI messageId) {
return false;
}
@Override
public URI newMessageId(SoapMessage message) {
return URI.create(PREFIX + UUID.randomUUID().toString());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -85,6 +85,7 @@ public abstract class AbstractActionEndpointMapping extends AbstractAddressingEn
this.faultActionSuffix = faultActionSuffix;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -98,20 +98,24 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
messageIdStrategy = new UuidMessageIdStrategy();
}
@Override
public final void setActorOrRole(String actorOrRole) {
Assert.notNull(actorOrRole, "actorOrRole must not be null");
actorsOrRoles = new String[]{actorOrRole};
}
@Override
public final void setActorsOrRoles(String[] actorsOrRoles) {
Assert.notEmpty(actorsOrRoles, "actorsOrRoles must not be empty");
this.actorsOrRoles = actorsOrRoles;
}
@Override
public final void setUltimateReceiver(boolean ultimateReceiver) {
this.isUltimateReceiver = ultimateReceiver;
}
@Override
public final int getOrder() {
return order;
}
@@ -206,12 +210,14 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
this.versions = versions;
}
@Override
public void afterPropertiesSet() throws Exception {
if (logger.isInfoEnabled()) {
logger.info("Supporting " + Arrays.asList(versions));
}
}
@Override
public final EndpointInvocationChain getEndpoint(MessageContext messageContext) throws TransformerException {
Assert.isInstanceOf(SoapMessage.class, messageContext.getRequest());
SoapMessage request = (SoapMessage) messageContext.getRequest();

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -19,6 +19,9 @@ 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;
@@ -31,9 +34,6 @@ 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 instantiated by
* the {@link AbstractAddressingEndpointMapping}.
@@ -70,6 +70,7 @@ class AddressingEndpointInterceptor implements SoapEndpointInterceptor {
this.faultAction = faultAction;
}
@Override
public final boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
Assert.isInstanceOf(SoapMessage.class, messageContext.getRequest());
SoapMessage request = (SoapMessage) messageContext.getRequest();
@@ -85,10 +86,12 @@ class AddressingEndpointInterceptor implements SoapEndpointInterceptor {
return true;
}
@Override
public final boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception {
return handleResponseOrFault(messageContext, false);
}
@Override
public final boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception {
return handleResponseOrFault(messageContext, true);
}
@@ -178,9 +181,11 @@ class AddressingEndpointInterceptor implements SoapEndpointInterceptor {
return responseMessageId;
}
@Override
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) {
}
@Override
public boolean understands(SoapHeaderElement header) {
return version.understands(header);
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -139,10 +139,12 @@ public class AnnotationActionEndpointMapping extends AbstractActionMethodEndpoin
}
}
@Override
public final Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
@Override
public final Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (AopUtils.getTargetClass(bean).getAnnotation(getEndpointAnnotationType()) != null) {
registerMethods(bean);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -33,6 +33,10 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.springframework.util.StringUtils;
import org.springframework.ws.soap.SoapFault;
import org.springframework.ws.soap.SoapHeader;
@@ -49,10 +53,6 @@ import org.springframework.xml.transform.TransformerObjectSupport;
import org.springframework.xml.xpath.XPathExpression;
import org.springframework.xml.xpath.XPathExpressionFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
* Abstract base class for {@link AddressingVersion} implementations. Uses {@link XPathExpression}s to retrieve
* addressing information.
@@ -121,6 +121,7 @@ public abstract class AbstractAddressingVersion extends TransformerObjectSupport
return XPathExpressionFactory.createXPathExpression(expression, namespaces);
}
@Override
public MessageAddressingProperties getMessageAddressingProperties(SoapMessage message) {
Element headerElement = getSoapHeaderElement(message);
URI to = getUri(headerElement, toExpression);
@@ -191,6 +192,7 @@ public abstract class AbstractAddressingVersion extends TransformerObjectSupport
return new EndpointReference(address, referenceProperties, referenceParameters);
}
@Override
public void addAddressingHeaders(SoapMessage message, MessageAddressingProperties map) {
SoapHeader header = message.getSoapHeader();
header.addNamespaceDeclaration(getNamespacePrefix(), getNamespaceUri());
@@ -232,6 +234,7 @@ public abstract class AbstractAddressingVersion extends TransformerObjectSupport
addReferenceNodes(header.getResult(), map.getReferenceProperties());
}
@Override
public final boolean understands(SoapHeaderElement headerElement) {
return getNamespaceUri().equals(headerElement.getName().getNamespaceURI());
}
@@ -280,11 +283,13 @@ public abstract class AbstractAddressingVersion extends TransformerObjectSupport
}
}
@Override
public final SoapFault addInvalidAddressingHeaderFault(SoapMessage message) {
return addAddressingFault(message, getInvalidAddressingHeaderFaultSubcode(),
getInvalidAddressingHeaderFaultReason());
}
@Override
public final SoapFault addMessageAddressingHeaderRequiredFault(SoapMessage message) {
return addAddressingFault(message, getMessageAddressingHeaderRequiredFaultSubcode(),
getMessageAddressingHeaderRequiredFaultReason());
@@ -308,11 +313,13 @@ public abstract class AbstractAddressingVersion extends TransformerObjectSupport
* Address URIs
*/
@Override
public final boolean hasAnonymousAddress(EndpointReference epr) {
URI anonymous = getAnonymous();
return anonymous != null && anonymous.equals(epr.getAddress());
}
@Override
public final boolean hasNoneAddress(EndpointReference epr) {
URI none = getNone();
return none != null && none.equals(epr.getAddress());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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 @@ public class Addressing10 extends AbstractAddressingVersion {
super.addAddressingHeaders(message, map);
}
@Override
public boolean hasRequiredProperties(MessageAddressingProperties map) {
if (map.getAction() == null) {
return false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -45,6 +45,7 @@ public class Addressing200408 extends AbstractAddressingVersion {
super.addAddressingHeaders(message, map);
}
@Override
public boolean hasRequiredProperties(MessageAddressingProperties map) {
if (map.getTo() == null) {
return false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007 the original author or authors.
* Copyright 2005-2014 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.
@@ -42,23 +42,28 @@ class AxiomAttachment implements Attachment {
this.dataHandler = dataHandler;
}
@Override
public String getContentId() {
return contentId;
}
@Override
public String getContentType() {
return dataHandler.getContentType();
}
@Override
public InputStream getInputStream() throws IOException {
return dataHandler.getInputStream();
}
@Override
public long getSize() {
// Axiom does not support getting the size of attachments.
return -1;
}
@Override
public DataHandler getDataHandler() {
return dataHandler;
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2012 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -74,22 +74,27 @@ class AxiomHandler implements ContentHandler, LexicalHandler {
}
}
@Override
public void startDocument() throws SAXException {
removeAllNamespaceMappings();
newNamespaceMapping();
}
@Override
public void endDocument() throws SAXException {
removeAllNamespaceMappings();
}
@Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
currentNamespaceMapping().put(prefix, uri);
}
@Override
public void endPrefixMapping(String prefix) throws SAXException {
}
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
OMContainer parent = getParent();
@@ -134,18 +139,21 @@ class AxiomHandler implements ContentHandler, LexicalHandler {
(XMLConstants.XMLNS_ATTRIBUTE.equals(prefix) && localPart.length() != 0);
}
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
elements.remove(elements.size() - 1);
removeNamespaceMapping();
}
@Override
public void characters(char ch[], int start, int length) throws SAXException {
String data = new String(ch, start, length);
OMContainer parent = getParent();
factory.createOMText(parent, data, charactersType);
}
@Override
public void ignorableWhitespace(char ch[], int start, int length)
throws SAXException {
charactersType = XMLStreamConstants.SPACE;
@@ -153,31 +161,37 @@ class AxiomHandler implements ContentHandler, LexicalHandler {
charactersType = XMLStreamConstants.CHARACTERS;
}
@Override
public void processingInstruction(String target, String data) throws SAXException {
OMContainer parent = getParent();
factory.createOMProcessingInstruction(parent, target, data);
}
@Override
public void comment(char ch[], int start, int length) throws SAXException {
String content = new String(ch, start, length);
OMContainer parent = getParent();
factory.createOMComment(parent, content);
}
@Override
public void startCDATA() throws SAXException {
charactersType = XMLStreamConstants.CDATA;
}
@Override
public void endCDATA() throws SAXException {
charactersType = XMLStreamConstants.CHARACTERS;
}
@Override
public void startEntity(String name) throws SAXException {
if (!isPredefinedEntityReference(name)) {
charactersType = XMLStreamConstants.ENTITY_REFERENCE;
}
}
@Override
public void endEntity(String name) throws SAXException {
charactersType = XMLStreamConstants.CHARACTERS;
}
@@ -192,16 +206,20 @@ class AxiomHandler implements ContentHandler, LexicalHandler {
* Unsupported
*/
@Override
public void setDocumentLocator(Locator locator) {
}
@Override
public void skippedEntity(String name) throws SAXException {
}
@Override
public void startDTD(String name, String publicId, String systemId)
throws SAXException {
}
@Override
public void endDTD() throws SAXException {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,6 @@ package org.springframework.ws.soap.axiom;
import java.util.Locale;
import javax.xml.namespace.QName;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.soap.soap11.Soap11Body;
import org.springframework.ws.soap.soap11.Soap11Fault;
import org.springframework.xml.namespace.QNameUtils;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAP11Constants;
@@ -36,6 +29,13 @@ import org.apache.axiom.soap.SOAPFaultCode;
import org.apache.axiom.soap.SOAPFaultReason;
import org.apache.axiom.soap.SOAPProcessingException;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.soap.soap11.Soap11Body;
import org.springframework.ws.soap.soap11.Soap11Fault;
import org.springframework.xml.namespace.QNameUtils;
/**
* Axiom-specific version of <code>org.springframework.ws.soap.Soap11Body</code>.
*
@@ -54,26 +54,31 @@ class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
}
@Override
public Soap11Fault addMustUnderstandFault(String faultString, Locale locale) {
SOAPFault fault = addStandardFault(SOAP11Constants.FAULT_CODE_MUST_UNDERSTAND, faultString, locale);
return new AxiomSoap11Fault(fault, getAxiomFactory());
}
@Override
public Soap11Fault addClientOrSenderFault(String faultString, Locale locale) {
SOAPFault fault = addStandardFault(SOAP11Constants.FAULT_CODE_SENDER, faultString, locale);
return new AxiomSoap11Fault(fault, getAxiomFactory());
}
@Override
public Soap11Fault addServerOrReceiverFault(String faultString, Locale locale) {
SOAPFault fault = addStandardFault(SOAP11Constants.FAULT_CODE_RECEIVER, faultString, locale);
return new AxiomSoap11Fault(fault, getAxiomFactory());
}
@Override
public Soap11Fault addVersionMismatchFault(String faultString, Locale locale) {
SOAPFault fault = addStandardFault(SOAP11Constants.FAULT_CODE_VERSION_MISMATCH, faultString, locale);
return new AxiomSoap11Fault(fault, getAxiomFactory());
}
@Override
public Soap11Fault addFault(QName code, String faultString, Locale faultStringLocale) {
Assert.notNull(code, "No faultCode given");
Assert.hasLength(faultString, "faultString cannot be empty");
@@ -147,6 +152,7 @@ class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
faultReason.addAttribute(langAttribute);
}
@Override
public Soap11Fault getFault() {
SOAPFault axiomFault = getAxiomBody().getFault();
return axiomFault != null ? new AxiomSoap11Fault(axiomFault, getAxiomFactory()) : null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2014 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,7 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPFault;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.soap.soap11.Soap11Fault;
@@ -37,10 +38,12 @@ class AxiomSoap11Fault extends AxiomSoapFault implements Soap11Fault {
super(axiomFault, axiomFactory);
}
@Override
public QName getFaultCode() {
return getAxiomFault().getCode().getTextAsQName();
}
@Override
public String getFaultStringOrReason() {
if (getAxiomFault().getReason() != null) {
return getAxiomFault().getReason().getText();
@@ -48,6 +51,7 @@ class AxiomSoap11Fault extends AxiomSoapFault implements Soap11Fault {
return null;
}
@Override
public Locale getFaultStringLocale() {
if (getAxiomFault().getReason() != null) {
OMAttribute langAttribute =

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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 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.apache.axiom.soap.SOAPHeaderBlock;
import org.springframework.util.ObjectUtils;
import org.springframework.ws.soap.SoapHeaderElement;
import org.springframework.ws.soap.soap11.Soap11Header;
/**
* Axiom-specific version of <code>org.springframework.ws.soap.Soap11Header</code>.
*
@@ -41,6 +41,7 @@ class AxiomSoap11Header extends AxiomSoapHeader implements Soap11Header {
super(axiomHeader, axiomFactory);
}
@Override
@SuppressWarnings("unchecked")
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(final String[] actors) {
RolePlayer rolePlayer = null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,11 +19,6 @@ package org.springframework.ws.soap.axiom;
import java.util.Locale;
import javax.xml.namespace.QName;
import org.springframework.util.Assert;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.soap.soap12.Soap12Body;
import org.springframework.ws.soap.soap12.Soap12Fault;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPFactory;
@@ -34,6 +29,11 @@ import org.apache.axiom.soap.SOAPFaultText;
import org.apache.axiom.soap.SOAPFaultValue;
import org.apache.axiom.soap.SOAPProcessingException;
import org.springframework.util.Assert;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.soap.soap12.Soap12Body;
import org.springframework.ws.soap.soap12.Soap12Fault;
/**
* Axiom-specific version of <code>org.springframework.ws.soap.Soap12Body</code>.
*
@@ -46,30 +46,35 @@ class AxiomSoap12Body extends AxiomSoapBody implements Soap12Body {
super(axiomBody, axiomFactory, payloadCaching);
}
@Override
public Soap12Fault addMustUnderstandFault(String reason, Locale locale) {
Assert.notNull(locale, "No locale given");
SOAPFault fault = addStandardFault(SOAP12Constants.FAULT_CODE_MUST_UNDERSTAND, reason, locale);
return new AxiomSoap12Fault(fault, getAxiomFactory());
}
@Override
public Soap12Fault addClientOrSenderFault(String reason, Locale locale) {
Assert.notNull(locale, "No locale given");
SOAPFault fault = addStandardFault(SOAP12Constants.FAULT_CODE_SENDER, reason, locale);
return new AxiomSoap12Fault(fault, getAxiomFactory());
}
@Override
public Soap12Fault addServerOrReceiverFault(String reason, Locale locale) {
Assert.notNull(locale, "No locale given");
SOAPFault fault = addStandardFault(SOAP12Constants.FAULT_CODE_RECEIVER, reason, locale);
return new AxiomSoap12Fault(fault, getAxiomFactory());
}
@Override
public Soap12Fault addVersionMismatchFault(String reason, Locale locale) {
Assert.notNull(locale, "No locale given");
SOAPFault fault = addStandardFault(SOAP12Constants.FAULT_CODE_VERSION_MISMATCH, reason, locale);
return new AxiomSoap12Fault(fault, getAxiomFactory());
}
@Override
public Soap12Fault addDataEncodingUnknownFault(QName[] subcodes, String reason, Locale locale) {
Assert.notNull(locale, "No locale given");
SOAPFault fault = addStandardFault(SOAP12Constants.FAULT_CODE_DATA_ENCODING_UNKNOWN, reason, locale);
@@ -97,6 +102,7 @@ class AxiomSoap12Body extends AxiomSoapBody implements Soap12Body {
}
}
@Override
public Soap12Fault getFault() {
SOAPFault axiomFault = getAxiomBody().getFault();
return axiomFault != null ? new AxiomSoap12Fault(axiomFault, getAxiomFactory()) : null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,11 +22,6 @@ 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;
@@ -38,6 +33,11 @@ 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 {
@@ -45,10 +45,12 @@ class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
super(axiomFault, axiomFactory);
}
@Override
public QName getFaultCode() {
return getAxiomFault().getCode().getValue().getTextAsQName();
}
@Override
public Iterator<QName> getFaultSubcodes() {
List<QName> subcodes = new ArrayList<QName>();
SOAPFaultSubCode subcode = getAxiomFault().getCode().getSubCode();
@@ -59,6 +61,7 @@ class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
return subcodes.iterator();
}
@Override
public void addFaultSubcode(QName subcode) {
SOAPFaultCode faultCode = getAxiomFault().getCode();
SOAPFaultSubCode faultSubCode = null;
@@ -99,6 +102,7 @@ class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
faultValue.setText(prefix + ":" + code.getLocalPart());
}
@Override
public String getFaultNode() {
SOAPFaultNode faultNode = getAxiomFault().getNode();
if (faultNode == null) {
@@ -109,6 +113,7 @@ class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
}
}
@Override
public void setFaultNode(String uri) {
try {
SOAPFaultNode faultNode = getAxiomFactory().createSOAPFaultNode(getAxiomFault());
@@ -120,10 +125,12 @@ class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
}
}
@Override
public String getFaultStringOrReason() {
return getFaultReasonText(Locale.getDefault());
}
@Override
public String getFaultReasonText(Locale locale) {
SOAPFaultReason faultReason = getAxiomFault().getReason();
String language = AxiomUtils.toLanguage(locale);
@@ -131,6 +138,7 @@ class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
return faultText != null ? faultText.getText() : null;
}
@Override
public void setFaultReasonText(Locale locale, String text) {
SOAPFaultReason faultReason = getAxiomFault().getReason();
String language = AxiomUtils.toLanguage(locale);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,12 +21,6 @@ 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;
@@ -36,6 +30,12 @@ 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>.
*
@@ -48,6 +48,7 @@ class AxiomSoap12Header extends AxiomSoapHeader implements Soap12Header {
super(axiomHeader, axiomFactory);
}
@Override
public SoapHeaderElement addNotUnderstoodHeaderElement(QName headerName) {
try {
SOAPHeaderBlock notUnderstood =
@@ -62,6 +63,7 @@ class AxiomSoap12Header extends AxiomSoapHeader implements Soap12Header {
}
}
@Override
public SoapHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris) {
try {
SOAPHeaderBlock upgrade = getAxiomHeader().addHeaderBlock("Upgrade", getAxiomHeader().getNamespace());
@@ -78,6 +80,7 @@ class AxiomSoap12Header extends AxiomSoapHeader implements Soap12Header {
}
}
@Override
@SuppressWarnings("unchecked")
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(final String[] roles, final boolean isUltimateDestination)
throws SoapHeaderException {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,16 +19,16 @@ package org.springframework.ws.soap.axiom;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import org.springframework.util.Assert;
import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.stream.StreamingPayload;
import org.apache.axiom.om.OMDataSource;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPFactory;
import org.springframework.util.Assert;
import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.stream.StreamingPayload;
/**
* Axiom-specific version of <code>org.springframework.ws.soap.Soap11Body</code>.
*
@@ -49,14 +49,17 @@ abstract class AxiomSoapBody extends AxiomSoapElement implements SoapBody {
}
}
@Override
public Source getPayloadSource() {
return payload.getSource();
}
@Override
public Result getPayloadResult() {
return payload.getResult();
}
@Override
public boolean hasFault() {
return getAxiomBody().hasFault();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2005-2014 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.
@@ -52,6 +52,7 @@ class AxiomSoapElement implements SoapElement {
this.axiomFactory = axiomFactory;
}
@Override
public final QName getName() {
try {
return axiomElement.getQName();
@@ -61,6 +62,7 @@ class AxiomSoapElement implements SoapElement {
}
}
@Override
public final Source getSource() {
try {
return StaxUtils.createCustomStaxSource(axiomElement.getXMLStreamReader());
@@ -70,6 +72,7 @@ class AxiomSoapElement implements SoapElement {
}
}
@Override
public final void addAttribute(QName name, String value) {
try {
String namespaceUri = name.getNamespaceURI();
@@ -87,6 +90,7 @@ class AxiomSoapElement implements SoapElement {
}
}
@Override
public void removeAttribute(QName name) {
try {
OMAttribute attribute = getAxiomElement().getAttribute(name);
@@ -99,6 +103,7 @@ class AxiomSoapElement implements SoapElement {
}
}
@Override
public final String getAttributeValue(QName name) {
try {
return getAxiomElement().getAttributeValue(name);
@@ -108,6 +113,7 @@ class AxiomSoapElement implements SoapElement {
}
}
@Override
public final Iterator<QName> getAllAttributes() {
try {
List<QName> results = new ArrayList<QName>();
@@ -123,6 +129,7 @@ class AxiomSoapElement implements SoapElement {
}
}
@Override
public void addNamespaceDeclaration(String prefix, String namespaceUri) {
try {
if (StringUtils.hasLength(prefix)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2005-2014 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.
@@ -51,6 +51,7 @@ class AxiomSoapEnvelope extends AxiomSoapElement implements SoapEnvelope {
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
}
@Override
public SoapHeader getHeader() {
try {
if (getAxiomEnvelope().getHeader() == null) {
@@ -75,6 +76,7 @@ class AxiomSoapEnvelope extends AxiomSoapElement implements SoapEnvelope {
}
}
@Override
public SoapBody getBody() {
if (body == null) {
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2014 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,7 @@ import org.apache.axiom.soap.SOAPFault;
import org.apache.axiom.soap.SOAPFaultDetail;
import org.apache.axiom.soap.SOAPFaultRole;
import org.apache.axiom.soap.SOAPProcessingException;
import org.springframework.ws.soap.SoapFault;
import org.springframework.ws.soap.SoapFaultDetail;
@@ -32,11 +33,13 @@ abstract class AxiomSoapFault extends AxiomSoapElement implements SoapFault {
super(axiomFault, axiomFactory);
}
@Override
public String getFaultActorOrRole() {
SOAPFaultRole faultRole = getAxiomFault().getRole();
return faultRole != null ? faultRole.getRoleValue() : null;
}
@Override
public void setFaultActorOrRole(String actor) {
try {
SOAPFaultRole axiomFaultRole = getAxiomFactory().createSOAPFaultRole(getAxiomFault());
@@ -48,6 +51,7 @@ abstract class AxiomSoapFault extends AxiomSoapElement implements SoapFault {
}
@Override
public SoapFaultDetail getFaultDetail() {
try {
SOAPFaultDetail axiomFaultDetail = getAxiomFault().getDetail();
@@ -59,6 +63,7 @@ abstract class AxiomSoapFault extends AxiomSoapElement implements SoapFault {
}
@Override
public SoapFaultDetail addFaultDetail() {
try {
SOAPFaultDetail axiomFaultDetail = getAxiomFactory().createSOAPFaultDetail(getAxiomFault());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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>.
*
@@ -40,6 +40,7 @@ class AxiomSoapFaultDetail extends AxiomSoapElement implements SoapFaultDetail {
super(axiomFaultDetail, axiomFactory);
}
@Override
public SoapFaultDetailElement addFaultDetailElement(QName name) {
try {
OMElement element = getAxiomFactory().createOMElement(name, getAxiomFaultDetail());
@@ -51,10 +52,12 @@ class AxiomSoapFaultDetail extends AxiomSoapElement implements SoapFaultDetail {
}
@Override
public Iterator<SoapFaultDetailElement> getDetailEntries() {
return new AxiomSoapFaultDetailElementIterator(getAxiomFaultDetail().getChildElements());
}
@Override
public Result getResult() {
return new AxiomResult(getAxiomFaultDetail(), getAxiomFactory());
}
@@ -71,10 +74,12 @@ class AxiomSoapFaultDetail extends AxiomSoapElement implements SoapFaultDetail {
this.axiomIterator = axiomIterator;
}
@Override
public boolean hasNext() {
return axiomIterator.hasNext();
}
@Override
public SoapFaultDetailElement next() {
try {
OMElement axiomElement = axiomIterator.next();
@@ -86,6 +91,7 @@ class AxiomSoapFaultDetail extends AxiomSoapElement implements SoapFaultDetail {
}
@Override
public void remove() {
axiomIterator.remove();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2014 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,6 +36,7 @@ class AxiomSoapFaultDetailElement extends AxiomSoapElement implements SoapFaultD
super(axiomElement, soapFactory);
}
@Override
public Result getResult() {
try {
return new AxiomResult(getAxiomElement(), getAxiomFactory());
@@ -46,6 +47,7 @@ class AxiomSoapFaultDetailElement extends AxiomSoapElement implements SoapFaultD
}
@Override
public void addText(String text) {
try {
getAxiomElement().setText(text);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,6 @@ 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;
@@ -32,6 +27,11 @@ 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>.
*
@@ -44,10 +44,12 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
super(axiomHeader, axiomFactory);
}
@Override
public Result getResult() {
return new AxiomResult(getAxiomHeader(), getAxiomFactory());
}
@Override
public SoapHeaderElement addHeaderElement(QName name) {
try {
OMNamespace namespace =
@@ -60,6 +62,7 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
}
}
@Override
public void removeHeaderElement(QName name) throws SoapHeaderException {
try {
OMElement element = getAxiomHeader().getFirstChildWithName(name);
@@ -72,6 +75,7 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
}
}
@Override
@SuppressWarnings("unchecked")
public Iterator<SoapHeaderElement> examineMustUnderstandHeaderElements(String role) {
try {
@@ -82,6 +86,7 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
}
}
@Override
@SuppressWarnings("unchecked")
public Iterator<SoapHeaderElement> examineAllHeaderElements() {
try {
@@ -92,6 +97,7 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
}
}
@Override
@SuppressWarnings("unchecked")
public Iterator<SoapHeaderElement> examineHeaderElements(QName name) throws SoapHeaderException {
try {
@@ -114,10 +120,12 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
this.axiomIterator = axiomIterator;
}
@Override
public boolean hasNext() {
return axiomIterator.hasNext();
}
@Override
public SoapHeaderElement next() {
try {
SOAPHeaderBlock axiomHeaderBlock = axiomIterator.next();
@@ -128,6 +136,7 @@ abstract class AxiomSoapHeader extends AxiomSoapElement implements SoapHeader {
}
}
@Override
public void remove() {
axiomIterator.remove();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2014 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.
@@ -31,22 +31,27 @@ class AxiomSoapHeaderElement extends AxiomSoapElement implements SoapHeaderEleme
super(axiomHeaderBlock, axiomFactory);
}
@Override
public String getActorOrRole() {
return getAxiomHeaderBlock().getRole();
}
@Override
public void setActorOrRole(String role) {
getAxiomHeaderBlock().setRole(role);
}
@Override
public boolean getMustUnderstand() {
return getAxiomHeaderBlock().getMustUnderstand();
}
@Override
public void setMustUnderstand(boolean mustUnderstand) {
getAxiomHeaderBlock().setMustUnderstand(mustUnderstand);
}
@Override
public Result getResult() {
try {
return new AxiomResult(getAxiomHeaderBlock(), getAxiomFactory());
@@ -57,10 +62,12 @@ class AxiomSoapHeaderElement extends AxiomSoapElement implements SoapHeaderEleme
}
@Override
public String getText() {
return getAxiomHeaderBlock().getText();
}
@Override
public void setText(String content) {
getAxiomHeaderBlock().setText(content);
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2012 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -172,11 +172,13 @@ public class AxiomSoapMessage extends AbstractSoapMessage implements StreamingWe
this.outputFormat = outputFormat;
}
@Override
public void setStreamingPayload(StreamingPayload payload) {
AxiomSoapBody soapBody = (AxiomSoapBody) getSoapBody();
soapBody.setStreamingPayload(payload);
}
@Override
public SoapEnvelope getEnvelope() {
if (envelope == null) {
try {
@@ -190,19 +192,23 @@ public class AxiomSoapMessage extends AbstractSoapMessage implements StreamingWe
return envelope;
}
@Override
public String getSoapAction() {
return soapAction;
}
@Override
public void setSoapAction(String soapAction) {
soapAction = SoapUtils.escapeAction(soapAction);
this.soapAction = soapAction;
}
@Override
public Document getDocument() {
return AxiomUtils.toDocument(axiomMessage.getSOAPEnvelope());
}
@Override
public void setDocument(Document document) {
// save the Soap Action
String soapAction = getSoapAction();
@@ -216,6 +222,7 @@ public class AxiomSoapMessage extends AbstractSoapMessage implements StreamingWe
setSoapAction(soapAction);
}
@Override
public boolean isXopPackage() {
try {
return MTOMConstants.MTOM_TYPE.equals(attachments.getAttachmentSpecType());
@@ -229,10 +236,12 @@ public class AxiomSoapMessage extends AbstractSoapMessage implements StreamingWe
}
}
@Override
public boolean convertToXopPackage() {
return false;
}
@Override
public Attachment getAttachment(String contentId) {
Assert.hasLength(contentId, "contentId must not be empty");
if (contentId.startsWith("<") && contentId.endsWith(">")) {
@@ -242,10 +251,12 @@ public class AxiomSoapMessage extends AbstractSoapMessage implements StreamingWe
return dataHandler != null ? new AxiomAttachment(contentId, dataHandler) : null;
}
@Override
public Iterator<Attachment> getAttachments() {
return new AxiomAttachmentIterator();
}
@Override
public Attachment addAttachment(String contentId, DataHandler dataHandler) {
Assert.hasLength(contentId, "contentId must not be empty");
Assert.notNull(dataHandler, "dataHandler must not be null");
@@ -253,6 +264,7 @@ public class AxiomSoapMessage extends AbstractSoapMessage implements StreamingWe
return new AxiomAttachment(contentId, dataHandler);
}
@Override
public void writeTo(OutputStream outputStream) throws IOException {
try {
@@ -380,16 +392,19 @@ public class AxiomSoapMessage extends AbstractSoapMessage implements StreamingWe
iterator = attachments.getContentIDSet().iterator();
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public Attachment next() {
String contentId = iterator.next();
DataHandler dataHandler = attachments.getDataHandler(contentId);
return new AxiomAttachment(contentId, dataHandler);
}
@Override
public void remove() {
iterator.remove();
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2012 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -25,19 +25,6 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor;
import org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping;
import org.springframework.ws.soap.SoapMessageFactory;
import org.springframework.ws.soap.SoapVersion;
import org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor;
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionEndpointMapping;
import org.springframework.ws.soap.support.SoapUtils;
import org.springframework.ws.transport.TransportConstants;
import org.springframework.ws.transport.TransportInputStream;
import org.apache.axiom.attachments.Attachments;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMException;
@@ -53,6 +40,19 @@ import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor;
import org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping;
import org.springframework.ws.soap.SoapMessageFactory;
import org.springframework.ws.soap.SoapVersion;
import org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor;
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionEndpointMapping;
import org.springframework.ws.soap.support.SoapUtils;
import org.springframework.ws.transport.TransportConstants;
import org.springframework.ws.transport.TransportInputStream;
/**
* Axiom-specific implementation of the {@link org.springframework.ws.WebServiceMessageFactory WebServiceMessageFactory}
* interface. Creates {@link org.springframework.ws.soap.axiom.AxiomSoapMessage AxiomSoapMessages}.
@@ -151,6 +151,7 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
this.attachmentCacheThreshold = attachmentCacheThreshold;
}
@Override
public void setSoapVersion(SoapVersion version) {
if (SoapVersion.SOAP_11 == version) {
soapFactory = OMAbstractFactory.getSOAP11Factory();
@@ -176,6 +177,7 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
}
@Override
public void afterPropertiesSet() throws Exception {
if (logger.isInfoEnabled()) {
logger.info(payloadCaching ? "Enabled payload caching" : "Disabled payload caching");
@@ -186,10 +188,12 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
}
}
@Override
public AxiomSoapMessage createWebServiceMessage() {
return new AxiomSoapMessage(soapFactory, payloadCaching, langAttributeOnSoap11FaultString);
}
@Override
public AxiomSoapMessage createWebServiceMessage(InputStream inputStream) throws IOException {
Assert.isInstanceOf(TransportInputStream.class, inputStream,
"AxiomSoapMessageFactory requires a TransportInputStream");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -24,8 +24,6 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.Result;
import org.springframework.util.xml.StaxUtils;
import org.apache.axiom.om.OMDataSource;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;
@@ -34,6 +32,8 @@ import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPFactory;
import org.springframework.util.xml.StaxUtils;
/**
* Non-caching payload in Axiom.
*
@@ -82,18 +82,22 @@ class NonCachingPayload extends AbstractPayload {
}
}
@Override
public void writeStartDocument() throws XMLStreamException {
// ignored
}
@Override
public void writeStartDocument(String version) throws XMLStreamException {
// ignored
}
@Override
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
this.encoding = encoding;
}
@Override
public void writeStartElement(String localName) throws XMLStreamException {
if (name == null) {
name = new QName(localName);
@@ -102,6 +106,7 @@ class NonCachingPayload extends AbstractPayload {
delegate.writeStartElement(localName);
}
@Override
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException {
if (name == null) {
name = new QName(namespaceURI, localName);
@@ -110,6 +115,7 @@ class NonCachingPayload extends AbstractPayload {
delegate.writeStartElement(namespaceURI, localName);
}
@Override
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
if (name == null) {
name = new QName(namespaceURI, localName, prefix);
@@ -118,6 +124,7 @@ class NonCachingPayload extends AbstractPayload {
delegate.writeStartElement(prefix, localName, namespaceURI);
}
@Override
public void writeEndElement() throws XMLStreamException {
elementDepth--;
delegate.writeEndElement();
@@ -140,6 +147,7 @@ class NonCachingPayload extends AbstractPayload {
}
}
@Override
public void writeEmptyElement(String localName) throws XMLStreamException {
if (name == null) {
name = new QName(localName);
@@ -148,6 +156,7 @@ class NonCachingPayload extends AbstractPayload {
addPayload();
}
@Override
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException {
if (name == null) {
name = new QName(namespaceURI, localName);
@@ -156,6 +165,7 @@ class NonCachingPayload extends AbstractPayload {
addPayload();
}
@Override
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
if (name == null) {
name = new QName(namespaceURI, localName, prefix);
@@ -164,6 +174,7 @@ class NonCachingPayload extends AbstractPayload {
addPayload();
}
@Override
public void writeEndDocument() throws XMLStreamException {
elementDepth = 0;
delegate.writeEndDocument();
@@ -172,88 +183,109 @@ class NonCachingPayload extends AbstractPayload {
// Delegation
@Override
public void close() throws XMLStreamException {
addPayload();
delegate.close();
}
@Override
public void flush() throws XMLStreamException {
delegate.flush();
}
@Override
public NamespaceContext getNamespaceContext() {
return delegate.getNamespaceContext();
}
@Override
public String getPrefix(String uri) throws XMLStreamException {
return delegate.getPrefix(uri);
}
@Override
public Object getProperty(String name) throws IllegalArgumentException {
return delegate.getProperty(name);
}
@Override
public void setDefaultNamespace(String uri) throws XMLStreamException {
delegate.setDefaultNamespace(uri);
}
@Override
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
delegate.setNamespaceContext(context);
}
@Override
public void setPrefix(String prefix, String uri) throws XMLStreamException {
delegate.setPrefix(prefix, uri);
}
@Override
public void writeAttribute(String localName, String value) throws XMLStreamException {
delegate.writeAttribute(localName, value);
}
@Override
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException {
delegate.writeAttribute(namespaceURI, localName, value);
}
@Override
public void writeAttribute(String prefix, String namespaceURI, String localName, String value)
throws XMLStreamException {
delegate.writeAttribute(prefix, namespaceURI, localName, value);
}
@Override
public void writeCData(String data) throws XMLStreamException {
delegate.writeCData(data);
}
@Override
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
delegate.writeCharacters(text, start, len);
}
@Override
public void writeCharacters(String text) throws XMLStreamException {
delegate.writeCharacters(text);
}
@Override
public void writeComment(String data) throws XMLStreamException {
delegate.writeComment(data);
}
@Override
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException {
delegate.writeDefaultNamespace(namespaceURI);
}
@Override
public void writeDTD(String dtd) throws XMLStreamException {
delegate.writeDTD(dtd);
}
@Override
public void writeEntityRef(String name) throws XMLStreamException {
delegate.writeEntityRef(name);
}
@Override
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException {
delegate.writeNamespace(prefix, namespaceURI);
}
@Override
public void writeProcessingInstruction(String target) throws XMLStreamException {
delegate.writeProcessingInstruction(target);
}
@Override
public void writeProcessingInstruction(String target, String data) throws XMLStreamException {
delegate.writeProcessingInstruction(target, data);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -24,14 +24,14 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.ws.stream.StreamingPayload;
import org.apache.axiom.om.OMDataSource;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.util.StAXUtils;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.ws.stream.StreamingPayload;
/**
* Implementation of {@link OMDataSource} that wraps a {@link StreamingPayload}.
*
@@ -47,6 +47,7 @@ class StreamingOMDataSource implements OMDataSource {
this.payload = payload;
}
@Override
public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
XMLStreamWriter streamWriter;
if (format != null && StringUtils.hasLength(format.getCharSetEncoding())) {
@@ -58,16 +59,19 @@ class StreamingOMDataSource implements OMDataSource {
serialize(streamWriter);
}
@Override
public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
XMLStreamWriter streamWriter = StAXUtils.createXMLStreamWriter(writer);
serialize(streamWriter);
}
@Override
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
payload.writeTo(xmlWriter);
xmlWriter.flush();
}
@Override
public XMLStreamReader getReader() throws XMLStreamException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
serialize(bos, null);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007 the original author or authors.
* Copyright 2005-2014 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.
@@ -52,6 +52,7 @@ public class SoapActionCallback implements WebServiceMessageCallback {
this.soapAction = soapAction;
}
@Override
public void doWithMessage(WebServiceMessage message) throws IOException {
Assert.isInstanceOf(SoapMessage.class, message);
SoapMessage soapMessage = (SoapMessage) message;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007 the original author or authors.
* Copyright 2005-2014 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.
@@ -32,6 +32,7 @@ import org.springframework.ws.soap.client.SoapFaultClientException;
*/
public class SoapFaultMessageResolver implements FaultMessageResolver {
@Override
public void resolveFault(WebServiceMessage message) throws IOException {
SoapMessage soapMessage = (SoapMessage) message;
throw new SoapFaultClientException(soapMessage);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2014 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.
@@ -41,14 +41,17 @@ class SaajAttachment implements Attachment {
this.saajAttachment = saajAttachment;
}
@Override
public String getContentId() {
return saajAttachment.getContentId();
}
@Override
public String getContentType() {
return saajAttachment.getContentType();
}
@Override
public InputStream getInputStream() throws IOException {
try {
return saajAttachment.getDataHandler().getInputStream();
@@ -58,6 +61,7 @@ class SaajAttachment implements Attachment {
}
}
@Override
public long getSize() {
try {
return saajAttachment.getSize();
@@ -67,6 +71,7 @@ class SaajAttachment implements Attachment {
}
}
@Override
public DataHandler getDataHandler() {
try {
return saajAttachment.getDataHandler();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -42,11 +42,13 @@ class SaajSoap11Body extends SaajSoapBody implements Soap11Body {
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
}
@Override
public Soap11Fault getFault() {
SOAPFault fault = getSaajBody().getFault();
return fault != null ? new SaajSoap11Fault(fault) : null;
}
@Override
public Soap11Fault addFault(QName faultCode, String faultString, Locale faultStringLocale) {
Assert.notNull(faultCode, "No faultCode given");
Assert.hasLength(faultString, "faultString cannot be empty");
@@ -73,18 +75,22 @@ class SaajSoap11Body extends SaajSoapBody implements Soap11Body {
}
}
@Override
public Soap11Fault addClientOrSenderFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_11.getClientOrSenderFaultName(), faultString, locale);
}
@Override
public Soap11Fault addMustUnderstandFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_11.getMustUnderstandFaultName(), faultString, locale);
}
@Override
public Soap11Fault addServerOrReceiverFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_11.getServerOrReceiverFaultName(), faultString, locale);
}
@Override
public Soap11Fault addVersionMismatchFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_11.getVersionMismatchFaultName(), faultString, locale);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2014 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.
@@ -34,10 +34,12 @@ class SaajSoap11Fault extends SaajSoapFault implements Soap11Fault {
super(fault);
}
@Override
public String getFaultActorOrRole() {
return getSaajFault().getFaultActor();
}
@Override
public void setFaultActorOrRole(String faultActor) {
try {
getSaajFault().setFaultActor(faultActor);
@@ -47,10 +49,12 @@ class SaajSoap11Fault extends SaajSoapFault implements Soap11Fault {
}
}
@Override
public String getFaultStringOrReason() {
return getSaajFault().getFaultString();
}
@Override
public Locale getFaultStringLocale() {
return getSaajFault().getFaultStringLocale();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -40,6 +40,7 @@ class SaajSoap11Header extends SaajSoapHeader implements Soap11Header {
super(header);
}
@Override
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] actors) {
List<SOAPHeaderElement> result = new ArrayList<SOAPHeaderElement>();
Iterator<SOAPHeaderElement> iterator = getSaajHeader().examineAllHeaderElements();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,27 +39,33 @@ class SaajSoap12Body extends SaajSoapBody implements Soap12Body {
super(body);
}
@Override
public Soap12Fault getFault() {
SOAPFault fault = getSaajBody().getFault();
return fault != null ? new SaajSoap12Fault(fault) : null;
}
@Override
public Soap12Fault addClientOrSenderFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_12.getClientOrSenderFaultName(), faultString, locale);
}
@Override
public Soap12Fault addMustUnderstandFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_12.getMustUnderstandFaultName(), faultString, locale);
}
@Override
public Soap12Fault addServerOrReceiverFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_12.getServerOrReceiverFaultName(), faultString, locale);
}
@Override
public Soap12Fault addVersionMismatchFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_12.getVersionMismatchFaultName(), faultString, locale);
}
@Override
public Soap12Fault addDataEncodingUnknownFault(QName[] subcodes, String reason, Locale locale) {
QName name = new QName(SoapVersion.SOAP_12.getEnvelopeNamespaceUri(), "DataEncodingUnknown");
Soap12Fault fault = addFault(name, reason, locale);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -34,10 +34,12 @@ class SaajSoap12Fault extends SaajSoapFault implements Soap12Fault {
super(fault);
}
@Override
public String getFaultActorOrRole() {
return getSaajFault().getFaultRole();
}
@Override
public void setFaultActorOrRole(String faultRole) {
try {
getSaajFault().setFaultRole(faultRole);
@@ -47,10 +49,12 @@ class SaajSoap12Fault extends SaajSoapFault implements Soap12Fault {
}
}
@Override
public Iterator<QName> getFaultSubcodes() {
return getSaajFault().getFaultSubcodes();
}
@Override
public void addFaultSubcode(QName subcode) {
try {
getSaajFault().appendFaultSubcode(subcode);
@@ -60,10 +64,12 @@ class SaajSoap12Fault extends SaajSoapFault implements Soap12Fault {
}
}
@Override
public String getFaultNode() {
return getSaajFault().getFaultNode();
}
@Override
public void setFaultNode(String uri) {
try {
getSaajFault().setFaultNode(uri);
@@ -74,6 +80,7 @@ class SaajSoap12Fault extends SaajSoapFault implements Soap12Fault {
}
@Override
public void setFaultReasonText(Locale locale, String text) {
try {
getSaajFault().addFaultReasonText(text, locale);
@@ -84,6 +91,7 @@ class SaajSoap12Fault extends SaajSoapFault implements Soap12Fault {
}
@Override
public String getFaultReasonText(Locale locale) {
try {
return getSaajFault().getFaultReasonText(locale);
@@ -93,6 +101,7 @@ class SaajSoap12Fault extends SaajSoapFault implements Soap12Fault {
}
}
@Override
public String getFaultStringOrReason() {
return getSaajFault().getFaultString();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -43,6 +43,7 @@ class SaajSoap12Header extends SaajSoapHeader implements Soap12Header {
super(header);
}
@Override
public SoapHeaderElement addNotUnderstoodHeaderElement(QName headerName) {
try {
SOAPHeaderElement headerElement =
@@ -54,6 +55,7 @@ class SaajSoap12Header extends SaajSoapHeader implements Soap12Header {
}
}
@Override
public SoapHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris) {
try {
SOAPHeaderElement headerElement =
@@ -65,6 +67,7 @@ class SaajSoap12Header extends SaajSoapHeader implements Soap12Header {
}
}
@Override
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] roles, boolean isUltimateDestination)
throws SoapHeaderException {
List<SOAPHeaderElement> result = new ArrayList<SOAPHeaderElement>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -46,6 +46,7 @@ class SaajSoapEnvelope extends SaajSoapElement<SOAPEnvelope> implements SoapEnve
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
}
@Override
public SoapBody getBody() {
if (body == null) {
try {
@@ -65,6 +66,7 @@ class SaajSoapEnvelope extends SaajSoapElement<SOAPEnvelope> implements SoapEnve
return body;
}
@Override
public SoapHeader getHeader() {
if (header == null) {
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -42,10 +42,12 @@ class SaajSoapFaultDetail extends SaajSoapElement<SOAPFaultElement> implements S
super(faultElement);
}
@Override
public Result getResult() {
return new DOMResult(getSaajDetail());
}
@Override
public SoapFaultDetailElement addFaultDetailElement(QName name) {
try {
DetailEntry detailEntry = getSaajDetail().addDetailEntry(name);
@@ -56,6 +58,7 @@ class SaajSoapFaultDetail extends SaajSoapElement<SOAPFaultElement> implements S
}
}
@Override
public Iterator<SoapFaultDetailElement> getDetailEntries() {
Iterator<DetailEntry> iterator = getSaajDetail().getDetailEntries();
return new SaajSoapFaultDetailElementIterator(iterator);
@@ -74,15 +77,18 @@ class SaajSoapFaultDetail extends SaajSoapElement<SOAPFaultElement> implements S
this.iterator = iterator;
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public SoapFaultDetailElement next() {
DetailEntry saajDetailEntry = iterator.next();
return new SaajSoapFaultDetailElement(saajDetailEntry);
}
@Override
public void remove() {
iterator.remove();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,10 +36,12 @@ class SaajSoapFaultDetailElement extends SaajSoapElement<DetailEntry> implements
super(entry);
}
@Override
public Result getResult() {
return new DOMResult(getSaajDetailEntry());
}
@Override
public void addText(String text) {
try {
getSaajDetailEntry().addTextNode(text);

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2012 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -108,6 +108,7 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
}
@Override
public void setSoapVersion(SoapVersion version) {
if (SaajUtils.getSaajVersion() >= SaajUtils.SAAJ_13) {
if (SoapVersion.SOAP_11 == version) {
@@ -126,6 +127,7 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
}
}
@Override
public void afterPropertiesSet() {
if (messageFactory == null) {
try {
@@ -166,6 +168,7 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
}
}
@Override
public SaajSoapMessage createWebServiceMessage() {
try {
SOAPMessage saajMessage = messageFactory.createMessage();
@@ -177,6 +180,7 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
}
}
@Override
public SaajSoapMessage createWebServiceMessage(InputStream inputStream) throws IOException {
MimeHeaders mimeHeaders = parseMimeHeaders(inputStream);
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -23,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.
@@ -65,6 +65,7 @@ public class SaajContentHandler implements ContentHandler {
this.element = element;
}
@Override
public void characters(char ch[], int start, int length) throws SAXException {
try {
String text = new String(ch, start, length);
@@ -75,6 +76,7 @@ public class SaajContentHandler implements ContentHandler {
}
}
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
try {
String childPrefix = getPrefix(qName);
@@ -120,35 +122,44 @@ public class SaajContentHandler implements ContentHandler {
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
Assert.isTrue(localName.equals(element.getElementName().getLocalName()), "Invalid element on stack");
Assert.isTrue(uri.equals(element.getElementName().getURI()), "Invalid element on stack");
element = element.getParentElement();
}
@Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
namespaces.put(prefix, uri);
}
@Override
public void endPrefixMapping(String prefix) throws SAXException {
namespaces.remove(prefix);
}
@Override
public void setDocumentLocator(Locator locator) {
}
@Override
public void startDocument() throws SAXException {
}
@Override
public void endDocument() throws SAXException {
}
@Override
public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
}
@Override
public void processingInstruction(String target, String data) throws SAXException {
}
@Override
public void skippedEntity(String name) throws SAXException {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,9 +22,6 @@ 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;
@@ -32,6 +29,9 @@ 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.
@@ -96,6 +96,7 @@ public class SaajXmlReader extends AbstractXmlReader {
* @param ignored is ignored
* @throws org.xml.sax.SAXException A SAX exception, possibly wrapping a <code>XMLStreamException</code>
*/
@Override
public final void parse(InputSource ignored) throws SAXException {
parse();
}
@@ -108,6 +109,7 @@ public class SaajXmlReader extends AbstractXmlReader {
* @param ignored is ignored
* @throws SAXException A SAX exception, possibly wrapping a <code>XMLStreamException</code>
*/
@Override
public final void parse(String ignored) throws SAXException {
parse();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -141,6 +141,7 @@ public abstract class AbstractFaultCreatingValidatingMarshallingPayloadEndpoint
this.faultStringOrReasonLocale = faultStringOrReasonLocale;
}
@Override
public final void setMessageSource(MessageSource messageSource) {
this.messageSource = messageSource;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -52,6 +52,7 @@ import org.springframework.xml.namespace.QNameUtils;
*/
public class SoapHeaderElementMethodArgumentResolver implements MethodArgumentResolver {
@Override
public boolean supportsParameter(MethodParameter parameter) {
SoapHeader soapHeader = parameter.getParameterAnnotation(SoapHeader.class);
if (soapHeader == null) {
@@ -79,6 +80,7 @@ public class SoapHeaderElementMethodArgumentResolver implements MethodArgumentRe
return false;
}
@Override
public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws Exception {
Assert.isInstanceOf(SoapMessage.class, messageContext.getRequest());
SoapMessage request = (SoapMessage) messageContext.getRequest();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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.
@@ -34,12 +34,14 @@ import org.springframework.ws.soap.SoapMessage;
*/
public class SoapMethodArgumentResolver implements MethodArgumentResolver {
@Override
public boolean supportsParameter(MethodParameter parameter) {
Class<?> parameterType = parameter.getParameterType();
return SoapMessage.class.equals(parameterType) || SoapBody.class.equals(parameterType) ||
SoapEnvelope.class.equals(parameterType) || SoapHeader.class.equals(parameterType);
}
@Override
public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) {
Assert.isInstanceOf(SoapMessage.class, messageContext.getRequest());
SoapMessage request = (SoapMessage) messageContext.getRequest();

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2011 the original author or authors.
* Copyright 2005-2014 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
* 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,
@@ -41,6 +41,7 @@ public class DelegatingSmartSoapEndpointInterceptor extends DelegatingSmartEndpo
super(delegate);
}
@Override
public boolean understands(SoapHeaderElement header) {
EndpointInterceptor delegate = getDelegate();
if (delegate instanceof SoapEndpointInterceptor) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2014 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,7 @@ public class SoapEnvelopeLoggingInterceptor extends AbstractLoggingInterceptor i
return true;
}
@Override
public boolean understands(SoapHeaderElement header) {
return false;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2014 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.
@@ -54,16 +54,19 @@ public class DelegatingSoapEndpointMapping implements InitializingBean, SoapEndp
this.delegate = delegate;
}
@Override
public final void setActorOrRole(String actorOrRole) {
Assert.notNull(actorOrRole, "actorOrRole must not be null");
actorsOrRoles = new String[]{actorOrRole};
}
@Override
public final void setActorsOrRoles(String[] actorsOrRoles) {
Assert.notEmpty(actorsOrRoles, "actorsOrRoles must not be empty");
this.actorsOrRoles = actorsOrRoles;
}
@Override
public final void setUltimateReceiver(boolean ultimateReceiver) {
isUltimateReceiver = ultimateReceiver;
}
@@ -74,6 +77,7 @@ public class DelegatingSoapEndpointMapping implements InitializingBean, SoapEndp
*
* @see #setActorsOrRoles(String[])
*/
@Override
public EndpointInvocationChain getEndpoint(MessageContext messageContext) throws Exception {
EndpointInvocationChain delegateChain = delegate.getEndpoint(messageContext);
if (delegateChain != null) {
@@ -85,6 +89,7 @@ public class DelegatingSoapEndpointMapping implements InitializingBean, SoapEndp
}
}
@Override
public void afterPropertiesSet() throws Exception {
Assert.notNull(delegate, "delegate is required");
}

Some files were not shown because too many files have changed in this diff Show More