// Inherited. @Override public void initModel(EnunciateFreemarkerModel model) { super.initModel(model); if (!isDisabled()) { EnunciateConfiguration config = model.getEnunciateConfig(); for (WsdlInfo wsdlInfo : model.getNamespacesToWSDLs().values()) { for (EndpointInterface ei : wsdlInfo.getEndpointInterfaces()) { String path = "/soap/" + ei.getServiceName(); if (config != null) { path = config.getDefaultSoapSubcontext() + '/' + ei.getServiceName(); if (config.getSoapServices2Paths().containsKey(ei.getServiceName())) { path = config.getSoapServices2Paths().get(ei.getServiceName()); } } ei.putMetaData("soapPath", path); } } if (!exporterFound) { warn( "The Enunciate XFire runtime wasn't found on the Enunciate classpath. This could be fatal to the runtime application."); } } }
@Override public void init(Enunciate enunciate) throws EnunciateException { super.init(enunciate); if (!isDisabled()) { if (!enunciate.isModuleEnabled("jaxws-support")) { throw new EnunciateException("The XFire module requires an enabled JAXWS Support module."); } } }
@Override protected void doBuild() throws EnunciateException, IOException { super.doBuild(); File webappDir = getBuildDir(); webappDir.mkdirs(); File webinf = new File(webappDir, "WEB-INF"); getEnunciate() .copyFile( new File(getGenerateDir(), "xfire-servlet.xml"), new File(webinf, "xfire-servlet.xml")); getEnunciate() .copyFile( new File(getGenerateDir(), "enunciate-soap-parameter-names.properties"), new File(new File(webinf, "classes"), "enunciate-soap-parameter-names.properties")); BaseWebAppFragment webappFragment = new BaseWebAppFragment(getName()); webappFragment.setBaseDir(webappDir); WebAppComponent servletComponent = new WebAppComponent(); servletComponent.setName("xfire"); servletComponent.setClassname(DispatcherServlet.class.getName()); TreeSet<String> urlMappings = new TreeSet<String>(); ArrayList<WebAppComponent> filters = new ArrayList<WebAppComponent>(); for (WsdlInfo wsdlInfo : getModel().getNamespacesToWSDLs().values()) { TreeSet<String> urlMappingsForNs = new TreeSet<String>(); for (EndpointInterface endpointInterface : wsdlInfo.getEndpointInterfaces()) { urlMappingsForNs.add(String.valueOf(endpointInterface.getMetaData().get("soapPath"))); } urlMappings.addAll(urlMappingsForNs); String redirectLocation = (String) wsdlInfo.getProperty("redirectLocation"); if (redirectLocation != null) { WebAppComponent wsdlFilter = new WebAppComponent(); wsdlFilter.setName("wsdl-redirect-filter-" + wsdlInfo.getId()); wsdlFilter.setClassname(WSDLRedirectFilter.class.getName()); wsdlFilter.addInitParam(WSDLRedirectFilter.WSDL_LOCATION_PARAM, redirectLocation); wsdlFilter.setUrlMappings(urlMappingsForNs); filters.add(wsdlFilter); } } servletComponent.setUrlMappings(urlMappings); webappFragment.setServlets(Arrays.asList(servletComponent)); webappFragment.setFilters(filters); getEnunciate().addWebAppFragment(webappFragment); }