xfire源代码里,获取位置是
private String getConfigPath() { if (configPath == null || configPath.length() == 0) return "META-INF/xfire/services.xml"; else return configPath; }
但是提供指定配置位置,源代码里获取位置是
public XFire createXFire() throws ServletException { configPath = getInitParameter("config"); XFire xfire; try { xfire = loadConfig(getConfigPath()); } catch (XFireException e) { throw new ServletException(e); } if (xfire == null || xfire.getServiceRegistry() == null || xfire.getServiceRegistry().getServices() == null || xfire.getServiceRegistry().getServices().size() == 0) xfire = super.createXFire(); return xfire; }
所以可以在web.xml里配置config参数进行配置路径
<servlet> <servlet-name>XFireServlet</servlet-name> <servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>services.xml</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>XFireServlet</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping>
原文:http://yjm199.blog.51cto.com/4408395/1707314