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


Java ComponentConfig.WebappInfo方法代码示例

本文整理汇总了Java中org.ofbiz.base.component.ComponentConfig.WebappInfo方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentConfig.WebappInfo方法的具体用法?Java ComponentConfig.WebappInfo怎么用?Java ComponentConfig.WebappInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ofbiz.base.component.ComponentConfig的用法示例。


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

示例1: hasBasePermission

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
public static boolean hasBasePermission(GenericValue userLogin, HttpServletRequest request) {
    Security security = (Security) request.getAttribute("security");
    if (security != null) {
        ServletContext context = (ServletContext) request.getAttribute("servletContext");
        String serverId = (String) context.getAttribute("_serverId");
        // get a context path from the request, if it is empty then assume it is the root mount point
        String contextPath = request.getContextPath();
        if (UtilValidate.isEmpty(contextPath)) {
            contextPath = "/";
        }
        ComponentConfig.WebappInfo info = ComponentConfig.getWebAppInfo(serverId, contextPath);
        if (info != null) {
            return hasApplicationPermission(info, security, userLogin);
        } else {
            Debug.logInfo("No webapp configuration found for : " + serverId + " / " + contextPath, module);
        }
    } else {
        Debug.logWarning("Received a null Security object from HttpServletRequest", module);
    }
    return true;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:22,代码来源:LoginWorker.java

示例2: hasApplicationPermission

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
/**
 * Returns <code>true</code> if the specified user is authorized to access the specified web application.
 * @param info
 * @param security
 * @param userLogin
 * @return <code>true</code> if the specified user is authorized to access the specified web application
 */
public static boolean hasApplicationPermission(ComponentConfig.WebappInfo info, Security security, GenericValue userLogin) {
    // New authorization attribute takes precedence.
    String accessPermission = info.getAccessPermission();
    if (!accessPermission.isEmpty()) {
        return security.hasPermission(accessPermission, userLogin);
    }
    for (String permission: info.getBasePermission()) {
        if (!"NONE".equals(permission) && !security.hasEntityPermission(permission, "_VIEW", userLogin)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:21,代码来源:LoginWorker.java

示例3: getAppBarWebInfos

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
/**
 * Returns a <code>Collection</code> of <code>WebappInfo</code> instances that the specified
 * user is authorized to access.
 * @param security
 * @param userLogin
 * @param serverName
 * @param menuName
 * @return A <code>Collection</code> <code>WebappInfo</code> instances that the specified
 * user is authorized to access
 */
public static Collection<ComponentConfig.WebappInfo> getAppBarWebInfos(Security security, GenericValue userLogin, String serverName, String menuName) {
    Collection<ComponentConfig.WebappInfo> allInfos = ComponentConfig.getAppBarWebInfos(serverName, menuName);
    Collection<ComponentConfig.WebappInfo> allowedInfos = new ArrayList<ComponentConfig.WebappInfo>(allInfos.size());
    for (ComponentConfig.WebappInfo info : allInfos) {
        if (hasApplicationPermission(info, security, userLogin)) {
            allowedInfos.add(info);
        }
    }
    return allowedInfos;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:21,代码来源:LoginWorker.java

示例4: createContext

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
private Callable<Context> createContext(final ComponentConfig.WebappInfo appInfo) throws ContainerException {
    Debug.logInfo("Creating context [" + appInfo.name + "]", module);
    final Engine engine = tomcat.getEngine();

    List<String> virtualHosts = appInfo.getVirtualHosts();
    final Host host;
    if (UtilValidate.isEmpty(virtualHosts)) {
        host = tomcat.getHost();
    } else {
        // assume that the first virtual-host will be the default; additional virtual-hosts will be aliases
        Iterator<String> vhi = virtualHosts.iterator();
        String hostName = vhi.next();

        org.apache.catalina.Container childContainer = engine.findChild(hostName);
        if (childContainer instanceof Host) {
            host = (Host)childContainer;
        } else {
            host = createHost(hostName);
            engine.addChild(host);
        }
        while (vhi.hasNext()) {
            host.addAlias(vhi.next());
        }
    }
    return new Callable<Context>() {
        public Context call() throws ContainerException, LifecycleException {
            StandardContext context = configureContext(engine, host, appInfo);
            host.addChild(context);
            return context;
        }
    };
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:33,代码来源:CatalinaContainer.java

示例5: hasBasePermission

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
public static boolean hasBasePermission(GenericValue userLogin, HttpServletRequest request) {
    Security security = (Security) request.getAttribute("security");
    if (security != null) {
        ServletContext context = (ServletContext) request.getAttribute("servletContext");
        String serverId = (String) context.getAttribute("_serverId");
        
        // get a context path from the request, if it is empty then assume it is the root mount point
        String contextPath = request.getContextPath();
        if (UtilValidate.isEmpty(contextPath)) {
            contextPath = "/";
        }
        
        ComponentConfig.WebappInfo info = ComponentConfig.getWebAppInfo(serverId, contextPath);
        if (info != null) {
            for (String permission: info.getBasePermission()) {
                if (!"NONE".equals(permission) && !security.hasEntityPermission(permission, "_VIEW", userLogin)) {
                    return false;
                }
            }
        } else {
            Debug.logInfo("No webapp configuration found for : " + serverId + " / " + contextPath, module);
        }
    } else {
        Debug.logWarning("Received a null Security object from HttpServletRequest", module);
    }

    return true;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:29,代码来源:LoginWorker.java

示例6: loadComponents

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
protected void loadComponents() throws ContainerException {
    if (tomcat == null) {
        throw new ContainerException("Cannot load web applications without Tomcat instance!");
    }

    // load the applications
    List<ComponentConfig.WebappInfo> webResourceInfos = ComponentConfig.getAllWebappResourceInfos();
    List<String> loadedMounts = new ArrayList<String>();
    if (webResourceInfos == null) {
        return;
    }

    ScheduledExecutorService executor = ExecutionPool.getScheduledExecutor(CATALINA_THREAD_GROUP, "catalina-startup", Runtime.getRuntime().availableProcessors(), 0, true);
    try {
        List<Future<Context>> futures = new ArrayList<Future<Context>>();

        for (int i = webResourceInfos.size(); i > 0; i--) {
            ComponentConfig.WebappInfo appInfo = webResourceInfos.get(i - 1);
            String engineName = appInfo.server;
            List<String> virtualHosts = appInfo.getVirtualHosts();
            String mount = appInfo.getContextRoot();
            List<String> keys = new ArrayList<String>();
            if (virtualHosts.isEmpty()) {
                keys.add(engineName + ":DEFAULT:" + mount);
            } else {
                for (String virtualHost: virtualHosts) {
                    keys.add(engineName + ":" + virtualHost + ":" + mount);
                }
            }
            if (!keys.removeAll(loadedMounts)) {
                // nothing was removed from the new list of keys; this
                // means there are no existing loaded entries that overlap
                // with the new set
                if (!appInfo.location.isEmpty()) {
                    futures.add(executor.submit(createContext(appInfo)));
                }
                loadedMounts.addAll(keys);
            } else {
                appInfo.setAppBarDisplay(false); // disable app bar display on overridden apps
                Debug.logInfo("Duplicate webapp mount; not loading : " + appInfo.getName() + " / " + appInfo.getLocation(), module);
            }
        }
        ExecutionPool.getAllFutures(futures);
    } finally {
        executor.shutdown();
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:48,代码来源:CatalinaContainer.java

示例7: createContext

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
protected Callable<Context> createContext(final ComponentConfig.WebappInfo appInfo) throws ContainerException {
    Debug.logInfo("createContext(" + appInfo.name + ")", module);
    final Engine engine = engines.get(appInfo.server);
    if (engine == null) {
        Debug.logWarning("Server with name [" + appInfo.server + "] not found; not mounting [" + appInfo.name + "]", module);
        return null;
    }
    List<String> virtualHosts = appInfo.getVirtualHosts();
    final Host host;
    if (UtilValidate.isEmpty(virtualHosts)) {
        host = hosts.get(engine.getName() + "._DEFAULT");
    } else {
        // assume that the first virtual-host will be the default; additional virtual-hosts will be aliases
        Iterator<String> vhi = virtualHosts.iterator();
        String hostName = vhi.next();

        boolean newHost = false;
        if (hosts.containsKey(engine.getName() + "." + hostName)) {
            host = hosts.get(engine.getName() + "." + hostName);
        } else {
            host = createHost(engine, hostName);
            newHost = true;
        }
        while (vhi.hasNext()) {
            host.addAlias(vhi.next());
        }

        if (newHost) {
            hosts.put(engine.getName() + "." + hostName, host);
            engine.addChild(host);
        }
    }

    if (host instanceof StandardHost) {
        // set the catalina's work directory to the host
        StandardHost standardHost = (StandardHost) host;
        standardHost.setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP)
                , "work" + File.separator + engine.getName() + File.separator + host.getName()).getAbsolutePath());
    }

    return new Callable<Context>() {
        public Context call() throws ContainerException, LifecycleException {
            StandardContext context = configureContext(engine, host, appInfo);
            context.setParent(host);
            context.start();
            return context;
        }
    };
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:50,代码来源:CatalinaContainer.java

示例8: loadComponents

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
protected void loadComponents() throws ContainerException {
    if (tomcat == null) {
        throw new ContainerException("Cannot load web applications without Tomcat instance!");
    }

    // load the applications
    List<ComponentConfig.WebappInfo> webResourceInfos = ComponentConfig.getAllWebappResourceInfos();
    List<String> loadedMounts = FastList.newInstance();
    if (webResourceInfos == null) {
        return;
    }

    ScheduledExecutorService executor = ExecutionPool.getExecutor(CATALINA_THREAD_GROUP, "catalina-startup", -1, true);
    try {
        List<Future<Context>> futures = FastList.newInstance();

        for (int i = webResourceInfos.size(); i > 0; i--) {
            ComponentConfig.WebappInfo appInfo = webResourceInfos.get(i - 1);
            String engineName = appInfo.server;
            List<String> virtualHosts = appInfo.getVirtualHosts();
            String mount = appInfo.getContextRoot();
            List<String> keys = FastList.newInstance();
            if (UtilValidate.isEmpty(virtualHosts)) {
                keys.add(engineName + ":DEFAULT:" + mount);
            } else {
                for (String virtualHost: virtualHosts) {
                    keys.add(engineName + ":" + virtualHost + ":" + mount);
                }
            }
            if (!keys.removeAll(loadedMounts)) {
                // nothing was removed from the new list of keys; this
                // means there are no existing loaded entries that overlap
                // with the new set
                if (appInfo.location != null) {
                    futures.add(executor.submit(createContext(appInfo)));
                }
                loadedMounts.addAll(keys);
            } else {
                appInfo.appBarDisplay = false; // disable app bar display on overrided apps
                Debug.logInfo("Duplicate webapp mount; not loading : " + appInfo.getName() + " / " + appInfo.getLocation(), module);
            }
        }
        ExecutionPool.getAllFutures(futures);
    } finally {
        executor.shutdown();
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:48,代码来源:CatalinaContainer.java


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