gpt4 book ai didi

org.mortbay.xml.XmlConfiguration.configure()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 13:15:05 25 4
gpt4 key购买 nike

本文整理了Java中org.mortbay.xml.XmlConfiguration.configure()方法的一些代码示例,展示了XmlConfiguration.configure()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlConfiguration.configure()方法的具体详情如下:
包路径:org.mortbay.xml.XmlConfiguration
类名称:XmlConfiguration
方法名:configure

XmlConfiguration.configure介绍

[英]Configure an object. If the configuration has an ID, an object is looked up by ID and it's type check. Otherwise a new object is created.
[中]配置一个对象。如果配置有ID,则通过ID查找对象并进行类型检查。否则将创建一个新对象。

代码示例

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

private Object refObj(Object obj, XmlParser.Node node) throws Exception
{
  String id = node.getAttribute("id");
  obj = _idMap.get(id);
  if (obj == null) throw new IllegalStateException("No object for id=" + id);
  configure(obj, node, 0);
  return obj;
}

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

/**
 * Configure an object. If the object is of the approprate class, the XML configuration script
 * is applied to the object.
 *
 * @param obj The object to be configured.
 * @exception Exception
 */
public void configure(Object obj) throws Exception
{
  //Check the class of the object
  Class oClass = nodeClass(_config);
  if (!oClass.isInstance(obj))
      throw new IllegalArgumentException("Object is not of type " + oClass);
  configure(obj, _config, 0);
}

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

/**
 * Configure an object.  If the configuration has an ID, an object is looked up
 * by ID and it's type check.  Otherwise a new object is created.
 * 
 * @return The newly created configured object.
 * @exception Exception
 */
public Object configure() throws Exception
{
  Class oClass = nodeClass(_config);
  
  String id = _config.getAttribute("id");
  Object obj = id==null?null:_idMap.get(id);
  
  if (obj==null && oClass !=null)
    obj = oClass.newInstance();
  
  if (oClass!=null && !oClass.isInstance(obj))
    throw new ClassCastException(oClass.toString());
  
  configure(obj, _config, 0);
  return obj;
}

代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin

configuration.configure(server);
    configuration.configure(handler);
configuration.configure(handler);

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

private Object propertyObj(Object obj, XmlParser.Node node) throws Exception
{
  String id = node.getAttribute("id");
  String name = node.getAttribute("name");
  Object defval = node.getAttribute("default");
  Object prop=null;
  if (_propertyMap!=null && _propertyMap.containsKey(name))
  {
    prop=_propertyMap.get(name);
  }
  else if (defval != null)
    prop=defval;
  if (id != null) 
    _idMap.put(id, prop);
  if (prop!=null)
    configure(prop, node, 0);
  return prop;
}

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

/**
 * Create a WebAppContext for the webapp being hot deployed, then apply the
 * xml config file to it to configure it.
 * 
 * @param filename
 *            the config file found in the hot deploy directory
 * @return
 * @throws Exception
 */
private ContextHandler createContext(String filename) throws Exception
{
  // The config file can call any method on WebAppContext to configure
  // the webapp being deployed.
  File hotDeployXmlFile=new File(filename);
  if (!hotDeployXmlFile.exists())
    return null;
  XmlConfiguration xmlConfiguration=new XmlConfiguration(hotDeployXmlFile.toURL());
  HashMap properties = new HashMap();
  properties.put("Server", _contexts.getServer());
  if (_configMgr!=null)
    properties.putAll(_configMgr.getProperties());
      xmlConfiguration.setProperties(properties);
  ContextHandler context=(ContextHandler)xmlConfiguration.configure();
  return context;
}

代码示例来源:origin: feroult/yawp

protected WebAppContext createWebAppContext() {
  try {
    Resource jettyEnv = Resource.newResource(String.format("%s/WEB-INF/jetty-env.xml", mojo.getAppDir()));
    XmlConfiguration conf = new XmlConfiguration(jettyEnv.getInputStream());
    WebAppContext webapp = (WebAppContext) conf.configure();
    webapp.setWar(mojo.getAppDir());
    System.setProperty("java.naming.factory.url.pkgs", "org.mortbay.naming");
    System.setProperty("java.naming.factory.initial", "org.mortbay.naming.InitialContextFactory");
    return webapp;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

+ name.substring(1), (java.lang.Class[]) null);
obj = method.invoke(obj, (java.lang.Object[]) null);
configure(obj, node, 0);
  configure(obj, node, 0);

代码示例来源:origin: apache/chukwa

public void run() {
 server = new Server();
 XmlConfiguration configuration;
 try {
  configuration = new XmlConfiguration(serverConf);
  configuration.configure(server);
  server.start();
 } catch (Exception e) {
  log.error(ExceptionUtil.getStackTrace(e));
 }     
}

代码示例来源:origin: org.mortbay.jetty/jetty-embedded

configuration.configure(server);
ContextHandler context = (ContextHandler)configuration.configure();

代码示例来源:origin: org.sonatype.plexus/plexus-jetty6

new XmlConfiguration( tempJettyXml.toURL() ).configure( server );

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

configure(n, node, argi);
return n;

代码示例来源:origin: apache/chukwa

try {
 configuration = new XmlConfiguration(serverConf);
 configuration.configure(server);
 server.start();
 server.setStopAtShutdown(true);

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

if (properties.size()>0)
  configuration.setProperties(properties);
obj[i] = configuration.configure();
last=configuration;

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

configure(n, node, argi);
return n;

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

Log.debug("Configure: "+jetty);
XmlConfiguration jetty_config=new XmlConfiguration(jetty.getURL());
jetty_config.configure(getWebAppContext());

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com