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

📄 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.Web;
using System;

namespace Devspace.Ajax
{
    /// <summary>
    /// IURLRewriter: Is the access class used to access whether or
    /// not a URL can be rewritten
    /// </summary>
    public interface IURLRewriter {
        /// <summary>
        /// Method IsResource
        /// Used to test whether or not a URL is a resource
        /// </summary>
        /// <returns>A bool</returns>
        /// <param name="request">A  HttpRequest</param>
        bool IsResource(HttpRequest request);
        /// <summary>
        /// Method WriteRepresentation
        /// Used to convert a resource into a representation.
        /// Note: In Ajax patterns book this was called WriteRedirection
        /// </summary>
        /// <param name="request">A  HttpRequest</param>
        void WriteRepresentation( HttpRequest request);
    }

    /// <summary>
    /// URLRewriterBase: Base helper class used to implement the IRewriter interface
    /// </summary>
    public abstract class URLRewriterBase : IURLRewriter {
        protected IRewriter _defaultRewriter;
        
        public URLRewriterBase( IRewriter rewriter) {
            if( rewriter == null) {
                throw new NullReferenceException( "IRewriter instance cannot be null");
            }
            _defaultRewriter = rewriter;
        }
        public abstract bool IsResource(HttpRequest request);
        public abstract void WriteRepresentation(HttpRequest request);
    }
    
    
    /// <summary>
    /// IRewriter: Actual URL rewriting interface
    /// </summary>
    [Obsolete( "Will be removed in the next refactoring as the Java implementation illustrated this definition is not necessary")]
    public interface IRewriter {
        /// <summary>
        /// Method WriteRedirection
        /// If possible rewrites the URL request based on the mime type
        /// </summary>
        /// <returns>A bool</returns>
        /// <param name="mimetype">A  string</param>
        bool WriteRedirection(string mimetype);
    }
    
    
}

⌨️ 快捷键说明

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