<commit_before>﻿/* Copyright 2009 dotless project, http://www.dotlesscss.com
 * 
 * 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. */

namespace dotless.Core
{
    using System.Web;
    using Abstractions;
    using configuration;

    public class LessCssHttpHandler : IHttpHandler
    {
        private readonly EngineFactory _engineFactory = new EngineFactory();

        public void ProcessRequest(HttpContext context)
        {
            var config = ConfigurationLoader.GetConfigurationFromWebconfig();
            var engine = _engineFactory.GetEngine(config);
            var cache = new CssCache(context.Cache);
            var provider = new PathProvider(context.Server);
            var request = new Request(context.Request);
            var response = new CssResponse(context.Response);
            var handler = new HandlerImpl();
            handler.Execute(cache, provider, request, response, config, engine);
        }

        public bool IsReusable
        {
            get { return true; }
        }
    }
}<commit_msg>Started registration of components<commit_after>﻿/* Copyright 2009 dotless project, http://www.dotlesscss.com
 * 
 * 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. */

namespace dotless.Core
{
    using System.Web;
    using System.Web.Caching;
    using Abstractions;
    using configuration;
    using Microsoft.Practices.ServiceLocation;
    using Pandora;

    public class LessCssHttpHandler : IHttpHandler
    {
        private readonly EngineFactory _engineFactory = new EngineFactory();

        public void ProcessRequest(HttpContext context)
        {
            var config = ConfigurationLoader.GetConfigurationFromWebconfig();
            var engine = _engineFactory.GetEngine(config);
            var cache = new CssCache(context.Cache);
            var provider = new PathProvider(context.Server);
            var request = new Request(context.Request);
            var response = new CssResponse(context.Response);
            var handler = new HandlerImpl();
            handler.Execute(cache, provider, request, response, config, engine);
        }

        public bool IsReusable
        {
            get { return true; }
        }
    }

    public class ContainerFactory
    {
        public IServiceLocator GetContainer()
        {
            var container = new PandoraContainer();
            //ASP.NET Services
            container.Register(p => {
                                        p.Service<Cache>()
                                            .Instance(HttpContext.Current.Cache);
                                        p.Service<HttpServerUtility>()
                                            .Instance(HttpContext.Current.Server);
                                        p.Service<HttpRequest>()
                                            .Instance(HttpContext.Current.Request);
                                        p.Service<HttpResponse>()
                                            .Instance(HttpContext.Current.Response);
            });
            container.Register(p =>
                                   {
                                       p.Service<ICache>()
                                           .Implementor<CssCache>();
                                       p.Service<IPathProvider>()
                                           .Implementor<PathProvider>();
                                       p.Service<IRequest>()
                                           .Implementor<Request>();
                                       p.Service<IResponse>()
                                           .Implementor<CssResponse>();
                                   });
            return new CommonServiceLocatorAdapter(container);
        }
    }
}
{'fraction_non_alphanumeric': 0.07471383975026015, 'fraction_numerical': 0.0033298647242455777, 'mean_word_length': 1.6581858407079646, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7574450', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1005, 'n_words': 330}