Skip to content

Mapping a URI to JSON

okram edited this page Sep 14, 2010 · 14 revisions

Up to this point, it has been assumed that a parametrized URI is the input to a traversal. While this is true, the URI is actually converted into a JSON object and that serves as the primary object by which the traversal code can retrieve its parameters from. The mapping between a URI and JSON is described using an example.

http://localhost:8182/toy-traversal?a=1&b.a=marko&b.b=true&b.c.a=peter
{
  a : 1,
  b : {
    a : "marko",
    b : true,
    c : {
      a : "peter"
    }
  }
}

The AbstractTraversal.requestObject is generated from the query parameter component of the URI request.

Clone this wiki locally