Package com.opensymphony.xwork2.config.entities

Examples of com.opensymphony.xwork2.config.entities.InterceptorConfig$Builder


        assertEquals(ModelDrivenAction.class, action.getClass());
    }

    public void testFallsBackToDefaultObjectFactoryInterceptorBuilding() throws Exception {
        InterceptorConfig iConfig = new InterceptorConfig.Builder("timer", ModelDrivenInterceptor.class.getName()).build();

        Interceptor interceptor = objectFactory.buildInterceptor(iConfig, new HashMap<String, String>());

        assertEquals(ModelDrivenInterceptor.class, interceptor.getClass());
    }
View Full Code Here


    }

    public void testObtainInterceptorBySpringName() throws Exception {
        sac.registerSingleton("timer-interceptor", TimerInterceptor.class, new MutablePropertyValues());

        InterceptorConfig iConfig = new InterceptorConfig.Builder("timer", "timer-interceptor").build();
        Interceptor interceptor = objectFactory.buildInterceptor(iConfig, new HashMap<String, String>());

        assertEquals(TimerInterceptor.class, interceptor.getClass());
    }
View Full Code Here

        // assertions for size
        assertEquals(1, interceptorConfigs.size());

        // assertions for interceptors
        InterceptorConfig seen = (InterceptorConfig) interceptorConfigs.get("timer");
        assertEquals("timer-interceptor", seen.getClassName());
    }
View Full Code Here

        if (referencedConfig == null) {
            throw new ConfigurationException("Unable to find interceptor class referenced by ref-name " + refName, location);
        } else {
            if (referencedConfig instanceof InterceptorConfig) {
                InterceptorConfig config = (InterceptorConfig) referencedConfig;
                Interceptor inter = null;
                try {

                    inter = objectFactory.buildInterceptor(config, refParams);
                    result.add(new InterceptorMapping(refName, inter));
                } catch (ConfigurationException ex) {
                    if (LOG.isWarnEnabled()) {
                  LOG.warn("Unable to load config class " + config.getClassName() + " at " +
                            ex.getLocation() + " probably due to a missing jar, which might " +
                            "be fine if you never plan to use the " + config.getName() + " interceptor");
                    }
                    LOG.error("Actual exception", ex);
                }

            } else if (referencedConfig instanceof InterceptorStackConfig) {
View Full Code Here

             *    <param name="interceptorStack1.interceptor1.param1">someValue</param>
             *    ...
             *  </interceptor-ref>
             */
            if (interceptorCfgObj instanceof InterceptorConfig) {  //  interceptor-ref param refer to an interceptor
                InterceptorConfig cfg = (InterceptorConfig) interceptorCfgObj;
                Interceptor interceptor = objectFactory.buildInterceptor(cfg, map);

                InterceptorMapping mapping = new InterceptorMapping(key, interceptor);
                if (result != null && result.contains(mapping)) {
                    // if an existing interceptor mapping exists,
View Full Code Here

        if (referencedConfig == null) {
            throw new ConfigurationException("Unable to find interceptor class referenced by ref-name " + refName, location);
        } else {
            if (referencedConfig instanceof InterceptorConfig) {
                InterceptorConfig config = (InterceptorConfig) referencedConfig;
                Interceptor inter = null;
                try {

                    inter = objectFactory.buildInterceptor(config, refParams);
                    result.add(new InterceptorMapping(refName, inter));
                } catch (ConfigurationException ex) {
                    if (LOG.isWarnEnabled()) {
                      LOG.warn("Unable to load config class #0 at #1 probably due to a missing jar, which might be fine if you never plan to use the #2 interceptor",
                            config.getClassName(), ex.getLocation().toString(), config.getName());
                    }
                    LOG.error("Actual exception", ex);
                }

            } else if (referencedConfig instanceof InterceptorStackConfig) {
View Full Code Here

             *    <param name="interceptorStack1.interceptor1.param1">someValue</param>
             *    ...
             *  </interceptor-ref>
             */
            if (interceptorCfgObj instanceof InterceptorConfig) {  //  interceptor-ref param refer to an interceptor
                InterceptorConfig cfg = (InterceptorConfig) interceptorCfgObj;
                Interceptor interceptor = objectFactory.buildInterceptor(cfg, map);

                InterceptorMapping mapping = new InterceptorMapping(key, interceptor);
                if (result != null && result.contains(mapping)) {
                    // if an existing interceptor mapping exists,
View Full Code Here

      @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());
        System.out.println(config.getName());
        System.out.println(config.getMethodName());
View Full Code Here

      super(packageConfig);
    }

    public boolean equals(Object obj) {
      if (!(obj instanceof PackageConfig)) return false;
      PackageConfig other = (PackageConfig) obj;
      return getName().equals(other.getName()) && getNamespace().equals(other.getNamespace())
          && getParents().get(0) == other.getParents().get(0)
          && getParents().size() == other.getParents().size();
    }
View Full Code Here

    ActionConfig.Builder actionConfig = new ActionConfig.Builder(pkgCfg.getName(), action.getName(),
        beanName);
    actionConfig.methodName(action.getMethod());
    String actionName = action.getName();
    // check action exists on that package (from XML config probably)
    PackageConfig existingPkg = configuration.getPackageConfig(pkgCfg.getName());
    boolean create = true;
    if (existingPkg != null) {
      ActionConfig existed = existingPkg.getActionConfigs().get(actionName);
      create = (null == existed);
    }
    if (create) {
      pkgCfg.addActionConfig(actionName, actionConfig.build());
      logger.debug("Add {}/{} for {} in {}", new Object[] { pkgCfg.getNamespace(), actionName,
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.config.entities.InterceptorConfig$Builder

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.