Ejemplo n.º 1
0
 /// <summary>
 /// Adds a handler to a <see cref="RoutingModule"/>.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="verb">A <see cref="HttpVerbs"/> constant representing the HTTP method
 /// to associate with <paramref name="handler"/>, or <see cref="HttpVerbs.Any"/>
 /// if <paramref name="handler"/> can handle all HTTP methods.</param>
 /// <param name="route">The route to match URL paths against.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="route"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="FormatException"><paramref name="route"/> is not a valid route.</exception>
 /// <seealso cref="RoutingModule.Add(HttpVerbs,RouteMatcher,RouteHandlerCallback)"/>
 public static RoutingModule Handle(this RoutingModule @this, HttpVerbs verb, string route, RouteHandlerCallback handler)
 {
     @this.Add(verb, RouteMatcher.Parse(route, false), handler);
     return(@this);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Associates all requests matching a route to a synchronous handler.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="route">The route to match URL paths against.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="route"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="FormatException"><paramref name="route"/> is not a valid route.</exception>
 public static RoutingModule OnAny(this RoutingModule @this, string route, SyncRouteHandlerCallback handler)
 {
     @this.Add(HttpVerbs.Any, RouteMatcher.Parse(route, false), handler);
     return(@this);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// <para>Adds handlers, associating them with HTTP method / route pairs by means
 /// of <see cref="RouteAttribute">Route</see> attributes.</para>
 /// <para>See <see cref="RouteVerbResolverCollection.AddFrom(object)"/> for further information.</para>
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="target">Where to look for compatible handlers.</param>
 /// <returns><paramref name="this"/> with handlers added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="target"/> is <see langword="null"/>.</exception>
 public static RoutingModule WithHandlersFrom(this RoutingModule @this, object target)
 {
     @this.AddFrom(target);
     return(@this);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Associates all requests matching a route to a handler.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="route">The route to match URL paths against.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="route"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="FormatException"><paramref name="route"/> is not a valid route.</exception>
 public static RoutingModule OnAny(this RoutingModule @this, string route, RouteHandlerCallback handler)
 {
     @this.Add(HttpVerbs.Any, route, handler);
     return(@this);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Associates <c>POST</c> requests matching a route to a synchronous handler.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="route">The route to match URL paths against.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="route"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="FormatException"><paramref name="route"/> is not a valid route.</exception>
 public static RoutingModule OnPost(this RoutingModule @this, string route, SyncRouteHandlerCallback handler)
 {
     @this.Add(HttpVerbs.Post, route, handler);
     return(@this);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Adds a synchronous handler to a <see cref="RoutingModule"/>.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="verb">A <see cref="HttpVerbs"/> constant representing the HTTP method
 /// to associate with <paramref name="handler"/>, or <see cref="HttpVerbs.Any"/>
 /// if <paramref name="handler"/> can handle all HTTP methods.</param>
 /// <param name="route">The route to match URL paths against.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="route"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="FormatException"><paramref name="route"/> is not a valid route.</exception>
 /// <seealso cref="RoutingModule.Add(HttpVerbs,string,SyncRouteHandlerCallback)"/>
 public static RoutingModule Handle(this RoutingModule @this, HttpVerbs verb, string route, SyncRouteHandlerCallback handler)
 {
     @this.Add(verb, route, handler);
     return(@this);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Adds a synchronous handler to a <see cref="RoutingModule"/>.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="verb">A <see cref="HttpVerb"/> constant representing the HTTP method
 /// to associate with <paramref name="handler"/>, or <see cref="HttpVerb.Any"/>
 /// if <paramref name="handler"/> can handle all HTTP methods.</param>
 /// <param name="matcher">The <see cref="RouteMatcher"/> used to match URL paths.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="matcher"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <seealso cref="RoutingModule.Add(HttpVerb,RouteMatcher,SyncRouteHandlerCallback)"/>
 public static RoutingModule Handle(this RoutingModule @this, HttpVerb verb, RouteMatcher matcher, SyncRouteHandlerCallback handler)
 {
     @this.Add(verb, matcher, handler);
     return(@this);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Associates all requests matching a route to a synchronous handler.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="matcher">The <see cref="RouteMatcher"/> used to match URL paths.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="matcher"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 public static RoutingModule OnAny(this RoutingModule @this, RouteMatcher matcher, SyncRouteHandlerCallback handler)
 {
     @this.Add(HttpVerb.Any, matcher, handler);
     return(@this);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Associates <c>OPTIONS</c> requests matching a route to a handler.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="matcher">The <see cref="RouteMatcher"/> used to match URL paths.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="matcher"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 public static RoutingModule OnOptions(this RoutingModule @this, RouteMatcher matcher, RouteHandlerCallback handler)
 {
     @this.Add(HttpVerb.Options, matcher, handler);
     return(@this);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Associates <c>OPTIONS</c> requests matching a route to a handler.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="route">The route to match URL paths against.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="route"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="FormatException"><paramref name="route"/> is not a valid route.</exception>
 public static RoutingModule OnOptions(this RoutingModule @this, string route, RouteHandlerCallback handler)
 {
     @this.Add(HttpVerb.Options, RouteMatcher.Parse(route, false), handler);
     return(@this);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Associates <c>POST</c> requests matching a route to a handler.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="matcher">The <see cref="RouteMatcher"/> used to match URL paths.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="matcher"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 public static RoutingModule OnPost(this RoutingModule @this, RouteMatcher matcher, RouteHandlerCallback handler)
 {
     @this.Add(HttpVerbs.Post, matcher, handler);
     return(@this);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Associates all requests matching a route to a handler.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="route">The route to match URL paths against.</param>
 /// <param name="isBaseRoute"><see langword="true"/> if <paramref name="route"/>
 /// is a base route; <see langword="false"/> if <paramref name="route"/>
 /// is a terminal (non-base) route.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="route"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="FormatException"><paramref name="route"/> is not a valid route.</exception>
 public static RoutingModule OnAny(this RoutingModule @this, string route, bool isBaseRoute, RouteHandlerCallback handler)
 {
     @this.Add(HttpVerb.Any, RouteMatcher.Parse(route, isBaseRoute), handler);
     return(@this);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Adds a synchronous handler to a <see cref="RoutingModule"/>.
 /// </summary>
 /// <param name="this">The <see cref="RoutingModule"/> on which this method is called.</param>
 /// <param name="verb">A <see cref="HttpVerb"/> constant representing the HTTP method
 /// to associate with <paramref name="handler"/>, or <see cref="HttpVerb.Any"/>
 /// if <paramref name="handler"/> can handle all HTTP methods.</param>
 /// <param name="route">The route to match URL paths against.</param>
 /// <param name="isBaseRoute"><see langword="true"/> if <paramref name="route"/>
 /// is a base route; <see langword="false"/> if <paramref name="route"/>
 /// is a terminal (non-base) route.</param>
 /// <param name="handler">A callback used to handle matching contexts.</param>
 /// <returns><paramref name="this"/> with the handler added.</returns>
 /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException">
 /// <para><paramref name="route"/> is <see langword="null"/>.</para>
 /// <para>- or -</para>
 /// <para><paramref name="handler"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="FormatException"><paramref name="route"/> is not a valid route.</exception>
 /// <seealso cref="RoutingModule.Add(HttpVerb,RouteMatcher,RouteHandlerCallback)"/>
 public static RoutingModule Handle(this RoutingModule @this, HttpVerb verb, string route, bool isBaseRoute, SyncRouteHandlerCallback handler)
 {
     @this.Add(verb, RouteMatcher.Parse(route, isBaseRoute), handler);
     return(@this);
 }