Improved publication information of WsdlDefinition beans.
This commit is contained in:
@@ -18,6 +18,7 @@ package org.springframework.ws.transport.http;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -113,6 +114,9 @@ public class MessageDispatcherServlet extends FrameworkServlet {
|
||||
|
||||
private boolean transformWsdlLocations = false;
|
||||
|
||||
/** Indicates whether {@link ServletContext#getContextPath()} exists. This method was introduced in Servlet 2.5. */
|
||||
private boolean servletContextHasGetContextPath;
|
||||
|
||||
/** Public constructor, necessary for some Web application servers. */
|
||||
public MessageDispatcherServlet() {
|
||||
defaultStrategiesHelper = new DefaultStrategiesHelper(
|
||||
@@ -199,6 +203,8 @@ public class MessageDispatcherServlet extends FrameworkServlet {
|
||||
}
|
||||
|
||||
protected void initFrameworkServlet() throws ServletException, BeansException {
|
||||
servletContextHasGetContextPath =
|
||||
getServletContext().getMajorVersion() == 2 && getServletContext().getMinorVersion() >= 5;
|
||||
initMessageReceiverHandlerAdapter();
|
||||
initWsdlDefinitionHandlerAdapter();
|
||||
initMessageReceiver();
|
||||
@@ -313,13 +319,30 @@ public class MessageDispatcherServlet extends FrameworkServlet {
|
||||
private void initWsdlDefinitions() {
|
||||
wsdlDefinitions = BeanFactoryUtils
|
||||
.beansOfTypeIncludingAncestors(getWebApplicationContext(), WsdlDefinition.class, true, false);
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
for (Iterator iterator = wsdlDefinitions.entrySet().iterator(); iterator.hasNext();) {
|
||||
Map.Entry entry = (Map.Entry) iterator.next();
|
||||
String beanName = (String) entry.getKey();
|
||||
WsdlDefinition definition = (WsdlDefinition) entry.getValue();
|
||||
logger.debug("Published [" + definition + "] as " + beanName + WSDL_SUFFIX_NAME);
|
||||
StringBuffer message = new StringBuffer("Published [");
|
||||
message.append(definition);
|
||||
message.append("] as ");
|
||||
if (servletContextHasGetContextPath) {
|
||||
message.append(Servlet25ContextPathRetriever.getContextPath(getServletContext()));
|
||||
message.append('/');
|
||||
}
|
||||
message.append(beanName);
|
||||
message.append(WSDL_SUFFIX_NAME);
|
||||
logger.info(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Inner class to remove Servlet 2.5 dependency. */
|
||||
private static class Servlet25ContextPathRetriever {
|
||||
|
||||
private static String getContextPath(ServletContext servletContext) {
|
||||
return servletContext.getContextPath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
Reference in New Issue
Block a user