addRouteWithParameters

addRouteWithParameters(meth:       String; 
                       path:       String; 
                       cls:        Class; 
                       parameters: ParamListType) typeMethod;

The addRouteWithParameters method of the Orb class adds the class specified by the cls parameter as a route with the HTTP method and URL path specified by the meth and path parameters, respectively. The parameters parameter specifies additional optional parameters that are passed in the URL path rather than the query string.

Each of the additional parameters must be a string, representing the name of a property on the specified associated route class.

When the route is invoked, any parameters provided in the URL are assigned to properties on the object, based on the order in which they are passed in the parameters list. For example:

  1. If a route is added with the following method call.

    addRouteWithParameters("GET", "/account", AccountRoute, "id", "action");
  2. When this route is invoked by the URL /account/42/edit.

  3. On the created instance of the AccountRoute class, the "id" property is set to 42 and the "action" property is set to "edit".

    Using standard routes, this would be equivalent to /account?id=42&action=edit.