Package org.apache.abdera.i18n.templates

Examples of org.apache.abdera.i18n.templates.HashMapContext


 
  @Test
  public void test13() throws Exception {
    String t = "http://www.google.com/search?q={term}";
    String e = "http://www.google.com/search?q=%C3%8E%C3%B1%C5%A3%C3%A9r%C3%B1%C3%A5%C5%A3%C3%AE%C3%B6%C3%B1%C3%A5%C4%BC%C3%AE%C5%BE%C3%A5%C5%A3%C3%AE%C3%B6%C3%B1";
    HashMapContext c = new HashMapContext();
    c.put("term","\u00ce\u00f1\u0163\u00e9\u0072\u00f1\u00e5\u0163\u00ee\u00f6\u00f1\u00e5\u013c\u00ee\u017e\u00e5\u0163\u00ee\u00f6\u00f1");
    eval(t,e,c);
  }
View Full Code Here


 
  @Test
  public void test14() throws Exception {
    String t = "{-opt|/-/|categories}{-listjoin|/|categories}";
    String e = "/-/A%7C-B/-C";
    HashMapContext c = new HashMapContext();
    c.put("categories", new String[] {"A|-B","-C"});
    eval(t,e,c);
  }
View Full Code Here

 
  @Test
  public void test15() throws Exception {
    String t = "http://www.google.com/notebook/feeds/{userID}{-prefix|/notebooks/|notebookID}{-opt|/-/|categories}{-listjoin|/|categories}?{-join|&|updated-min,updated-max,alt,start-index,max-results,entryID,orderby}";
    String e = "http://www.google.com/notebook/feeds/a/notebooks/b?updated-min=c&max-results=d";
    HashMapContext c = new HashMapContext();
    c.put("userID", "a");
    c.put("notebookID","b");
    c.put("updated-min","c");
    c.put("max-results", "d");
    eval(t,e,c);
  }
View Full Code Here

  @Test
  public void test16() throws Exception {
    String t = "http://www.google.com/search?q={term}";
    String e = "http://www.google.com/search?q=\u00ce\u00f1\u0163\u00e9\u0072\u00f1\u00e5\u0163\u00ee\u00f6\u00f1\u00e5\u013c\u00ee\u017e\u00e5\u0163\u00ee\u00f6\u00f1";
    HashMapContext c = new HashMapContext();
    c.setIri(true);
    c.put("term","\u00ce\u00f1\u0163\u00e9\u0072\u00f1\u00e5\u0163\u00ee\u00f6\u00f1\u00e5\u013c\u00ee\u017e\u00e5\u0163\u00ee\u00f6\u00f1");
    eval(t,e,c)// use the IriEvaluator so that pct-encoding is done correctly for IRI's
  }
View Full Code Here

 
  @Test
  public void test17() throws Exception {
    String t = new String("bar{-prefix|/é/|var}/".getBytes("UTF-8"),"UTF-8");
    String e = new String("bar/é/foo/".getBytes("UTF-8"),"UTF-8");
    HashMapContext c = new HashMapContext();
    c.setIri(true);
    c.put("var","foo");
    eval(t,e,c);
  }
View Full Code Here

    System.out.println(template.expand(map));
  }
 
  // Using a HashMap based context
  private static void exampleWithHashMapContext() {
    HashMapContext context = new HashMapContext();
    context.put("user","james");
    context.put("categories", new String[] {"a","b","c"});
    context.put("foo", "abc");
    context.put("bar", "xyz");   
    System.out.println(template.expand(context));
  }
View Full Code Here

TOP

Related Classes of org.apache.abdera.i18n.templates.HashMapContext

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.