|
1 | 1 | /* |
2 | | - * Copyright 2005-2011 the original author or authors. |
| 2 | + * Copyright 2005-2012 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
23 | 23 | import org.springframework.beans.factory.BeanFactoryUtils; |
24 | 24 | import org.springframework.beans.factory.BeanInitializationException; |
25 | 25 | import org.springframework.beans.factory.BeanNameAware; |
26 | | -import org.springframework.beans.factory.InitializingBean; |
27 | 26 | import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
28 | 27 | import org.springframework.context.ApplicationContext; |
29 | 28 | import org.springframework.web.servlet.DispatcherServlet; |
@@ -119,6 +118,8 @@ public class MessageDispatcherServlet extends FrameworkServlet { |
119 | 118 |
|
120 | 119 | private boolean transformWsdlLocations = false; |
121 | 120 |
|
| 121 | + private boolean transformSchemaLocations = false; |
| 122 | + |
122 | 123 | /** Public constructor, necessary for some Web application servers. */ |
123 | 124 | public MessageDispatcherServlet() { |
124 | 125 | defaultStrategiesHelper = new DefaultStrategiesHelper(MessageDispatcherServlet.class); |
@@ -158,6 +159,30 @@ public boolean isTransformWsdlLocations() { |
158 | 159 | return transformWsdlLocations; |
159 | 160 | } |
160 | 161 |
|
| 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 | + |
161 | 186 | /** Returns the bean name used to lookup a {@link WebServiceMessageReceiverHandlerAdapter}. */ |
162 | 187 | public String getMessageReceiverHandlerAdapterBeanName() { |
163 | 188 | return messageReceiverHandlerAdapterBeanName; |
@@ -197,13 +222,6 @@ public void setXsdSchemaHandlerAdapterBeanName(String xsdSchemaHandlerAdapterBea |
197 | 222 | this.xsdSchemaHandlerAdapterBeanName = xsdSchemaHandlerAdapterBeanName; |
198 | 223 | } |
199 | 224 |
|
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 | | - } |
207 | 225 |
|
208 | 226 | @Override |
209 | 227 | protected void doService(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) |
@@ -363,9 +381,8 @@ private void initXsdSchemaHandlerAdapter(ApplicationContext context) { |
363 | 381 | catch (NoSuchBeanDefinitionException ignored) { |
364 | 382 | xsdSchemaHandlerAdapter = new XsdSchemaHandlerAdapter(); |
365 | 383 | } |
366 | | - if (xsdSchemaHandlerAdapter instanceof InitializingBean) { |
367 | | - ((InitializingBean) xsdSchemaHandlerAdapter).afterPropertiesSet(); |
368 | | - } |
| 384 | + xsdSchemaHandlerAdapter.setTransformSchemaLocations(isTransformSchemaLocations()); |
| 385 | + xsdSchemaHandlerAdapter.afterPropertiesSet(); |
369 | 386 | } |
370 | 387 | catch (Exception ex) { |
371 | 388 | throw new BeanInitializationException("Could not initialize XsdSchemaHandlerAdapter", ex); |
|
0 commit comments