Пример #1
0
        public HTTPServiceRequestImpl(System.Web.HttpContext ctx)
        {
            _httpContext = ctx;
            // Инициализируем объект для 1С
            // Заголовки
            MapImpl headers = new MapImpl();

            for (int i = 0; i < _httpContext.Request.Headers.Count; i++)
            {
                headers.Insert(ValueFactory.Create(_httpContext.Request.Headers.GetKey(i))
                               , ValueFactory.Create(_httpContext.Request.Headers.Get(i))
                               );
            }

            this._headers = new FixedMapImpl(headers);

            // ПараметрыURL будут пустыми
            _urlParams = new FixedMapImpl(new MapImpl());

            // Параметры запроса
            MapImpl queryOptions = new MapImpl();

            for (int i = 0; i < _httpContext.Request.Params.Count; i++)
            {
                queryOptions.Insert(ValueFactory.Create(_httpContext.Request.Params.GetKey(i))
                                    , ValueFactory.Create(_httpContext.Request.Params.Get(i))
                                    );
            }

            _queryOptions = new FixedMapImpl(queryOptions);

            _context = new HTTPServiceContextImpl(_httpContext);
        }
Пример #2
0
        public HTTPServiceRequestImpl(System.Web.HttpContext ctx)
        {
            _httpContext = ctx;
            // Инициализируем объект для 1С
            // Заголовки
            MapImpl headers = new MapImpl();

            for (int i = 0; i < _httpContext.Request.Headers.Count; i++)
            {
                headers.Insert(ValueFactory.Create(_httpContext.Request.Headers.GetKey(i))
                               , ValueFactory.Create(_httpContext.Request.Headers.Get(i))
                               );
            }

            this._headers = new FixedMapImpl(headers);

            // ПараметрыURL будут пустыми
            _urlParams = new FixedMapImpl(new MapImpl());

            // Параметры запроса
            MapImpl queryOptions = new MapImpl();

            // Изменено для совместимости. в 1С только параметры командной строки
            // Надо перенести в Контекст
            //for (int i = 0; i < _httpContext.Request.Params.Count; i++)
            //    queryOptions.Insert(ValueFactory.Create(_httpContext.Request.Params.GetKey(i))
            //                       , ValueFactory.Create(_httpContext.Request.Params.Get(i))
            //                       );
            for (int i = 0; i < _httpContext.Request.QueryString.Count; i++)
            {
                queryOptions.Insert(ValueFactory.Create(_httpContext.Request.QueryString.GetKey(i))
                                    , ValueFactory.Create(_httpContext.Request.QueryString.Get(i))
                                    );
            }

            _queryOptions = new FixedMapImpl(queryOptions);

            _context = new HTTPServiceContextImpl(_httpContext);
        }