Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 18th, 2010 | Syntax: Java | Size: 1.29 KB | Hits: 58 | Expires: Never
Copy text to clipboard
  1.     private void loadAdditionalConfig(ApplicationContext ctx,
  2.                                         ServletConfig servletConfig) {
  3.         String location = servletConfig.getInitParameter("config-location");
  4.         if (location == null) {
  5.             location = "/WEB-INF/cxf-servlet.xml";
  6.         }
  7.         InputStream is = null;
  8.         try {
  9.             is = servletConfig.getServletContext().getResourceAsStream(location);
  10.            
  11.             if (is == null || is.available() == -1) {
  12.                 URIResolver resolver = new URIResolver(location);
  13.  
  14.                 if (resolver.isResolved()) {
  15.                     is = resolver.getInputStream();
  16.                 }
  17.             }
  18.         } catch (IOException e) {
  19.             //throw new ServletException(e);
  20.         }
  21.        
  22.         if (is != null) {
  23.             LOG.log(Level.INFO, "BUILD_ENDPOINTS_FROM_CONFIG_LOCATION", new Object[]{location});
  24.             childCtx = new GenericApplicationContext(ctx);
  25.            
  26.             XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(childCtx);
  27.             reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
  28.             reader.loadBeanDefinitions(new InputStreamResource(is, location));
  29.            
  30.             childCtx.refresh();
  31.         }
  32.     }