Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NancyEngine"/> class.
        /// </summary>
        /// <param name="dispatcher">An <see cref="IRouteResolver"/> instance that will be used to resolve a route, from the modules, that matches the incoming <see cref="Request"/>.</param>
        /// <param name="contextFactory">A factory for creating contexts</param>
        /// <param name="statusCodeHandlers">Error handlers</param>
        /// <param name="requestTracing">The request tracing instance.</param>
        /// <param name="diagnosticsConfiguration"></param>
        /// <param name="staticContentProvider">The provider to use for serving static content</param>
        public NancyEngine(IRequestDispatcher dispatcher, INancyContextFactory contextFactory, IEnumerable<IStatusCodeHandler> statusCodeHandlers, IRequestTracing requestTracing, DiagnosticsConfiguration diagnosticsConfiguration, IStaticContentProvider staticContentProvider)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher", "The resolver parameter cannot be null.");
            }

            if (contextFactory == null)
            {
                throw new ArgumentNullException("contextFactory");
            }

            if (statusCodeHandlers == null)
            {
                throw new ArgumentNullException("statusCodeHandlers");
            }

            if (requestTracing == null)
            {
                throw new ArgumentNullException("requestTracing");
            }

            if (staticContentProvider == null)
            {
                throw new ArgumentNullException("staticContentProvider");
            }

            this.dispatcher = dispatcher;
            this.contextFactory = contextFactory;
            this.statusCodeHandlers = statusCodeHandlers;
            this.requestTracing = requestTracing;
            this.diagnosticsConfiguration = diagnosticsConfiguration;
            this.staticContentProvider = staticContentProvider;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NancyEngine"/> class.
        /// </summary>
        /// <param name="dispatcher">An <see cref="IRouteResolver"/> instance that will be used to resolve a route, from the modules, that matches the incoming <see cref="Request"/>.</param>
        /// <param name="contextFactory">A factory for creating contexts</param>
        /// <param name="statusCodeHandlers">Error handlers</param>
        /// <param name="requestTracing">The request tracing instance.</param>
        /// <param name="diagnosticsConfiguration"></param>
        /// <param name="staticContentProvider">The provider to use for serving static content</param>
        public NancyEngine(IRequestDispatcher dispatcher, INancyContextFactory contextFactory, IEnumerable <IStatusCodeHandler> statusCodeHandlers, IRequestTracing requestTracing, DiagnosticsConfiguration diagnosticsConfiguration, IStaticContentProvider staticContentProvider)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher", "The resolver parameter cannot be null.");
            }

            if (contextFactory == null)
            {
                throw new ArgumentNullException("contextFactory");
            }

            if (statusCodeHandlers == null)
            {
                throw new ArgumentNullException("statusCodeHandlers");
            }

            if (requestTracing == null)
            {
                throw new ArgumentNullException("requestTracing");
            }

            if (staticContentProvider == null)
            {
                throw new ArgumentNullException("staticContentProvider");
            }

            this.dispatcher               = dispatcher;
            this.contextFactory           = contextFactory;
            this.statusCodeHandlers       = statusCodeHandlers;
            this.requestTracing           = requestTracing;
            this.diagnosticsConfiguration = diagnosticsConfiguration;
            this.staticContentProvider    = staticContentProvider;
        }
Пример #3
0
        public HybridEngine ConfigureStaticContentProvider(IStaticContentProvider staticContentProvider)
        {
            if (staticContentProvider == null)
            {
                throw new ArgumentNullException("staticContentProvider");
            }

            _staticContentProvider = staticContentProvider;

            return(this);
        }
 public NancyEngineWithAsyncCancellation(
     IRequestDispatcher requestDispatcher,
     INancyContextFactory nancyContextFactory,
     IEnumerable <IStatusCodeHandler> statusCodeHandlers,
     IRequestTracing requestTracing,
     DiagnosticsConfiguration diagnosticsConfiguration,
     IStaticContentProvider staticContentProvider)
 {
     this.engine = new NancyEngine(
         requestDispatcher,
         nancyContextFactory,
         statusCodeHandlers,
         requestTracing,
         diagnosticsConfiguration,
         staticContentProvider);
 }
		public NancyEngineWithAsyncCancellation(
			IRequestDispatcher requestDispatcher,
			INancyContextFactory nancyContextFactory,
			IEnumerable<IStatusCodeHandler> statusCodeHandlers,
			IRequestTracing requestTracing,
			DiagnosticsConfiguration diagnosticsConfiguration,
			IStaticContentProvider staticContentProvider)
		{
			this.engine = new NancyEngine(
				requestDispatcher,
				nancyContextFactory,
				statusCodeHandlers,
				requestTracing,
				diagnosticsConfiguration,
				staticContentProvider);
		}
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NancyEngine"/> class.
        /// </summary>
        /// <param name="dispatcher">An <see cref="IRouteResolver"/> instance that will be used to resolve a route, from the modules, that matches the incoming <see cref="Request"/>.</param>
        /// <param name="contextFactory">A factory for creating contexts</param>
        /// <param name="statusCodeHandlers">Error handlers</param>
        /// <param name="requestTracing">The request tracing instance.</param>
        /// <param name="staticContentProvider">The provider to use for serving static content</param>
        /// <param name="negotiator">The response negotiator.</param>
        /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param>
        public NancyEngine(IRequestDispatcher dispatcher,
            INancyContextFactory contextFactory,
            IEnumerable<IStatusCodeHandler> statusCodeHandlers,
            IRequestTracing requestTracing,
            IStaticContentProvider staticContentProvider,
            IResponseNegotiator negotiator,
            INancyEnvironment environment)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher", "The resolver parameter cannot be null.");
            }

            if (contextFactory == null)
            {
                throw new ArgumentNullException("contextFactory");
            }

            if (statusCodeHandlers == null)
            {
                throw new ArgumentNullException("statusCodeHandlers");
            }

            if (requestTracing == null)
            {
                throw new ArgumentNullException("requestTracing");
            }

            if (staticContentProvider == null)
            {
                throw new ArgumentNullException("staticContentProvider");
            }

            if (negotiator == null)
            {
                throw new ArgumentNullException("negotiator");
            }

            this.dispatcher = dispatcher;
            this.contextFactory = contextFactory;
            this.statusCodeHandlers = statusCodeHandlers.ToArray();
            this.requestTracing = requestTracing;
            this.staticContentProvider = staticContentProvider;
            this.negotiator = negotiator;
            this.engineDisposedCts = new CancellationTokenSource();
            this.traceConfiguration = environment.GetValue<TraceConfiguration>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NancyEngine"/> class.
        /// </summary>
        /// <param name="dispatcher">An <see cref="IRouteResolver"/> instance that will be used to resolve a route, from the modules, that matches the incoming <see cref="Request"/>.</param>
        /// <param name="contextFactory">A factory for creating contexts</param>
        /// <param name="statusCodeHandlers">Error handlers</param>
        /// <param name="requestTracing">The request tracing instance.</param>
        /// <param name="staticContentProvider">The provider to use for serving static content</param>
        /// <param name="negotiator">The response negotiator.</param>
        /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param>
        public NancyEngine(IRequestDispatcher dispatcher,
                           INancyContextFactory contextFactory,
                           IEnumerable <IStatusCodeHandler> statusCodeHandlers,
                           IRequestTracing requestTracing,
                           IStaticContentProvider staticContentProvider,
                           IResponseNegotiator negotiator,
                           INancyEnvironment environment)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher", "The resolver parameter cannot be null.");
            }

            if (contextFactory == null)
            {
                throw new ArgumentNullException("contextFactory");
            }

            if (statusCodeHandlers == null)
            {
                throw new ArgumentNullException("statusCodeHandlers");
            }

            if (requestTracing == null)
            {
                throw new ArgumentNullException("requestTracing");
            }

            if (staticContentProvider == null)
            {
                throw new ArgumentNullException("staticContentProvider");
            }

            if (negotiator == null)
            {
                throw new ArgumentNullException("negotiator");
            }

            this.dispatcher            = dispatcher;
            this.contextFactory        = contextFactory;
            this.statusCodeHandlers    = statusCodeHandlers.ToArray();
            this.requestTracing        = requestTracing;
            this.staticContentProvider = staticContentProvider;
            this.negotiator            = negotiator;
            this.engineDisposedCts     = new CancellationTokenSource();
            this.traceConfiguration    = environment.GetValue <TraceConfiguration>();
        }