axis spring 集成(2)
2008-02-23 09:35:33来源:互联网 阅读 ()
package com.skysuite.axis.spring;
import org.apache.axis.deployment.wsdd.WSDDConstants;
import Javax.XML.namespace.QName;
public class SpringAxisConstans {
public static final String PROVIDER_SPRINGRPC = "SPRINGRPC";
public static final String PROVIDER_SPRINGMSG = "SPRINGMSG";
public static final QName QNAME_JAVARPC_SPRINGPROVIDER = new QName(WSDDConstants.URI_WSDD_JAVA, PROVIDER_SPRINGRPC);
public static final QName QNAME_JAVAMSG_SPRINGPROVIDER = new QName(WSDDConstants.URI_WSDD_JAVA, PROVIDER_SPRINGMSG);
}
2.AxisServlet
package com.skysuite.axis.spring;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.apache.axis.transport.http.AxisServlet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springFramework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.util.StringUtils;
import org.springframework.Web.context.ConfigurableWebApplicationContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.context.support.XmlWebApplicationContext;
public class SpringAxisServlet extends AxisServlet {
private static final Log LOG = LogFactory.getLog(SpringAxisServlet.class);
/**
* Suffix for WebApplicationContext namespaces. If a SpringAxisServlet is
* given the name "axis" in a context, the namespace used by this instance will
* resolve to "axis-servlet".
*/
public static final String DEFAULT_NAMESPACE_SUFFIX = "-servlet";
/**
* Default context class for SpringAxisServlet.
*
* @see org.springframework.web.context.support.XmlWebApplicationContext
*/
public static final Class DEFAULT_CONTEXT_CLASS = XmlWebApplicationContext.class;
/** Name of the ServletContext attribute for the WebApplicationContext */
public static final String SERVLET_CONTEXT_ATTRIBUTE = SpringAxisServlet.class.getName()
".CONTEXT";
/** Custom WebApplicationContext class */
private Class contextClass = DEFAULT_CONTEXT_CLASS;
/** Namespace for this servlet */
private String namespace;
/** Explicit context config location */
private String contextConfigLocation;
/** WebApplicationContext for the SpringAxisServlet */
private WebApplicationContext webApplicationContext;
/**
* Initialise the WebApplicationContext of the SpringAxisServlet.
*
* @see org.apache.axis.transport.http.AxisServlet#init()
*/
public void init() throws ServletException {
super.init();
long startTime = System.currentTimeMillis();
if (LOG.isDebugEnabled()) {
LOG.debug("Servlet '" getServletName() "' init");
}
setContextClassName(getServletConfig().getInitParameter("contextClassName"));
setContextConfigLocation(getServletConfig().getInitParameter("contextConfigLocation"));
setNamespace(getServletConfig().getInitParameter("namespace"));
try {
this.webApplicationContext = initWebApplicationContext();
} catch (BeansException ex) {
LOG.error("Context initialization failed", ex);
throw ex;
}
if (LOG.isDebugEnabled()) {
long elapsedTime = System.currentTimeMillis() - startTime;
LOG.debug("Servlet '"
this.getServletName()
"' init completed in "
elapsedTime
" ms");
}
}
/**
* Close the WebApplicationContext of the SpringAxisServlet.
*
* @see org.apache.axis.transport.http.AxisServletBase#destroy()
*/
public void destroy() {
super.destroy();
log("Closing WebApplicationContext of servlet '" getServletName() "'");
if (this.webApplicationContext instanceof ConfigurableApplicationContext) {
((ConfigurableApplicationContext) this.webApplicationContext).close();
}
}
/**
* Set a custom context class by name. This class must be of type WebApplicationContext,
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash