Updated URI Template Implementation (based on
http://tools.ietf.org/html/draft-gregorio-uritemplate-06)
-------------------------------------------------------------------------------------------------------
Key: ABDERA-287
URL: https://issues.apache.org/jira/browse/ABDERA-287
Project: Abdera
Issue Type: Improvement
Reporter: James M Snell
Attachments: uritemplate_update.txt
Updated URI Template implementation based on the latest version of the URI
Templates specification.
http://tools.ietf.org/html/draft-gregorio-uritemplate-06
This is NOT a drop in replacement for the existing URI Template implementation.
The URI Template spec has changed significantly.
Example:
HashMap<String,String> map = new HashMap<String,String>();
map.put("semi",";");
map.put("dot",".");
map.put("comma",",");
HashMap<String,Object> context = new HashMap<String,Object>();
context.put("dom","example.com");
context.put("dub","me/too");
//context.put("foo","That's right!");
context.put("hello","Hello World!");
context.put("half","50%");
context.put("var","value");
context.put("who","fred");
context.put("base","http://example.com/home/");
context.put("path","/foo/bar");
context.put("list", new String[] {"red", "green", "blue"});
context.put("keys", map);
context.put("v",6);
context.put("x",1024);
context.put("y",768);
context.put("empty","");
context.put("empty_keys",new HashMap<String,String>());
context.put("foo", CharBuffer.wrap("That's right!"));
Template template =
new
Template("http://www{.list*}{/list*}{?foo,var,hello}{&half,x,y}#{var}");
System.out.println(template.expand(context));
Expands to:
http://www.red.green.blue/red/green/blue?foo=That%27s%20right%21&var=value&hello=Hello%20World%21&half=50%25&x=1024&y=768#value
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira