Click here to Skip to main content
15,881,281 members
Articles / Web Development / IIS

xLibrary - Using a custom IHttpHandler to access embedded JavaScript

Rate me:
Please Sign up or sign in to vote.
4.33/5 (4 votes)
28 Feb 2009CPOL15 min read 44.6K   446   41  
This article covers how to make a custom IHttpHandler to use the X Library from www.cross-browser.com embedded in an assembly.
// xLibrary, Copyright (C) 2007 Brodrick Bassham.
//
// brodrick.bassham@gmail.com
//
// An ASP.net wrapper for X, a Cross-Browser Javascript Library, Distributed
// under the terms of the GNU LGPL.  See http://www.cross-browser.com/ for
// details on X.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//
//

using System;

namespace xLibrary
{
    /// <summary>
    /// A small helper object to store script information.
    /// </summary>
    public class xFunction
    {
        private string _name;
        private string _source;
        private string[] _dependencies;

        /// <summary>
        /// Initializes a new instance of <see cref="T:xLibrary.xFunction"/>.
        /// </summary>
        /// <param name="name">
        /// The name of the function to retrieve.
        /// </param>
        /// <param name="source">
        /// The actual function itself.
        /// </param>
        /// <param name="dependencies">
        /// The names of all the functions this one depends on.
        /// </param>
        public xFunction(string name, string source, string[] dependencies)
        {
            _name = name;
            _source = source;
            _dependencies = dependencies;
        }

        /// <summary>
        /// The name of the function to retrieve.
        /// </summary>
        public string Name
        {
            get
            {
                return _name;
            }
        }

        /// <summary>
        /// The actual function itself.
        /// </summary>
        public string Source
        {
            get
            {
                return _source;
            }
        }

        /// <summary>
        /// The names of all the functions this one depends on.
        /// </summary>
        public string[] Dependencies
        {
            get
            {
                return _dependencies;
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
I have been a software developer since 2005, focusing on .Net applications with MS SQL backends, and recently, C++ applications in Linux, Mac OS X, and Windows.

Comments and Discussions