コード例 #1
0
        private void DoGet(HttpRequest request, HttpResponse response)
        {
            string format     = request.QueryString["format"];
            string url        = request.Url.GetComponents(UriComponents.Scheme | UriComponents.Host | UriComponents.Port | UriComponents.Path, UriFormat.Unescaped);
            var    apiBuilder = new DirectApiBuilder(_metadata);

            if (string.Equals(format, "json", StringComparison.InvariantCultureIgnoreCase))
            {
                response.ContentType = "application/json";
                response.Write(apiBuilder.BuildJson(url));
            }
            else
            {
                response.ContentType = "text/javascript";
                response.Write(apiBuilder.BuildJavascript(url));
            }
        }
コード例 #2
0
        private void DoGet(HttpRequest request, HttpResponse response)
        {
            string format = request.QueryString["format"];
            string url = request.Url.GetComponents(UriComponents.Scheme | UriComponents.Host | UriComponents.Port | UriComponents.Path, UriFormat.Unescaped);
            var apiBuilder = new DirectApiBuilder(_metadata);

            if(string.Equals(format, "json", StringComparison.InvariantCultureIgnoreCase))
            {
                response.ContentType = "application/json";
                response.Write(apiBuilder.BuildJson(url));
            }
            else
            {
                response.ContentType = "text/javascript";
                response.Write(apiBuilder.BuildJavascript(url));
            }
        }
コード例 #3
0
        private void DoGet(HttpRequest request, HttpResponse response)
        {
            string ns = request.QueryString["ns"];
            string format = request.QueryString["format"];
            string url = request.Url.GetComponents(UriComponents.Scheme | UriComponents.Host | UriComponents.Port | UriComponents.Path, UriFormat.Unescaped);
            DirectApiBuilder apiBuilder = new DirectApiBuilder(_metadata);

            if (format == "json")
            {
                response.ContentType = "application/json";
                response.Write(apiBuilder.BuildApiDescriptor(ns, ns, url));
            }
            else
            {
                response.ContentType = "text/javascript";
                response.Write(apiBuilder.BuildApi(ns, url));
            }
        }