Package jodd.madvoc

Examples of jodd.madvoc.ActionConfigSet


    if (log.isDebugEnabled()) {
      log.debug("Registering Madvoc action: " + actionConfig.actionPath + " to: " +
          actionConfig.getActionString());
    }

    ActionConfigSet set = createActionConfigSet(actionConfig.actionPath);

    if (set.actionPathMacros != null) {
      // new action patch contain macros
      int ndx = -1;
      for (int i = 0; i < list.size(); i++) {
        if (list.get(i).actionPath.equals(actionPath)) {
          ndx = i;
          break;
        }
      }
      if (ndx < 0) {
        list.add(set);
      } else {
        set = list.get(ndx);
      }
    } else {
      // action path is without macros
      if (map.containsKey(actionConfig.actionPath) == false) {
        map.put(actionConfig.actionPath, set);
      } else {
        set = map.get(actionConfig.actionPath);
      }

    }
    boolean isDuplicate = set.add(actionConfig);

    if (madvocConfig.isDetectDuplicatePathsEnabled()) {
      if (isDuplicate) {
        throw new MadvocException("Duplicate action path for " + actionConfig);
      }
View Full Code Here


   * Creates new action config set from the action path.
   */
  protected ActionConfigSet createActionConfigSet(String actionPath) {
    PathMacros pathMacros = actionPathMacroManager.buildActionPathMacros(actionPath);

    return new ActionConfigSet(actionPath, pathMacros);
  }
View Full Code Here

   */
  public ActionConfig lookup(String actionPath, String method) {

    // 1st try: the map

    ActionConfigSet actionConfigSet = map.get(actionPath);
    if (actionConfigSet != null) {
      ActionConfig actionConfig = actionConfigSet.lookup(method);
      if (actionConfig != null) {
        return actionConfig;
      }
    }

    // 2nd try: the list

    int actionPathDeep = StringUtil.count(actionPath, '/');

    int len = list.size();

    int lastMatched = -1;
    int maxMatchedChars = -1;

    for (int i = 0; i < len; i++) {
      actionConfigSet = list.get(i);

      int deep = actionConfigSet.deep;
      if (deep < actionPathDeep) {
        continue;
      }
      if (deep > actionPathDeep) {
        break;
      }

      // same deep level, try the fully match

      int matchedChars = actionConfigSet.actionPathMacros.match(actionPath);

      if (matchedChars == -1) {
        continue;
      }

      if (matchedChars > maxMatchedChars) {
        maxMatchedChars = matchedChars;
        lastMatched = i;
      }
    }

    if (lastMatched < 0) {
      return null;
    }

    ActionConfigSet set = list.get(lastMatched);

    return set.lookup(method);
  }
View Full Code Here

*/
public class ActionPathMacroInjector implements Injector {

  public void inject(ActionRequest actionRequest) {
    ActionConfig config = actionRequest.getActionConfig();
    ActionConfigSet set = config.getActionConfigSet();

    if (set.actionPathMacros == null) {
      return;
    }

View Full Code Here

    silent = true;
  }

  public void inject(ActionRequest actionRequest) {
    ActionConfig config = actionRequest.getActionConfig();
    ActionConfigSet set = config.getActionConfigSet();

    if (set.actionPathMacros == null) {
      // no action path macros at all, just exit
      return;
    }
View Full Code Here

    if (log.isDebugEnabled()) {
      log.debug("Registering Madvoc action: " + actionConfig.actionPath + " to: " +
          actionConfig.getActionString());
    }

    ActionConfigSet set = createActionConfigSet(actionConfig.actionPath);

    if (set.actionPathMacros != null) {
      // new action patch contain macros
      int ndx = -1;
      for (int i = 0; i < list.size(); i++) {
        if (list.get(i).actionPath.equals(actionPath)) {
          ndx = i;
          break;
        }
      }
      if (ndx < 0) {
        list.add(set);
      } else {
        set = list.get(ndx);
      }
    } else {
      // action path is without macros
      if (map.containsKey(actionConfig.actionPath) == false) {
        map.put(actionConfig.actionPath, set);
      } else {
        set = map.get(actionConfig.actionPath);
      }

    }
    boolean isDuplicate = set.add(actionConfig);

    if (madvocConfig.isDetectDuplicatePathsEnabled()) {
      if (isDuplicate) {
        throw new MadvocException("Duplicate action path for " + actionConfig);
      }
View Full Code Here

   * Creates new action config set from the action path.
   */
  protected ActionConfigSet createActionConfigSet(String actionPath) {
    PathMacros pathMacros = actionPathMacroManager.buildActionPathMacros(actionPath);

    return new ActionConfigSet(actionPath, pathMacros);
  }
View Full Code Here

   */
  public ActionConfig lookup(String actionPath, String method) {

    // 1st try: the map

    ActionConfigSet actionConfigSet = map.get(actionPath);
    if (actionConfigSet != null) {
      ActionConfig actionConfig = actionConfigSet.lookup(method);
      if (actionConfig != null) {
        return actionConfig;
      }
    }

    // 2nd try: the list

    int actionPathDeep = StringUtil.count(actionPath, '/');

    int len = list.size();

    int lastMatched = -1;
    int maxMatchedChars = -1;

    for (int i = 0; i < len; i++) {
      actionConfigSet = list.get(i);

      int deep = actionConfigSet.deep;
      if (deep < actionPathDeep) {
        continue;
      }
      if (deep > actionPathDeep) {
        break;
      }

      // same deep level, try the fully match

      int matchedChars = actionConfigSet.actionPathMacros.match(actionPath);

      if (matchedChars == -1) {
        continue;
      }

      if (matchedChars > maxMatchedChars) {
        maxMatchedChars = matchedChars;
        lastMatched = i;
      }
    }

    if (lastMatched < 0) {
      return null;
    }

    ActionConfigSet set = list.get(lastMatched);

    return set.lookup(method);
  }
View Full Code Here

TOP

Related Classes of jodd.madvoc.ActionConfigSet

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.