Package org.eclipse.jetty.xml

Examples of org.eclipse.jetty.xml.XmlConfiguration


        _properties.put(key,value);
    }

    public void load() throws Exception
    {
        XmlConfiguration last = null;
        Object[] obj = new Object[this._xmlConfigurations.size()];

        // Configure everything
        for (int i = 0; i < this._xmlConfigurations.size(); i++)
        {
            URL configURL = this._xmlConfigurations.get(i);
            // System.err.println("configuring: "+configURL);
            XmlConfiguration configuration = new XmlConfiguration(configURL);
            if (last != null)
            {
                configuration.getIdMap().putAll(last.getIdMap());
            }
            configuration.getProperties().putAll(_properties);
            obj[i] = configuration.configure();
            last = configuration;
        }

        // Test for Server Instance.
        Server foundServer = null;
View Full Code Here


               
            Resource template_context_xml = template.getResource(OVERLAY_XML);
            if (template_context_xml.exists())
            {
                __log.debug("{}: overlay.xml={}",origin,template_context_xml);
                XmlConfiguration xmlc = newXmlConfiguration(template_context_xml.getURL(),idMap,template,instance);
                context=(ContextHandler)xmlc.configure();
                idMap=xmlc.getIdMap();
            }
            else if (webapp==null)
                // If there is no webapp, this is a plain context
                context=new ContextHandler();
            else
                // It is a webapp context
                context=new WebAppContext();

            // Set the resource base
            final Resource instance_webapp = instance.getResource(WEBAPP);
            if (instance_webapp.exists())
            {  
                context.setBaseResource(new ResourceCollection(instance_webapp,shared.getBaseResource()));

                // Create the resource cache
                ResourceCache cache = new ResourceCache(shared.getResourceCache(),instance_webapp,context.getMimeTypes(),false,false);
                context.setAttribute(ResourceCache.class.getCanonicalName(),cache);
            }
            else
            {
                context.setBaseResource(shared.getBaseResource());
                context.setAttribute(ResourceCache.class.getCanonicalName(),shared.getResourceCache());
            }
            __log.debug("{}: baseResource={}",origin,context.getResourceBase());
           
            // Set the shared session scavenger timer
            context.setAttribute("org.eclipse.jetty.server.session.timer", _sessionScavenger);
           
            // Apply any node or instance overlay.xml
            for (Resource context_xml : getLayeredResources(OVERLAY_XML,node,instance))
            {
                __log.debug("{}: overlay.xml={}",origin,context_xml);
                XmlConfiguration xmlc = newXmlConfiguration(context_xml.getURL(),idMap,template,instance);
                xmlc.getIdMap().put("Cache",context.getAttribute(ResourceCache.class.getCanonicalName()));
                xmlc.configure(context);
                idMap=xmlc.getIdMap();
            }

            // Is it a webapp?
            if (context instanceof WebAppContext)
            {
View Full Code Here

    }

    /* ------------------------------------------------------------ */
    private XmlConfiguration newXmlConfiguration(URL url, Map<String, Object> idMap, Template template, Instance instance) throws SAXException, IOException
    {
        XmlConfiguration xmlc = new XmlConfiguration(url);
        populateParameters(xmlc.getProperties(),template,instance);
        xmlc.getIdMap().putAll(idMap);
       
        return xmlc;
    }
View Full Code Here

        {
            if (PluginLog.getLog() != null)
                PluginLog.getLog().info( "Configuring Jetty from xml configuration file = " + xmlFile.getCanonicalPath() );  


            XmlConfiguration xmlConfiguration = new XmlConfiguration(Resource.toURL(xmlFile));

            //chain ids from one config file to another
            if (lastMap != null)
                xmlConfiguration.getIdMap().putAll(lastMap);

            //Set the system properties each time in case the config file set a new one
            Enumeration<?> ensysprop = System.getProperties().propertyNames();
            while (ensysprop.hasMoreElements())
            {
                String name = (String)ensysprop.nextElement();
                xmlConfiguration.getProperties().put(name,System.getProperty(name));
            }
            xmlConfiguration.configure();
            lastMap = xmlConfiguration.getIdMap();
        }
       
        return (Server)lastMap.get("Server");
    }
View Full Code Here

        //apply context xml file
        if (contextXml != null)
        {
            // System.err.println("Applying "+contextXml);
            XmlConfiguration xmlConfiguration = new XmlConfiguration(contextXml.getURL())
            xmlConfiguration.configure(webapp);  
        }
       
        server.setHandler(webapp);

        server.start();
View Full Code Here

        //apply context xml file
        if (contextXml != null)
        {
            // System.err.println("Applying "+contextXml);
            XmlConfiguration xmlConfiguration = new XmlConfiguration(contextXml.getURL())
            xmlConfiguration.configure(webapp);  
        }
       
        server.setHandler(webapp);

        server.start();
View Full Code Here

        //apply context xml file
        if (contextXml != null)
        {
            // System.err.println("Applying "+contextXml);
            XmlConfiguration xmlConfiguration = new XmlConfiguration(contextXml.getURL())
            xmlConfiguration.configure(webapp);  
        }
       
        server.setHandler(webapp);

        server.start();
View Full Code Here

        //apply context xml file
        if (contextXml != null)
        {
            // System.err.println("Applying "+contextXml);
            XmlConfiguration xmlConfiguration = new XmlConfiguration(contextXml.getURL())
            xmlConfiguration.configure(webapp);  
        }
       
        server.setHandler(webapp);

        server.start();
View Full Code Here

        //the pom to override the context xml file, but as the other mojos all
        //configure a WebAppContext in the pom (the <webApp> element), it is
        //already configured by the time the context xml file is applied.
        if (contextXml != null)
        {
            XmlConfiguration xmlConfiguration = new XmlConfiguration(Resource.toURL(contextXml));
            xmlConfiguration.getIdMap().put("Server",server);
            xmlConfiguration.configure(webApp);
        }

        ServerSupport.addWebApplication(server, webApp);

        if(stopPort>0 && stopKey!=null)
View Full Code Here

            {
              LOG.warn("File does not exist "+r);
              throw new IllegalStateException("No such jetty server config file: "+r);
            }

            XmlConfiguration config = new XmlConfiguration(r.getURL());

            config.getIdMap().putAll(id_map);
            config.getProperties().putAll(properties);

            // #334062 compute the URL of the folder that contains the
            // conf file and set it as a property so we can compute relative paths
            // from it.
            String urlPath = jettyConfiguration.toString();
            int lastSlash = urlPath.lastIndexOf('/');
            if (lastSlash > 4)
            {
              urlPath = urlPath.substring(0, lastSlash);
              config.getProperties().put(PROPERTY_THIS_JETTY_XML_FOLDER_URL, urlPath);
            }

            Object o = config.configure();
            if (server == null)
              server = (Server)o;

            id_map = config.getIdMap();
          }
          catch (Exception e)
          {
            LOG.warn("Configuration error in " + jettyConfiguration);
            throw e;
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.xml.XmlConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.