/// <summary> /// Sets a <see cref="FileRequestHandlerCallback"/> that is called by a module whenever /// the requested URL path has been mapped to a directory, but directory listing has been /// disabled. /// </summary> /// <typeparam name="TModule">The type of the module on which this method is called.</typeparam> /// <param name="this">The module on which this method is called.</param> /// <param name="callback">The method to call.</param> /// <returns><paramref name="this"/> with its <see cref="FileModule.OnDirectoryNotListable">OnDirectoryNotListable</see> property /// set to <paramref name="callback"/>.</returns> /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception> /// <exception cref="InvalidOperationException">The configuration of <paramref name="this"/> is locked.</exception> /// <exception cref="ArgumentNullException"><paramref name="callback"/> is <see langword="null"/>.</exception> /// <seealso cref="FileModule.OnDirectoryNotListable"/> /// <seealso cref="FileRequestHandler"/> public static TModule HandleDirectoryNotListable <TModule>(this TModule @this, FileRequestHandlerCallback callback) where TModule : FileModule { @this.OnDirectoryNotListable = callback; return(@this); }
/// <summary> /// Sets a <see cref="FileRequestHandlerCallback"/> that is called by a module whenever /// the requested URL path has been mapped to a file or directory, but the request's /// HTTP method is neither <c>GET</c> nor <c>HEAD</c>. /// </summary> /// <typeparam name="TModule">The type of the module on which this method is called.</typeparam> /// <param name="this">The module on which this method is called.</param> /// <param name="callback">The method to call.</param> /// <returns><paramref name="this"/> with its <see cref="FileModule.OnMethodNotAllowed">OnMethodNotAllowed</see> property /// set to <paramref name="callback"/>.</returns> /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception> /// <exception cref="InvalidOperationException">The configuration of <paramref name="this"/> is locked.</exception> /// <exception cref="ArgumentNullException"><paramref name="callback"/> is <see langword="null"/>.</exception> /// <seealso cref="FileModule.OnMethodNotAllowed"/> /// <seealso cref="FileRequestHandler"/> public static TModule HandleMethodNotAllowed <TModule>(this TModule @this, FileRequestHandlerCallback callback) where TModule : FileModule { @this.OnMethodNotAllowed = callback; return(@this); }
/// <summary> /// Sets a <see cref="FileRequestHandlerCallback"/> that is called by a module whenever /// the requested URL path could not be mapped to any file or directory. /// </summary> /// <typeparam name="TModule">The type of the module on which this method is called.</typeparam> /// <param name="this">The module on which this method is called.</param> /// <param name="callback">The method to call.</param> /// <returns><paramref name="this"/> with its <see cref="FileModule.OnMappingFailed">OnMappingFailed</see> property /// set to <paramref name="callback"/>.</returns> /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception> /// <exception cref="InvalidOperationException">The configuration of <paramref name="this"/> is locked.</exception> /// <exception cref="ArgumentNullException"><paramref name="callback"/> is <see langword="null"/>.</exception> /// <seealso cref="FileModule.OnMappingFailed"/> /// <seealso cref="FileRequestHandler"/> public static TModule HandleMappingFailed <TModule>(this TModule @this, FileRequestHandlerCallback callback) where TModule : FileModule { @this.OnMappingFailed = callback; return(@this); }