Exemplo n.º 1
0
 private void RegisterConfigureCallback()
 {
     if (_ConfigureCallbackHandle == null)
     {
         _ConfigureCallbackHandle = _WebAppConfiguration.AddCallback(AddShimMiddleware, StandardPipelinePriority.ShimServerPriority);
     }
 }
Exemplo n.º 2
0
 private void RegisterConfigureCallback()
 {
     if (_ConfigureCallbackHandle == null)
     {
         _ConfigureCallbackHandle = _WebAppConfiguration.AddCallback(AddShimMiddleware, priority: 10000);
     }
 }
Exemplo n.º 3
0
        public void TestInitialise()
        {
            _Snapshot            = Factory.TakeSnapshot();
            _SharedConfiguration = TestUtilities.CreateMockSingleton <ISharedConfiguration>();
            _Configuration       = new Configuration();
            _SharedConfiguration.Setup(r => r.Get()).Returns(_Configuration);
            _UserManager = TestUtilities.CreateMockSingleton <IUserManager>();

            _RemoteIpAddress           = "127.0.0.1";
            _AccessFilter              = MockAccessFilter.CreateAndRegister();
            _BasicAuthenticationFilter = MockBasicAuthenticationFilter.CreateAndRegister();
            _RedirectionFilter         = MockRedirectionFilter.CreateAndRegister();

            _WebAppConfiguration = Factory.Singleton.Resolve <IWebAppConfiguration>();
            _WebAppConfiguration.AddCallback(UsetTestEnvironmentSetup, StandardPipelinePriority.Access - 1);
            _WebAppConfiguration.AddCallback(ConfigureHttpConfiguration, StandardPipelinePriority.WebApiConfiguration);
            _WebAppConfiguration.AddCallback(UseWebApi, StandardPipelinePriority.WebApi);

            ExtraInitialise();

            _Server = TestServer.Create(app => {
                _WebAppConfiguration.Configure(app);
            });
        }
Exemplo n.º 4
0
 private void AddCallback(Func <IDictionary <string, object>, bool> callNextMiddleware)
 {
     _WebAppConfiguration.AddCallback((IAppBuilder app) => {
         var middleware = new Func <AppFunc, AppFunc>((AppFunc next) => {
             AppFunc result = async(IDictionary <string, object> env) => {
                 if (callNextMiddleware(env))
                 {
                     await next.Invoke(env);
                 }
             };
             return(result);
         });
         app.Use(middleware);
     }, 0);
 }
Exemplo n.º 5
0
 /// <summary>
 /// See interface docs.
 /// </summary>
 /// <param name="webAppConfiguration"></param>
 public void Register(IWebAppConfiguration webAppConfiguration)
 {
     webAppConfiguration.AddCallback(UseWebRequestMiddleware, StandardPipelinePriority.HighestVrsContentMiddlewarePriority + 1000);
 }
Exemplo n.º 6
0
 public void WebAppConfiguration_AddCallback_Throws_If_Passed_Null()
 {
     _Configuration.AddCallback(null, 0);
 }
Exemplo n.º 7
0
        /// <summary>
        /// See interface.
        /// </summary>
        /// <param name="webAppConfiguration"></param>
        public void Register(IWebAppConfiguration webAppConfiguration)
        {
            _WebAppConfiguration = webAppConfiguration;

            webAppConfiguration.AddCallback(UseExceptionHandler, StandardPipelinePriority.Exception);
            webAppConfiguration.AddCallback(UseAccessFilter, StandardPipelinePriority.Access);
            webAppConfiguration.AddCallback(UseBasicAuthenticationFilter, StandardPipelinePriority.Authentication);
            webAppConfiguration.AddCallback(UseRedirectionFilter, StandardPipelinePriority.Redirection);
            webAppConfiguration.AddCallback(UseCorsHandler, StandardPipelinePriority.Cors);
            webAppConfiguration.AddCallback(UseResponseStreamWrapper, StandardPipelinePriority.ResponseStreamWrapper);

            webAppConfiguration.AddCallback(ConfigureHttpConfiguration, StandardPipelinePriority.WebApiConfiguration);
            webAppConfiguration.AddCallback(UseWebApi, StandardPipelinePriority.WebApi);

            webAppConfiguration.AddCallback(UseBundlerServer, StandardPipelinePriority.BundlerServer);
            webAppConfiguration.AddCallback(UseFileSystemServer, StandardPipelinePriority.FileSystemServer);
            webAppConfiguration.AddCallback(UseImageServer, StandardPipelinePriority.ImageServer);
            webAppConfiguration.AddCallback(UseAudioServer, StandardPipelinePriority.AudioServer);

            webAppConfiguration.AddStreamManipulator(Factory.Resolve <IHtmlManipulator>(), StreamManipulatorPriority.HtmlManipulator);
            webAppConfiguration.AddStreamManipulator(Factory.Resolve <IJavascriptManipulator>(), StreamManipulatorPriority.JavascriptManipulator);

            var htmlManipulatorConfiguration = Factory.ResolveSingleton <IHtmlManipulatorConfiguration>();

            htmlManipulatorConfiguration.AddTextResponseManipulator <IMapPluginHtmlManipulator>();
            htmlManipulatorConfiguration.AddTextResponseManipulator <IBundlerHtmlManipulator>();
        }
Exemplo n.º 8
0
        /// <summary>
        /// See interface.
        /// </summary>
        /// <param name="webAppConfiguration"></param>
        public void Register(IWebAppConfiguration webAppConfiguration)
        {
            if (_WebAppConfiguration != null)
            {
                throw new InvalidOperationException("You can only call IStandardPipeline.Register() once per object");
            }

            _WebAppConfiguration = webAppConfiguration;

            webAppConfiguration.AddCallback(UseExceptionHandler, StandardPipelinePriority.Exception);
            webAppConfiguration.AddCallback(UseAccessFilter, StandardPipelinePriority.Access);
            webAppConfiguration.AddCallback(UseBasicAuthenticationFilter, StandardPipelinePriority.Authentication);
            webAppConfiguration.AddCallback(UseRedirectionFilter, StandardPipelinePriority.Redirection);
            webAppConfiguration.AddCallback(UseCorsHandler, StandardPipelinePriority.Cors);
            webAppConfiguration.AddCallback(UseResponseStreamWrapper, StandardPipelinePriority.ResponseStreamWrapper);

            webAppConfiguration.AddCallback(ConfigureHttpConfiguration, StandardPipelinePriority.WebApiConfiguration);
            webAppConfiguration.AddCallback(UseWebApi, StandardPipelinePriority.WebApi);

            webAppConfiguration.AddCallback(UseBundlerServer, StandardPipelinePriority.BundlerServer);
            webAppConfiguration.AddCallback(UseFileSystemServer, StandardPipelinePriority.FileSystemServer);
            webAppConfiguration.AddCallback(UseImageServer, StandardPipelinePriority.ImageServer);
            webAppConfiguration.AddCallback(UseAudioServer, StandardPipelinePriority.AudioServer);

            webAppConfiguration.AddStreamManipulator(Factory.Singleton.Resolve <IHtmlManipulator>(), StreamManipulatorPriority.HtmlManipulator);
            webAppConfiguration.AddStreamManipulator(Factory.Singleton.Resolve <IJavascriptManipulator>(), StreamManipulatorPriority.JavascriptManipulator);

            Factory.Singleton.Resolve <IHtmlManipulatorConfiguration>().AddTextResponseManipulator <IBundlerHtmlManipulator>();
        }