Skip to content

Commit 5f79616

Browse files
committed
SWS-797 - XsdSchemaHandlerAdapter does not transform schema locations
1 parent d7ed005 commit 5f79616

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2005-2011 the original author or authors.
2+
* Copyright 2005-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@
2323
import org.springframework.beans.factory.BeanFactoryUtils;
2424
import org.springframework.beans.factory.BeanInitializationException;
2525
import org.springframework.beans.factory.BeanNameAware;
26-
import org.springframework.beans.factory.InitializingBean;
2726
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
2827
import org.springframework.context.ApplicationContext;
2928
import org.springframework.web.servlet.DispatcherServlet;
@@ -119,6 +118,8 @@ public class MessageDispatcherServlet extends FrameworkServlet {
119118

120119
private boolean transformWsdlLocations = false;
121120

121+
private boolean transformSchemaLocations = false;
122+
122123
/** Public constructor, necessary for some Web application servers. */
123124
public MessageDispatcherServlet() {
124125
defaultStrategiesHelper = new DefaultStrategiesHelper(MessageDispatcherServlet.class);
@@ -158,6 +159,30 @@ public boolean isTransformWsdlLocations() {
158159
return transformWsdlLocations;
159160
}
160161

162+
/**
163+
* Sets whether relative address locations in the WSDL are to be transformed using the request URI of the incoming
164+
* {@link HttpServletRequest}. Defaults to <code>false</code>.
165+
*/
166+
public void setTransformWsdlLocations(boolean transformWsdlLocations) {
167+
this.transformWsdlLocations = transformWsdlLocations;
168+
}
169+
170+
/**
171+
* Indicates whether relative address locations in the XSD are to be transformed using the request URI of the
172+
* incoming {@link HttpServletRequest}.
173+
*/
174+
public boolean isTransformSchemaLocations() {
175+
return transformSchemaLocations;
176+
}
177+
178+
/**
179+
* Sets whether relative address locations in the XSD are to be transformed using the request URI of the incoming
180+
* {@link HttpServletRequest}. Defaults to <code>false</code>.
181+
*/
182+
public void setTransformSchemaLocations(boolean transformSchemaLocations) {
183+
this.transformSchemaLocations = transformSchemaLocations;
184+
}
185+
161186
/** Returns the bean name used to lookup a {@link WebServiceMessageReceiverHandlerAdapter}. */
162187
public String getMessageReceiverHandlerAdapterBeanName() {
163188
return messageReceiverHandlerAdapterBeanName;
@@ -197,13 +222,6 @@ public void setXsdSchemaHandlerAdapterBeanName(String xsdSchemaHandlerAdapterBea
197222
this.xsdSchemaHandlerAdapterBeanName = xsdSchemaHandlerAdapterBeanName;
198223
}
199224

200-
/**
201-
* Sets whether relative address locations in the WSDL are to be transformed using the request URI of the incoming
202-
* {@link HttpServletRequest}. Defaults to <code>false</code>.
203-
*/
204-
public void setTransformWsdlLocations(boolean transformWsdlLocations) {
205-
this.transformWsdlLocations = transformWsdlLocations;
206-
}
207225

208226
@Override
209227
protected void doService(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
@@ -363,9 +381,8 @@ private void initXsdSchemaHandlerAdapter(ApplicationContext context) {
363381
catch (NoSuchBeanDefinitionException ignored) {
364382
xsdSchemaHandlerAdapter = new XsdSchemaHandlerAdapter();
365383
}
366-
if (xsdSchemaHandlerAdapter instanceof InitializingBean) {
367-
((InitializingBean) xsdSchemaHandlerAdapter).afterPropertiesSet();
368-
}
384+
xsdSchemaHandlerAdapter.setTransformSchemaLocations(isTransformSchemaLocations());
385+
xsdSchemaHandlerAdapter.afterPropertiesSet();
369386
}
370387
catch (Exception ex) {
371388
throw new BeanInitializationException("Could not initialize XsdSchemaHandlerAdapter", ex);

0 commit comments

Comments
 (0)