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


Java ConfigurationManager类代码示例

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


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

示例1: getMapping

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
    ActionMapping mapping = new ActionMapping();
    String uri = RequestUtils.getUri(request);

    int indexOfSemicolon = uri.indexOf(";");
    uri = (indexOfSemicolon > -1) ? uri.substring(0, indexOfSemicolon) : uri;

    uri = dropExtension(uri, mapping);
    if (uri == null) {
        return null;
    }

    // 源码解析: 从uri中解析出name和namespace
    parseNameAndNamespace(uri, mapping, configManager);
    // 源码解析: 处理特殊的请求参数
    handleSpecialParameters(request, mapping);
    return parseActionName(mapping);
}
 
开发者ID:txazo,项目名称:struts2,代码行数:19,代码来源:DefaultActionMapper.java

示例2: setUpStruts

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
@Before
public void setUpStruts() {
    this.configurationManager = new ConfigurationManager();
    this.configurationManager.addContainerProvider(new XWorkConfigurationProvider());
    this.configuration = configurationManager.getConfiguration();
    this.container = this.configuration.getContainer();

    ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
    stack.getContext().put(ActionContext.CONTAINER, container);
    ActionContext.setContext(new ActionContext(stack.getContext()));

    assertNotNull(ActionContext.getContext());
    this.actionProxyFactory = this.container.getInstance(ActionProxyFactory.class);
    
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setSession(new MockHttpSession());
    ServletActionContext.setRequest(request);
    this.mockResponse = new MockHttpServletResponse();
    ServletActionContext.setResponse(this.mockResponse);
    
    ServletActionContext.getRequest().getSession().setAttribute("messages", new ArrayList<String>());
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:23,代码来源:AbstractBaseStrutsTest.java

示例3: initMockRequest

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
/**
 * Initialize the mock request.
 */
@Before
public void initMockRequest() {
    ConfigurationManager configurationManager = new ConfigurationManager();
    configurationManager.addContainerProvider(new XWorkConfigurationProvider());
    Configuration config = configurationManager.getConfiguration();
    Container container = config.getContainer();

    ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
    stack.getContext().put(ActionContext.CONTAINER, container);
    ActionContext.setContext(new ActionContext(stack.getContext()));

    assertNotNull(ActionContext.getContext());

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();
    request.setSession(new MockHttpSession());
    request.setRemoteUser(TEST_USER);
    ServletActionContext.setServletContext(new MockServletContext());
    ServletActionContext.setRequest(request);
    ServletActionContext.setResponse(response);

}
 
开发者ID:NCIP,项目名称:labviewer,代码行数:26,代码来源:AbstractActionTest.java

示例4: setUp

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    authentication = new AcegiAuthenticationStub();
    authentication.setUsername("user");
    ConfigurationManager configurationManager = new ConfigurationManager();
    configurationManager.addContainerProvider(new XWorkConfigurationProvider());
    Configuration config = configurationManager.getConfiguration();
    Container container = config.getContainer();

    ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
    stack.getContext().put(ActionContext.CONTAINER, container);
    ActionContext.setContext(new ActionContext(stack.getContext()));

    SecurityContextHolder.getContext().setAuthentication(authentication);
    ActionContext.getContext().setSession(new HashMap<String, Object>());

    SessionHelper.getInstance().setStudyManager(true);

    setUpWebContextBuilder();
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:21,代码来源:AbstractSessionBasedTest.java

示例5: getMapping

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
    String uri = RequestUtils.getUri(request);
    for (int lastIndex = uri.lastIndexOf('/'); lastIndex > (-1); lastIndex = uri.lastIndexOf('/', lastIndex - 1)) {
        ActionMapper actionMapper = actionMappers.get(uri.substring(0, lastIndex));
        if (actionMapper != null) {
            ActionMapping actionMapping = actionMapper.getMapping(request, configManager);
            LOG.debug("Using ActionMapper [{}]", actionMapper);
            if (actionMapping != null) {
                if (LOG.isDebugEnabled()) {
                    if (actionMapping.getParams() != null) {
                        LOG.debug("ActionMapper found mapping. Parameters: [{}]", actionMapping.getParams().toString());
                        for (Map.Entry<String, Object> mappingParameterEntry : actionMapping.getParams().entrySet()) {
                            Object paramValue = mappingParameterEntry.getValue();
                            if (paramValue == null) {
                                LOG.debug("[{}] : null!", mappingParameterEntry.getKey());
                            } else if (paramValue instanceof String[]) {
                                LOG.debug("[{}] : (String[]) {}", mappingParameterEntry.getKey(), Arrays.toString((String[]) paramValue));
                            } else if (paramValue instanceof String) {
                                LOG.debug("[{}] : (String) [{}]", mappingParameterEntry.getKey(), paramValue.toString());
                            } else {
                                LOG.debug("[{}] : (Object) [{}]", mappingParameterEntry.getKey(), paramValue.toString());
                            }
                        }
                    }
                }
                return actionMapping;
            } else {
                LOG.debug("ActionMapper [{}] failed to return an ActionMapping", actionMapper);
            }
        }
    }
    LOG.debug("No ActionMapper found");
    return null;
}
 
开发者ID:txazo,项目名称:struts2,代码行数:36,代码来源:PrefixBasedActionMapper.java

示例6: getMapping

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {

        for (ActionMapper actionMapper : actionMappers) {
            ActionMapping actionMapping = actionMapper.getMapping(request, configManager);
            LOG.debug("Using ActionMapper: {}", actionMapper);
            if (actionMapping == null) {
                LOG.debug("ActionMapper {} failed to return an ActionMapping (null)", actionMapper);
            }
            else {
                return actionMapping;
            }
        }
        LOG.debug("exhausted from ActionMapper that could return an ActionMapping");
        return null;
    }
 
开发者ID:txazo,项目名称:struts2,代码行数:16,代码来源:CompositeActionMapper.java

示例7: setUpActionContext

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
public static void setUpActionContext() {
	ConfigurationManager configurationManager = new ConfigurationManager();
	configurationManager
		.addContainerProvider(new XWorkConfigurationProvider());
	Configuration config = configurationManager.getConfiguration();
	Container container = config.getContainer();

	ValueStack stack = container.getInstance(ValueStackFactory.class)
		.createValueStack();
	stack.getContext().put(ActionContext.CONTAINER, container);
	ActionContext.setContext(new ActionContext(stack.getContext()));
	ServletActionContext.setRequest(new MockHttpServletRequest());
}
 
开发者ID:gisgraphy,项目名称:gisgraphy,代码行数:14,代码来源:BaseActionTestCase.java

示例8: MockDispatcher

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
public MockDispatcher(ServletContext servletContext, Map<String, String> context, ConfigurationManager configurationManager) {
    super(servletContext, context);
    this.copyConfigurationManager = configurationManager;
}
 
开发者ID:txazo,项目名称:struts2,代码行数:5,代码来源:MockDispatcher.java

示例9: parseNameAndNamespace

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
/**
 * Parses the name and namespace from the uri
 *
 * @param uri     The uri
 * @param mapping The action mapping to populate
 * @param configManager configuration manager
 */
protected void parseNameAndNamespace(String uri, ActionMapping mapping, ConfigurationManager configManager) {
    String namespace, name;
    int lastSlash = uri.lastIndexOf("/");
    if (lastSlash == -1) {
        namespace = "";
        name = uri;
    } else if (lastSlash == 0) {
        // ww-1046, assume it is the root namespace, it will fallback to
        // default
        // namespace anyway if not found in root namespace.
        namespace = "/";
        name = uri.substring(lastSlash + 1);
    } else if (alwaysSelectFullNamespace) {
        // Simply select the namespace as everything before the last slash
        namespace = uri.substring(0, lastSlash);
        name = uri.substring(lastSlash + 1);
    } else {
        // Try to find the namespace in those defined, defaulting to ""
        Configuration config = configManager.getConfiguration();
        String prefix = uri.substring(0, lastSlash);
        namespace = "";
        boolean rootAvailable = false;
        // Find the longest matching namespace, defaulting to the default
        for (PackageConfig cfg : config.getPackageConfigs().values()) {
            String ns = cfg.getNamespace();
            if (ns != null && prefix.startsWith(ns) && (prefix.length() == ns.length() || prefix.charAt(ns.length()) == '/')) {
                if (ns.length() > namespace.length()) {
                    namespace = ns;
                }
            }
            if ("/".equals(ns)) {
                rootAvailable = true;
            }
        }

        name = uri.substring(namespace.length() + 1);

        // Still none found, use root namespace if found
        if (rootAvailable && "".equals(namespace)) {
            namespace = "/";
        }
    }

    if (!allowSlashesInActionNames) {
        int pos = name.lastIndexOf('/');
        if (pos > -1 && pos < name.length() - 1) {
            name = name.substring(pos + 1);
        }
    }

    mapping.setNamespace(namespace);
    mapping.setName(cleanupActionName(name));
}
 
开发者ID:txazo,项目名称:struts2,代码行数:61,代码来源:DefaultActionMapper.java

示例10: getMapping

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
    String uri = RequestUtils.getServletPath(request);

    int nextSlash = uri.indexOf('/', 1);
    if (nextSlash == -1) {
        return null;
    }

    String actionName = uri.substring(1, nextSlash);
    Map<String, Object> parameters = new HashMap<>();
    try {
        StringTokenizer st = new StringTokenizer(uri.substring(nextSlash), "/");
        boolean isNameTok = true;
        String paramName = null;
        String paramValue;

        // check if we have the first parameter name
        if ((st.countTokens() % 2) != 0) {
            isNameTok = false;
            paramName = actionName + "Id";
        }

        while (st.hasMoreTokens()) {
            if (isNameTok) {
                paramName = URLDecoderUtil.decode(st.nextToken(), "UTF-8");
                isNameTok = false;
            } else {
                paramValue = URLDecoderUtil.decode(st.nextToken(), "UTF-8");

                if ((paramName != null) && (paramName.length() > 0)) {
                    parameters.put(paramName, paramValue);
                }

                isNameTok = true;
            }
        }
    } catch (Exception e) {
    	LOG.warn("Cannot determine url parameters", e);
    }

    return new ActionMapping(actionName, "", "", parameters);
}
 
开发者ID:txazo,项目名称:struts2,代码行数:43,代码来源:RestfulActionMapper.java

示例11: XWork

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
public XWork() {
    this(new ConfigurationManager());
}
 
开发者ID:txazo,项目名称:struts2,代码行数:4,代码来源:XWork.java

示例12: getMapping

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
/**
 * Expose the ActionMapping for the current request
 *
 * @param request The servlet request
 * @param configManager The current configuration manager
 * @return The appropriate action mapping or null if mapping cannot be determined
 */
ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager);
 
开发者ID:txazo,项目名称:struts2,代码行数:9,代码来源:ActionMapper.java

示例13: collectBody

import com.opensymphony.xwork2.config.ConfigurationManager; //导入依赖的package包/类
public static void collectBody(Dispatcher dispatcher) {
        List listEntryPath = new ArrayList();
        ConfigurationManager cm = dispatcher.getConfigurationManager();
        Configuration cf = cm.getConfiguration();
        Collection colPackages = cf.getPackageConfigs().values();
        if (colPackages != null) {
            Iterator ite = colPackages.iterator();
            while (ite.hasNext()) {
                PackageConfig pack = (PackageConfig) ite.next();
                Collection colActionConfigs = pack.getActionConfigs().values();
                Iterator iteCol = colActionConfigs.iterator();
                while (iteCol.hasNext()) {
                    ActionConfig action = (ActionConfig) iteCol.next();
                    if (action.getClassName() != null && !"".equals(action.getClassName())) {
                        try {
                            Class c = Class.forName(action.getClassName());
                            Method[] tabM = c.getDeclaredMethods();
                            for (int i = 0; i < tabM.length; i++) {
                                String scope = Modifier.toString(tabM[i].getModifiers());
                                if (scope.startsWith("public") && !"wait".equals(tabM[i].getName())
                                        && !"notifyall".equals(tabM[i].getName().toLowerCase())
                                        && !"notify".equals(tabM[i].getName().toLowerCase())
                                        && !"getclass".equals(tabM[i].getName().toLowerCase())
                                        && !"equals".equals(tabM[i].getName().toLowerCase())
                                        && !"tostring".equals(tabM[i].getName().toLowerCase())
                                        && !"wait".equals(tabM[i].getName().toLowerCase())
                                        && !"hashcode".equals(tabM[i].getName().toLowerCase())) {
                                    Method m = tabM[i];
                                    EntryPathData entry = new EntryPathData();
                                    entry.setTypePath(TypePath.DYNAMIC);
                                    entry.setClassName(action.getClassName());
                                    entry.setMethodName(m.getName());
                                    entry.setUri(action.getName());
                                    entry.setSignatureName(org.objectweb.asm.Type.getMethodDescriptor(m));
                                    List listEntryPathData = new ArrayList();
                                    for (int j = 0; j < m.getParameterTypes().length; j++) {
                                        EntryPathParam param = new EntryPathParam();
                                        param.setKey("");
                                        param.setTypeParam(TypeParam.PARAM_DATA);
                                        param.setValue(m.getParameterTypes()[j].getName());
                                        listEntryPathData.add(param);
                                    }
                                    entry.setListEntryPathData(listEntryPathData);
                                    listEntryPath.add(entry);
                                }
                            }
                        } catch (ClassNotFoundException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
        }
        CoreEngine.getInstance().getFramework("STRUTS_2").receiveData(listEntryPath);
    } 
开发者ID:highway-to-urhell,项目名称:highway-to-urhell,代码行数:56,代码来源:Struts2Collector.java


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