Package com.opensymphony.xwork2.config.providers

Examples of com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider


  @Inject
  protected ActionBuilder actionNameBuilder;

  public Result build(String resultCode, ActionConfig actionConfig, ActionContext context) {
    String path = null;
    ResultTypeConfig resultTypeConfig = null;

    logger.debug("result code:{} for actionConfig:{}", resultCode, actionConfig);
    if (null == resultTypeConfigs) {
      PackageConfig pc = configuration.getPackageConfig(actionConfig.getPackageName());
      this.resultTypeConfigs = pc.getAllResultTypeConfigs();
View Full Code Here


    ProfileService profileService = new ProfileServiceImpl();
    actionNameBuilder.setProfileService(profileService);

    ObjectFactory of = new ObjectFactory();
    final DummyContainer mockContainer = new DummyContainer();
    Configuration configuration = new DefaultConfiguration() {
      @Override
      public Container getContainer() {
        return mockContainer;
      }
    };
    PackageConfig strutsDefault = makePackageConfig("beangle", null, null, "dispatcher", null, null, null);
    configuration.addPackageConfig("beangle", strutsDefault);
    // ResultMapBuilder resultMapBuilder =
    // createStrictMock(ResultMapBuilder.class);
    // set beans on mock container
    mockContainer.setActionNameBuilder(actionNameBuilder);
    // mockContainer.setResultMapBuilder(resultMapBuilder);
    // mockContainer.setConventionsService(new ConventionsServiceImpl(""));

    SmartActionConfigBuilder builder = new SmartActionConfigBuilder(configuration, mockContainer, of);
    builder.setActionBuilder(actionNameBuilder);
    builder.buildActionConfigs();
    Set<String> names = configuration.getPackageConfigNames();
    for (String a : names) {
      System.out.println("pkgname:" + a);
      PackageConfig pkgConfig = configuration.getPackageConfig(a);
      System.out.println("namespace:" + pkgConfig.getNamespace());
      Map<String, ActionConfig> configs = pkgConfig.getAllActionConfigs();
      for (String actionName : configs.keySet()) {
        ActionConfig config = configs.get(actionName);
        System.out.println(config.getClassName());
View Full Code Here

        LocalizedTextUtil.addDefaultResourceBundle(Constants.BUNDLE_KEY);

        // Initialize ActionContext
        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);
View Full Code Here

    public void selfRegister() {
        //this cannot be done in the constructor, as it causes an infinite loop
        builder.factory(Configuration.class, MockConfiguration.class, Scope.SINGLETON);
        LocatableProperties props = new LocatableProperties();
        new XWorkConfigurationProvider().register(builder, props);
        builder.constant(XWorkConstants.DEV_MODE, "false");
        builder.constant(XWorkConstants.RELOAD_XML_CONFIGURATION, "true");
        builder.constant(XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE, "true");
        container = builder.create(true);
    }
View Full Code Here

     */
    public List<ContainerProvider> getContainerProviders() {
        providerLock.lock();
        try {
            if (containerProviders.size() == 0) {
                containerProviders.add(new XWorkConfigurationProvider());
                containerProviders.add(new XmlConfigurationProvider("xwork.xml", false));
            }

            return containerProviders;
        } finally {
View Full Code Here

        assertEquals(expected, actual);
    }

    public void testInsecureParamaters() throws Exception {
        // given
        loadConfigurationProviders(new XWorkConfigurationProvider(), new XmlConfigurationProvider("xwork-param-test.xml"));
        final Map<String, Object> params = new HashMap<String, Object>() {
            {
                put("name", "(#context[\"xwork.MethodAccessor.denyMethodExecution\"]= new " +
                        "java.lang.Boolean(false), #_memberAccess[\"allowStaticMethodAccess\"]= new java.lang.Boolean(true), " +
                        "@java.lang.Runtime@getRuntime().exec('mkdir /tmp/PWNAGE'))(meh)");
View Full Code Here

        throws Exception
    {
        super.setUp( );

        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 );
View Full Code Here

        throws Exception
    {
        super.setUp();

        ConfigurationManager configurationManager = new ConfigurationManager();
        configurationManager.addContainerProvider( new XWorkConfigurationProvider() );
        com.opensymphony.xwork2.config.Configuration config = configurationManager.getConfiguration();
        Container container = config.getContainer();

        ValueStack stack = container.getInstance( ValueStackFactory.class ).createValueStack();
        stack.getContext().put( ActionContext.CONTAINER, container );
View Full Code Here

        assertEquals(expected, actual);
    }

    public void testInsecureParamaters() throws Exception {
        // given
        loadConfigurationProviders(new XWorkConfigurationProvider(), new XmlConfigurationProvider("xwork-param-test.xml"));
        final Map<String, Object> params = new HashMap<String, Object>() {
            {
                put("name", "(#context[\"xwork.MethodAccessor.denyMethodExecution\"]= new " +
                        "java.lang.Boolean(false), #_memberAccess[\"allowStaticMethodAccess\"]= new java.lang.Boolean(true), " +
                        "@java.lang.Runtime@getRuntime().exec('mkdir /tmp/PWNAGE'))(meh)");
View Full Code Here

        final String pollution3 = "model[\"class\"]['classLoader']['jarPath']";
        final String pollution4 = "class.classLoader.jarPath";
        final String pollution5 = "class['classLoader']['jarPath']";
        final String pollution6 = "class[\"classLoader\"]['jarPath']";

        loadConfigurationProviders(new XWorkConfigurationProvider(), new XmlConfigurationProvider("xwork-param-test.xml"));
        final Map<String, Object> params = new HashMap<String, Object>() {
            {
                put(pollution1, "bad");
                put(pollution2, "bad");
                put(pollution3, "bad");
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider

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.