Package net.sourceforge.urlrewriter4j.core.transforms

Examples of net.sourceforge.urlrewriter4j.core.transforms.StaticMappingTransform


        oMap.put(oFromValueNode.getNodeValue(), oToValueNode.getNodeValue());
      } else if (oNode.getNodeType() != Node.TEXT_NODE){
        throw new ConfigurationException(String.format(Messages.ELEMENT_NOTALLOWED, oNode.getNodeName()));
      }
    }
    pConfig.getTransformFactory().addTransform(new StaticMappingTransform(oNameNode.getNodeValue(), oMap));
  }
View Full Code Here


      StringDictionnary oMap = new StringDictionnary();
      for (char c = 'a'; c <= 'z'; c++)
      {
        oMap.put(Character.toString(c), "" + ((int)c));
      }
      IRewriteTransform oTx = new StaticMappingTransform("name", oMap);
      assertEquals("99", oTx.applyTransform("c"));
      assertEquals("97", oTx.applyTransform("a"));
      assertEquals("98", oTx.applyTransform("B"));
    }
View Full Code Here

    mEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/rewritten-.html");
  }
 
  public void testReduceMapAndQueryStringParam() throws Exception {
    StaticMappingTransform oMapTx = createCategoryTransformation();
    mConfiguration.getTransformFactory().addTransform(oMapTx);
   
    ConditionalAction oAction = createUrlConditionAndRewirteAction("/rewritten-${catMap:$(category)}.html", "/test.aspx.*");
    mConfiguration.getRules().add(oAction);
   
 
View Full Code Here

    mEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/rewritten-TV-Laptop-Desktop-Monitor-MP3-iPod.html");
  }
 
  public void testReduceMapWithDefaultAndQueryStringParam() throws Exception {
    StaticMappingTransform oMapTx = createCategoryTransformation();
    mConfiguration.getTransformFactory().addTransform(oMapTx);
   
    ConditionalAction oAction = createUrlConditionAndRewirteAction("/rewritten-${catMap:$(category)|DVD}.html", "/test.aspx.*");
    mConfiguration.getRules().add(oAction);
   
 
View Full Code Here

  }

  private StaticMappingTransform createCategoryTransformation() {
    Map<String, String> oCatMap = new HashMap<String, String>();
    oCatMap.put("electronics", "TV-Laptop-Desktop-Monitor-MP3-iPod");
    StaticMappingTransform oMapTx = new StaticMappingTransform("catMap", oCatMap);
    return oMapTx;
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.urlrewriter4j.core.transforms.StaticMappingTransform

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.