⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 definitions.cs

📁 ajax patterns 这是关于ajax设计模式方面的原代码
💻 CS
字号:
/*
    Copyright 2006 Christian Gross http://www.devspace.com
    From the book Ajax Patterns and Best Practices

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
using System;
using System.Web;
using Devspace.Commons.Tracer;

namespace Devspace.Ajax.StateNavigation {
    
    public abstract class NavigationBase< type> : IHttpModule {
        protected StateManager _stateManager = new StateManager();
        protected string _resourceStateContentType;
        protected string _XPageState;
        protected string _XPageWindowName;
        protected string _URLStateIdentifier;
        protected int _URLStateIdentifierLength;
        protected string _XPageOriginalURL;
        
        public abstract type InitializeRequest();
        public abstract void DestroyRequest(type objData);
        public abstract bool IsTrigger(type objData, HttpRequest req, HttpResponse resp);
        public abstract void RunFilter(type objData, HttpRequest req, HttpResponse resp);
        
        public virtual void Init(HttpApplication context) {
            GenerateOutput.Write( "NavigationBase.Init", "Initialization");
                context.PreRequestHandlerExecute +=
                    new EventHandler(context_PreRequestHandlerExecute);
            _URLStateIdentifier = "/state";
            _URLStateIdentifierLength = _URLStateIdentifier.Length;
            _XPageState = "X-Page-State";
            _XPageWindowName = "X-Page-Window-Name";
            _XPageOriginalURL = "X-Page-Original-URL";
            _resourceStateContentType = "application/xml";
        }
        private void context_PreRequestHandlerExecute(object sender, EventArgs e) {
            GenerateOutput.Write( "NavigationBase.context_PreRequestHandlerExecute",
                                 ">>>> Start");
            HttpApplication app = (HttpApplication)sender;
            
            HttpRequest req = app.Context.Request;
            HttpResponse resp = app.Context.Response;
            type data = InitializeRequest();
            if (IsTrigger(data, req, resp)) {
                RunFilter(data, req, resp);
                app.CompleteRequest();
            }
            DestroyRequest(data);
            GenerateOutput.Write( "NavigationBase.context_PreRequestHandlerExecute",
                                 "<<<< End");
        }
        
        public virtual void Dispose() {
        }
    }
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -