HTTPPath class

Binds a route variable from HTTPRequestPath.variables to an HTTPController responder method argument.

Routes may have path variables, e.g., a route declared as follows has a path variable named 'id':

    router.route("/users/[:id]");

HTTPController responder methods may bind path variables to their arguments with this metadata. A responder method is invoked if it has exactly the same path bindings as the incoming request's path variables. For example, consider the above route and a controller with the following responder methods:

    class UserController extends HTTPController {
      @httpGet
      Future<Response> getUsers() async => new Response.ok(getAllUsers());
      @httpGet
      Future<Response> getOneUser(@HTTPPath("id") int id) async => new Response.ok(getUser(id));
    }

If the request path is /users/1, /users/2, etc., getOneUser is invoked because the path variable id is present and matches the HTTPPath argument. If no path variables are present, getUsers is invoked.

Constructors

HTTPPath(String segment)
Binds a route variable from HTTPRequestPath.variables to an HTTPController responder method argument. [...]
const

Properties

type String
read-only
externalName String
The name of the variable in the HTTP request.
final, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

parse(ClassMirror intoType, Request request) → dynamic
convertParameterListWithMirror(List<String> parameterValues, TypeMirror typeMirror) → dynamic
inherited
convertParameterWithMirror(String parameterValue, TypeMirror typeMirror) → dynamic
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited