Examples of RewriteAction


Examples of net.sourceforge.urlrewriter4j.core.actions.RewriteAction

      throws ConfigurationException {
    Node oRewriteNode = pNode.getAttributes().getNamedItem(Constants.ATTR_REWRITE);
    if (oRewriteNode == null) {
      Node oProcessingNode = pNode.getAttributes().getNamedItem(Constants.ATTR_PROCESSING);
      RewriteProcessing oProcessing = ParserHelper.parseProcessing(oProcessingNode, RewriteProcessing.ContinueProcessing);
      return new RewriteAction(oRewriteNode.getNodeValue(), oProcessing);
    }
    return null;
  }
View Full Code Here

Examples of net.sourceforge.urlrewriter4j.core.actions.RewriteAction

  public IRewriteAction parse(Node pNode, RewriterConfiguration pConfig)
      throws ConfigurationException {
    Node oToNode = ParserHelper.getAttribute(pNode, Constants.ATTR_TO, true);
    Node oProcessingNode = pNode.getAttributes().getNamedItem(Constants.ATTR_PROCESSING);
    RewriteProcessing oProcessing = ParserHelper.parseProcessing(oProcessingNode, RewriteProcessing.ContinueProcessing);
    RewriteAction oAction = new RewriteAction(oToNode.getNodeValue(), oProcessing);
    parseConditions(pNode, oAction.getConditions(), false, pConfig);
    return oAction;
  }
View Full Code Here

Examples of net.sourceforge.urlrewriter4j.core.actions.RewriteAction

  public void testRewriteActionWithStop() throws Exception {
    RewriterConfiguration oConfiguration = getConfig();

    oConfiguration.getRules().add(
        new RewriteAction("/foo.aspx", RewriteProcessing.StopProcessing));
    oConfiguration.getRules().add(
        new RewriteAction("/foo2.aspx", RewriteProcessing.StopProcessing));

    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET", new URL("http://localhost/test.aspx"));
    RewriterEngine oEngine = new RewriterEngine(oConfiguration);
    oEngine.rewrite(oMockFacade);
View Full Code Here

Examples of net.sourceforge.urlrewriter4j.core.actions.RewriteAction

  public void testRewriteActionWithContinue() throws Exception {
    RewriterConfiguration oConfiguration = getConfig();

    oConfiguration.getRules().add(
        new RewriteAction("/foo2.aspx",
            RewriteProcessing.ContinueProcessing));
    oConfiguration.getRules()
        .add(
            new RewriteAction("/foo.aspx",
                RewriteProcessing.ContinueProcessing));

    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET", new URL("http://localhost/test.aspx"));
    RewriterEngine oEngine = new RewriterEngine(oConfiguration);
View Full Code Here

Examples of net.sourceforge.urlrewriter4j.core.actions.RewriteAction

  public void benchmark() throws Exception {
    RewriterConfiguration oConfiguration = new RewriterConfiguration();
    //rule.setFrom("^/([a-z]+)/([0-9]+)/" + i + "/$");
      // rule.setTo("/blah/a/$2/");   
    for (int i = 0; i < 1000; i++) {
      RewriteAction oRewriteAction = new RewriteAction("/blah/a/$2/", RewriteProcessing.StopProcessing); // RewriteProcessing.StopProcessing);
      ConditionalAction oAction = new ConditionalAction();
      oAction.getConditions().add(new UrlMatchCondition("^/([a-z]+)/([0-9]+)/" + i + "/$"));
      oAction.getActions().add(oRewriteAction);
      oConfiguration.getRules().add(oAction);
    }   
View Full Code Here

Examples of net.sourceforge.urlrewriter4j.core.actions.RewriteAction

    mEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/rewritten-DVD.html");
  }

  private ConditionalAction createUrlConditionAndRewirteAction(String pRewriteLocation, String pUrlPattern) {
    RewriteAction oRewriteAction = new RewriteAction(pRewriteLocation, RewriteProcessing.StopProcessing);
    ConditionalAction oAction = new ConditionalAction();
    oAction.getConditions().add(new UrlMatchCondition(pUrlPattern));
    oAction.getActions().add(oRewriteAction);
    return oAction;
  }
View Full Code Here

Examples of org.apache.synapse.mediators.transform.url.RewriteAction

        if (value == null && xpath == null && !ACTION_REMOVE.equals(type)) {
            handleException("value or xpath attribute is required on the action element");
        }

        RewriteAction action = new RewriteAction();
        if (xpath != null) {
            try {
                action.setXpath(new SynapseXPath(xpath));
            } catch (JaxenException e) {
                handleException("Error while parsing the XPath expression: " + xpath, e);
            }
        } else if (value != null) {
            action.setValue(value);
        }

        String fragment = actionElement.getAttributeValue(ATT_FRAGMENT);
        if (fragment != null) {
            if (FRAGMENT_PROTOCOL.equals(fragment)) {
                action.setFragmentIndex(URIFragments.PROTOCOL);
            } else if (FRAGMENT_USER_INFO.equals(fragment)) {
                action.setFragmentIndex(URIFragments.USER_INFO);
            } else if (FRAGMENT_HOST.equals(fragment)) {
                action.setFragmentIndex(URIFragments.HOST);
            } else if (FRAGMENT_PORT.equals(fragment)) {
                action.setFragmentIndex(URIFragments.PORT);
            } else if (FRAGMENT_PATH.equals(fragment)) {
                action.setFragmentIndex(URIFragments.PATH);
            } else if (FRAGMENT_QUERY.equals(fragment)) {
                action.setFragmentIndex(URIFragments.QUERY);
            } else if (FRAGMENT_REF.equals(fragment)) {
                action.setFragmentIndex(URIFragments.REF);
            } else if (FRAGMENT_FULL_URI.equals(fragment)) {
                action.setFragmentIndex(URIFragments.FULL_URI);
            } else {
                handleException("Unknown URL fragment name: " + fragment);
            }
        }

        if (type != null) {
            if (ACTION_SET.equals(type)) {
                action.setActionType(RewriteAction.ACTION_SET);
            } else if (ACTION_APPEND.equals(type)) {
                action.setActionType(RewriteAction.ACTION_APPEND);
            } else if (ACTION_PREPEND.equals(type)) {
                action.setActionType(RewriteAction.ACTION_PREPEND);
            } else if (ACTION_REPLACE.equals(type)) {
                action.setActionType(RewriteAction.ACTION_REPLACE);
                String regex = actionElement.getAttributeValue(ATT_REGEX);
                if (regex != null) {
                    action.setRegex(regex);
                } else {
                    handleException("regex attribute is required for replace action");
                }
            } else if (ACTION_REMOVE.equals(type)) {
                action.setActionType(RewriteAction.ACTION_REMOVE);
            } else {
                handleException("Unknown URL rewrite action type: " + type);
            }
        }
View Full Code Here

Examples of org.apache.synapse.mediators.transform.url.RewriteAction

        if (value == null && xpath == null && !ACTION_REMOVE.equals(type)) {
            handleException("value or xpath attribute is required on the action element");
        }

        RewriteAction action = new RewriteAction();
        if (xpath != null) {
            try {
                action.setXpath(new SynapseXPath(xpath));
            } catch (JaxenException e) {
                handleException("Error while parsing the XPath expression: " + xpath, e);
            }
        } else if (value != null) {
            action.setValue(value);
        }

        String fragment = actionElement.getAttributeValue(ATT_FRAGMENT);
        if (fragment != null) {
            if (FRAGMENT_PROTOCOL.equals(fragment)) {
                action.setFragmentIndex(URIFragments.PROTOCOL);
            } else if (FRAGMENT_USER_INFO.equals(fragment)) {
                action.setFragmentIndex(URIFragments.USER_INFO);
            } else if (FRAGMENT_HOST.equals(fragment)) {
                action.setFragmentIndex(URIFragments.HOST);
            } else if (FRAGMENT_PORT.equals(fragment)) {
                action.setFragmentIndex(URIFragments.PORT);
            } else if (FRAGMENT_PATH.equals(fragment)) {
                action.setFragmentIndex(URIFragments.PATH);
            } else if (FRAGMENT_QUERY.equals(fragment)) {
                action.setFragmentIndex(URIFragments.QUERY);
            } else if (FRAGMENT_REF.equals(fragment)) {
                action.setFragmentIndex(URIFragments.REF);
            } else if (FRAGMENT_FULL_URI.equals(fragment)) {
                action.setFragmentIndex(URIFragments.FULL_URI);
            } else {
                handleException("Unknown URL fragment name: " + fragment);
            }
        }

        if (type != null) {
            if (ACTION_SET.equals(type)) {
                action.setActionType(RewriteAction.ACTION_SET);
            } else if (ACTION_APPEND.equals(type)) {
                action.setActionType(RewriteAction.ACTION_APPEND);
            } else if (ACTION_PREPEND.equals(type)) {
                action.setActionType(RewriteAction.ACTION_PREPEND);
            } else if (ACTION_REPLACE.equals(type)) {
                action.setActionType(RewriteAction.ACTION_REPLACE);
                String regex = actionElement.getAttributeValue(ATT_REGEX);
                if (regex != null) {
                    action.setRegex(regex);
                } else {
                    handleException("regex attribute is required for replace action");
                }
            } else if (ACTION_REMOVE.equals(type)) {
                action.setActionType(RewriteAction.ACTION_REMOVE);
            } else {
                handleException("Unknown URL rewrite action type: " + type);
            }
        }
View Full Code Here

Examples of org.apache.synapse.mediators.transform.url.RewriteAction

       
        if (value == null && xpath == null && !ACTION_REMOVE.equals(type)) {
            handleException("value or xpath attribute is required on the action element");
        }

        RewriteAction action = new RewriteAction();
        if (xpath != null) {
            try {       
              action.setXpath(SynapseXPathFactory.getSynapseXPath(actionElement, xpath_Q));
            } catch (JaxenException e) {
                handleException("Error while parsing the XPath expression: " + xpath, e);
            }
        } else if (value != null) {
            action.setValue(value);
        }

        String fragment = actionElement.getAttributeValue(ATT_FRAGMENT);
        if (fragment != null) {
            if (FRAGMENT_PROTOCOL.equals(fragment)) {
                action.setFragmentIndex(URIFragments.PROTOCOL);
            } else if (FRAGMENT_USER_INFO.equals(fragment)) {
                action.setFragmentIndex(URIFragments.USER_INFO);
            } else if (FRAGMENT_HOST.equals(fragment)) {
                action.setFragmentIndex(URIFragments.HOST);
            } else if (FRAGMENT_PORT.equals(fragment)) {
                action.setFragmentIndex(URIFragments.PORT);
            } else if (FRAGMENT_PATH.equals(fragment)) {
                action.setFragmentIndex(URIFragments.PATH);
            } else if (FRAGMENT_QUERY.equals(fragment)) {
                action.setFragmentIndex(URIFragments.QUERY);
            } else if (FRAGMENT_REF.equals(fragment)) {
                action.setFragmentIndex(URIFragments.REF);
            } else if (FRAGMENT_FULL_URI.equals(fragment)) {
                action.setFragmentIndex(URIFragments.FULL_URI);
            } else {
                handleException("Unknown URL fragment name: " + fragment);
            }
        }

        if (type != null) {
            if (ACTION_SET.equals(type)) {
                action.setActionType(RewriteAction.ACTION_SET);
            } else if (ACTION_APPEND.equals(type)) {
                action.setActionType(RewriteAction.ACTION_APPEND);
            } else if (ACTION_PREPEND.equals(type)) {
                action.setActionType(RewriteAction.ACTION_PREPEND);
            } else if (ACTION_REPLACE.equals(type)) {
                action.setActionType(RewriteAction.ACTION_REPLACE);
                String regex = actionElement.getAttributeValue(ATT_REGEX);
                if (regex != null) {
                    action.setRegex(regex);
                } else {
                    handleException("regex attribute is required for replace action");
                }
            } else if (ACTION_REMOVE.equals(type)) {
                action.setActionType(RewriteAction.ACTION_REMOVE);
            } else {
                handleException("Unknown URL rewrite action type: " + type);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.