当前位置: 首页>>代码示例>>Java>>正文


Java ProxyDirContext类代码示例

本文整理汇总了Java中org.apache.naming.resources.ProxyDirContext的典型用法代码示例。如果您正苦于以下问题:Java ProxyDirContext类的具体用法?Java ProxyDirContext怎么用?Java ProxyDirContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProxyDirContext类属于org.apache.naming.resources包,在下文中一共展示了ProxyDirContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setResources

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Set the resources DirContext object with which this Container is
 * associated.
 *
 * @param resources The newly associated DirContext
 */
@Override
public synchronized void setResources(DirContext resources) {
    // Called from StandardContext.setResources()
    //              <- StandardContext.start() 
    //              <- ContainerBase.addChildInternal() 

    // Change components if necessary
    DirContext oldResources = this.resources;
    if (oldResources == resources)
        return;
    Hashtable<String, String> env = new Hashtable<String, String>();
    if (getParent() != null)
        env.put(ProxyDirContext.HOST, getParent().getName());
    env.put(ProxyDirContext.CONTEXT, getName());
    this.resources = new ProxyDirContext(env, resources);
    // Report this property change to interested listeners
    support.firePropertyChange("resources", oldResources, this.resources);

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:26,代码来源:ContainerBase.java

示例2: setResources

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Set the resources DirContext object with which this Container is
 * associated.
 *
 * @param resources The newly associated DirContext
 */
public synchronized void setResources(DirContext resources) {
    // Called from StandardContext.setResources()
    //              <- StandardContext.start() 
    //              <- ContainerBase.addChildInternal() 

    // Change components if necessary
    DirContext oldResources = this.resources;
    if (oldResources == resources)
        return;
    Hashtable env = new Hashtable();
    if (getParent() != null)
        env.put(ProxyDirContext.HOST, getParent().getName());
    env.put(ProxyDirContext.CONTEXT, getName());
    this.resources = new ProxyDirContext(env, resources);
    // Report this property change to interested listeners
    support.firePropertyChange("resources", oldResources, this.resources);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:ContainerBase.java

示例3: resolveResource

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
public boolean resolveResource(int type, String name) {
    ProxyDirContext resources = (ProxyDirContext) request.getContext().getResources();
    CacheEntry cacheEntry = resources.lookupCache(name);
    if (!cacheEntry.exists) {
        return false;
    } else {
        switch (type) {
        case 0:
            return (cacheEntry.resource == null);
        case 1:
            return (cacheEntry.resource != null);
        case 2:
            return (cacheEntry.resource != null 
                    && cacheEntry.attributes.getContentLength() > 0);
        default:
            return false;
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:TomcatResolver.java

示例4: setResources

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Set the resources DirContext object with which this Container is
 * associated.
 *
 * @param resources The newly associated DirContext
 */
public synchronized void setResources(DirContext resources) {

    // Change components if necessary
    DirContext oldResources = this.resources;
    if (oldResources == resources)
        return;
    Hashtable env = new Hashtable();
    if (getParent() != null)
        env.put(ProxyDirContext.HOST, getParent().getName());
    env.put(ProxyDirContext.CONTEXT, getName());
    this.resources = new ProxyDirContext(env, resources);
    // Report this property change to interested listeners
    support.firePropertyChange("resources", oldResources, this.resources);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:22,代码来源:ContainerBase.java

示例5: setResources

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Set the resources DirContext object with which this Container is
 * associated.
 *
 * @param resources
 *            The newly associated DirContext
 */
@Override
public synchronized void setResources(DirContext resources) {
	// Called from StandardContext.setResources()
	// <- StandardContext.start()
	// <- ContainerBase.addChildInternal()

	// Change components if necessary
	DirContext oldResources = this.resources;
	if (oldResources == resources)
		return;
	Hashtable<String, String> env = new Hashtable<String, String>();
	if (getParent() != null)
		env.put(ProxyDirContext.HOST, getParent().getName());
	env.put(ProxyDirContext.CONTEXT, getName());
	this.resources = new ProxyDirContext(env, resources);
	// Report this property change to interested listeners
	support.firePropertyChange("resources", oldResources, this.resources);

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:27,代码来源:ContainerBase.java

示例6: setResources

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Set associated resources.
 */
public void setResources(DirContext resources) {

    this.resources = resources;

    if (resources instanceof ProxyDirContext) {
        contextName = ((ProxyDirContext) resources).getContextName();
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:12,代码来源:WebappClassLoaderBase.java

示例7: testResourceCaching

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
@Test
public void testResourceCaching() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0-fragments");
    // app dir is relative to server home
    StandardContext ctx = (StandardContext) tomcat.addWebapp(
            null, "/test", appDir.getAbsolutePath());
    ctx.setCachingAllowed(false);

    tomcat.start();

    DirContext resources = ctx.getResources();

    Assert.assertTrue(resources instanceof ProxyDirContext);

    ProxyDirContext proxyResources = (ProxyDirContext) resources;

    // Caching should be disabled
    Assert.assertNull(proxyResources.getCache());

    ctx.stop();
    ctx.start();

    // Caching should still be disabled
    Assert.assertNull(proxyResources.getCache());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:TestStandardContextResources.java

示例8: setResources

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Set associated resources.
 */
public void setResources(DirContext resources) {

	this.resources = resources;

	if (resources instanceof ProxyDirContext) {
		contextName = ((ProxyDirContext) resources).getContextName();
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:12,代码来源:WebappClassLoaderBase.java

示例9: init

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
@Override
public void init() throws ServletException {
    super.init();

    File contentDir = RunUtil.getContentDir();

    try {
        FileDirContext fdc = new PermissionsDirContext(contentDir);
        resources = new ProxyDirContext(new Hashtable(), fdc);

        /*{
            // workaround for issue where cache entries have null
            // attributes when permissions checks fail
            @Override
            public CacheEntry lookupCache(String name) {
                CacheEntry ce = super.lookupCache(name);
                if (ce != null && ce.attributes == null) {
                    ce.attributes = new ResourceAttributes();
                    ce.exists = false;
                }
                return ce;
            }

        };*/
    } catch (Exception ex) {
        throw new ServletException("Unable to initialize webdav servlet",
                                   ex);
    }
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:30,代码来源:WonderlandWebdavServlet.java

示例10: resourcesStart

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Allocate resources, including proxy.
 * Return <code>true</code> if initialization was successfull,
 * or <code>false</code> otherwise.
 */
public boolean resourcesStart() {

    boolean ok = true;

    Hashtable<String, String> env = new Hashtable<String, String>();
    if (getParent() != null)
        env.put(ProxyDirContext.HOST, getParent().getName());
    env.put(ProxyDirContext.CONTEXT, getName());

    try {
        ProxyDirContext proxyDirContext =
            new ProxyDirContext(env, webappResources);
        if (webappResources instanceof FileDirContext) {
            filesystemBased = true;
            ((FileDirContext) webappResources).setAllowLinking
                (isAllowLinking());
        }
        if (webappResources instanceof BaseDirContext) {
            ((BaseDirContext) webappResources).setDocBase(getBasePath());
            ((BaseDirContext) webappResources).setCached
                (isCachingAllowed());
            ((BaseDirContext) webappResources).setCacheTTL(getCacheTTL());
            ((BaseDirContext) webappResources).setCacheMaxSize
                (getCacheMaxSize());
            ((BaseDirContext) webappResources).allocate();
            // Alias support
            ((BaseDirContext) webappResources).setAliases(getAliases());
            
            if (effectiveMajorVersion >=3 && addWebinfClassesResources) {
                try {
                    DirContext webInfCtx =
                        (DirContext) webappResources.lookup(
                                "/WEB-INF/classes");
                    // Do the lookup to make sure it exists
                    webInfCtx.lookup("META-INF/resources");
                    ((BaseDirContext) webappResources).addAltDirContext(
                            webInfCtx);
                } catch (NamingException e) {
                    // Doesn't exist - ignore and carry on
                }
            }
        }
        // Register the cache in JMX
        if (isCachingAllowed() && proxyDirContext.getCache() != null) {
            String contextName = getName();
            if (!contextName.startsWith("/")) {
                contextName = "/" + contextName;
            }
            ObjectName resourcesName = 
                new ObjectName(this.getDomain() + ":type=Cache,host=" 
                               + getHostname() + ",context=" + contextName);
            Registry.getRegistry(null, null).registerComponent
                (proxyDirContext.getCache(), resourcesName, null);
        }
        this.resources = proxyDirContext;
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log.error(sm.getString("standardContext.resourcesStart"), t);
        ok = false;
    }

    return (ok);

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:70,代码来源:StandardContext.java

示例11: resourcesStart

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Allocate resources, including proxy.
 * Return <code>true</code> if initialization was successfull,
 * or <code>false</code> otherwise.
 */
public boolean resourcesStart() {

    boolean ok = true;

    Hashtable env = new Hashtable();
    if (getParent() != null)
        env.put(ProxyDirContext.HOST, getParent().getName());
    env.put(ProxyDirContext.CONTEXT, getName());

    try {
        ProxyDirContext proxyDirContext =
            new ProxyDirContext(env, webappResources);
        if (webappResources instanceof FileDirContext) {
            filesystemBased = true;
            ((FileDirContext) webappResources).setCaseSensitive
                (isCaseSensitive());
            ((FileDirContext) webappResources).setAllowLinking
                (isAllowLinking());
        }
        if (webappResources instanceof BaseDirContext) {
            ((BaseDirContext) webappResources).setDocBase(getBasePath());
            ((BaseDirContext) webappResources).setCached
                (isCachingAllowed());
            ((BaseDirContext) webappResources).setCacheTTL(getCacheTTL());
            ((BaseDirContext) webappResources).setCacheMaxSize
                (getCacheMaxSize());
            ((BaseDirContext) webappResources).allocate();
        }
        // Register the cache in JMX
        if (isCachingAllowed()) {
            ObjectName resourcesName = 
                new ObjectName(this.getDomain() + ":type=Cache,host=" 
                               + getHostname() + ",path=" 
                               + (("".equals(getPath()))?"/":getPath()));
            Registry.getRegistry(null, null).registerComponent
                (proxyDirContext.getCache(), resourcesName, null);
        }
        this.resources = proxyDirContext;
    } catch (Throwable t) {
        log.error(sm.getString("standardContext.resourcesStart"), t);
        ok = false;
    }

    return (ok);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:52,代码来源:StandardContext.java

示例12: reload

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Reload the web application at the specified context path.
 *
 * @param writer Writer to render to
 * @param path Context path of the application to be restarted
 */
protected void reload(PrintWriter writer, String path) {

    if (debug >= 1)
        log("restart: Reloading web application at '" + path + "'");

    if ((path == null) || (!path.startsWith("/") && path.equals(""))) {
        writer.println(sm.getString("managerServlet.invalidPath", path));
        return;
    }
    String displayPath = path;
    if( path.equals("/") )
        path = "";

    try {
        Context context = deployer.findDeployedApp(path);
        if (context == null) {
            writer.println(sm.getString("managerServlet.noContext", displayPath));
        return;
        }
        DirContext resources = context.getResources();
        if (resources instanceof ProxyDirContext) {
            resources = ((ProxyDirContext) resources).getDirContext();
        }
        if (resources instanceof WARDirContext) {
            writer.println(sm.getString("managerServlet.noReload", displayPath));
            return;
        }
        // It isn't possible for the manager to reload itself
        if (context.getPath().equals(this.context.getPath())) {
            writer.println(sm.getString("managerServlet.noSelf"));
            return;
        }
        context.reload();
        writer.println(sm.getString("managerServlet.reloaded", displayPath));
    } catch (Throwable t) {
        log("ManagerServlet.reload[" + displayPath + "]", t);
        writer.println(sm.getString("managerServlet.exception",
                                    t.toString()));
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:48,代码来源:ManagerServlet.java

示例13: reload

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Reload the web application at the specified context path.
 *
 * @param writer Writer to render to
 * @param path   Context path of the application to be restarted
 */
protected void reload(final PrintWriter writer, String path) {

  if (debug >= 1) {
    log("restart: Reloading web application at '" + path + '\'');
  }

  if (path == null || !path.startsWith("/") && path.length() == 0) {
    writer.println(sm.getString("managerServlet.invalidPath", path));
    return;
  }
  final String displayPath = path;
  if (path.equals("/")) {
    path = "";
  }

  try {
    final Context context = deployer.findDeployedApp(path);
    if (context == null) {
      writer.println(sm.getString("managerServlet.noContext", displayPath));
      return;
    }
    DirContext resources = context.getResources();
    if (resources instanceof ProxyDirContext) {
      resources = ((ProxyDirContext) resources).getDirContext();
    }
    if (resources instanceof WARDirContext) {
      writer.println(sm.getString("managerServlet.noReload", displayPath));
      return;
    }
    // It isn't possible for the manager to reload itself
    if (context.getPath().equals(this.context.getPath())) {
      writer.println(sm.getString("managerServlet.noSelf"));
      return;
    }
    context.reload();
    writer.println(sm.getString("managerServlet.reloaded", displayPath));
  } catch (Throwable t) {
    log("ManagerServlet.reload[" + displayPath + ']', t);
    writer.println(sm.getString("managerServlet.exception",
            t.toString()));
  }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:50,代码来源:ManagerServlet.java

示例14: resourcesStart

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Allocate resources, including proxy. Return <code>true</code> if
 * initialization was successfull, or <code>false</code> otherwise.
 */
public boolean resourcesStart() {

	boolean ok = true;

	Hashtable<String, String> env = new Hashtable<String, String>();
	if (getParent() != null)
		env.put(ProxyDirContext.HOST, getParent().getName());
	env.put(ProxyDirContext.CONTEXT, getName());

	try {
		ProxyDirContext proxyDirContext = new ProxyDirContext(env, webappResources);
		if (webappResources instanceof FileDirContext) {
			filesystemBased = true;
			((FileDirContext) webappResources).setAllowLinking(isAllowLinking());
		}
		if (webappResources instanceof BaseDirContext) {
			((BaseDirContext) webappResources).setDocBase(getBasePath());
			((BaseDirContext) webappResources).setCached(isCachingAllowed());
			((BaseDirContext) webappResources).setCacheTTL(getCacheTTL());
			((BaseDirContext) webappResources).setCacheMaxSize(getCacheMaxSize());
			((BaseDirContext) webappResources).allocate();
			// Alias support
			((BaseDirContext) webappResources).setAliases(getAliases());

			if (effectiveMajorVersion >= 3 && addWebinfClassesResources) {
				try {
					DirContext webInfCtx = (DirContext) webappResources.lookup("/WEB-INF/classes");
					// Do the lookup to make sure it exists
					webInfCtx.lookup("META-INF/resources");
					((BaseDirContext) webappResources).addAltDirContext(webInfCtx);
				} catch (NamingException e) {
					// Doesn't exist - ignore and carry on
				}
			}
		}
		// Register the cache in JMX
		if (isCachingAllowed() && proxyDirContext.getCache() != null) {
			String contextName = getName();
			if (!contextName.startsWith("/")) {
				contextName = "/" + contextName;
			}
			ObjectName resourcesName = new ObjectName(
					this.getDomain() + ":type=Cache,host=" + getHostname() + ",context=" + contextName);
			Registry.getRegistry(null, null).registerComponent(proxyDirContext.getCache(), resourcesName, null);
		}
		this.resources = proxyDirContext;
	} catch (Throwable t) {
		ExceptionUtils.handleThrowable(t);
		log.error(sm.getString("standardContext.resourcesStart"), t);
		ok = false;
	}

	return (ok);

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:60,代码来源:StandardContext.java

示例15: resourcesStart

import org.apache.naming.resources.ProxyDirContext; //导入依赖的package包/类
/**
 * Allocate resources, including proxy.
 * Return <code>true</code> if initialization was successfull,
 * or <code>false</code> otherwise.
 */
public boolean resourcesStart() {

    boolean ok = true;

    Hashtable<String, String> env = new Hashtable<String, String>();
    if (getParent() != null)
        env.put(ProxyDirContext.HOST, getParent().getName());
    env.put(ProxyDirContext.CONTEXT, getName());

    try {
        ProxyDirContext proxyDirContext =
            new ProxyDirContext(env, webappResources);
        if (webappResources instanceof FileDirContext) {
            filesystemBased = true;
            ((FileDirContext) webappResources).setAllowLinking
                (isAllowLinking());
        }
        if (webappResources instanceof BaseDirContext) {
            ((BaseDirContext) webappResources).setDocBase(getBasePath());
            ((BaseDirContext) webappResources).setCached
                (isCachingAllowed());
            ((BaseDirContext) webappResources).setCacheTTL(getCacheTTL());
            ((BaseDirContext) webappResources).setCacheMaxSize
                (getCacheMaxSize());
            ((BaseDirContext) webappResources).allocate();
            // Alias support
            ((BaseDirContext) webappResources).setAliases(getAliases());
            
            if (effectiveMajorVersion >=3 && addWebinfClassesResources) {
                try {
                    DirContext webInfCtx =
                        (DirContext) webappResources.lookup(
                                "/WEB-INF/classes");
                    // Do the lookup to make sure it exists
                    webInfCtx.lookup("META-INF/resources");
                    ((BaseDirContext) webappResources).addAltDirContext(
                            webInfCtx);
                } catch (NamingException e) {
                    // Doesn't exist - ignore and carry on
                }
            }
        }
        // Register the cache in JMX
        if (isCachingAllowed()) {
            String contextName = getName();
            if (!contextName.startsWith("/")) {
                contextName = "/" + contextName;
            }
            ObjectName resourcesName = 
                new ObjectName(this.getDomain() + ":type=Cache,host=" 
                               + getHostname() + ",context=" + contextName);
            Registry.getRegistry(null, null).registerComponent
                (proxyDirContext.getCache(), resourcesName, null);
        }
        this.resources = proxyDirContext;
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log.error(sm.getString("standardContext.resourcesStart"), t);
        ok = false;
    }

    return (ok);

}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:70,代码来源:StandardContext.java


注:本文中的org.apache.naming.resources.ProxyDirContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。