コード例 #1
0
        public string BuildUrlToRequestHashForPath(string path, IDownloadMediaOptions options)
        {
            string originalUrl        = this.BuildUrlStringForPath(path, options);
            string encodedOriginalUrl = UrlBuilderUtils.EscapeDataString(originalUrl);

            var    actionBuilder = new WebApiActionBuilder(this.restGrammar, this.webApiGrammar);
            string result        = actionBuilder.GetHashedMediaUrlAction(this.sessionConfig);

            result = result +
                     this.restGrammar.HostAndArgsSeparator +
                     this.webApiGrammar.UrlForHashingParameterName + this.restGrammar.KeyValuePairSeparator + encodedOriginalUrl;

            return(result);
        }
コード例 #2
0
        public string GetUrlForRequest(IGetRenderingHtmlRequest request)
        {
            this.ValidateSpecificRequest(request);

            var    actionBuilder = new WebApiActionBuilder(this.restGrammar, this.webApiGrammar);
            string hostUrl       = actionBuilder.GetRenderingHtmlAction(request.SessionSettings);


            string baseParameters     = this.GetCommonPartForRequest(request).ToLowerInvariant();
            string specificParameters = this.GetSpecificPartForRequest(request);

            string allParameters = baseParameters;

            if (!string.IsNullOrEmpty(specificParameters))
            {
                allParameters =
                    allParameters +
                    this.restGrammar.FieldSeparator + specificParameters;
            }

            bool shouldTruncateBaseUrl = (!string.IsNullOrEmpty(allParameters) && allParameters.StartsWith(this.restGrammar.FieldSeparator));

            while (shouldTruncateBaseUrl)
            {
                allParameters         = allParameters.Substring(1);
                shouldTruncateBaseUrl = (!string.IsNullOrEmpty(allParameters) && allParameters.StartsWith(this.restGrammar.FieldSeparator));
            }


            string result = hostUrl;

            if (!string.IsNullOrEmpty(allParameters))
            {
                result =
                    result +
                    this.restGrammar.HostAndArgsSeparator + allParameters;
            }

            return(result);
        }
コード例 #3
0
    public string GetUrlForRequest(IGetRenderingHtmlRequest request)
    {
      this.ValidateSpecificRequest(request);

      var actionBuilder = new WebApiActionBuilder(this.restGrammar, this.webApiGrammar);
      string hostUrl = actionBuilder.GetRenderingHtmlAction(request.SessionSettings);


      string baseParameters = this.GetCommonPartForRequest(request).ToLowerInvariant();
      string specificParameters = this.GetSpecificPartForRequest(request);

      string allParameters = baseParameters;

      if (!string.IsNullOrEmpty(specificParameters))
      {
        allParameters =
          allParameters +
          this.restGrammar.FieldSeparator + specificParameters;
      }

      bool shouldTruncateBaseUrl = (!string.IsNullOrEmpty(allParameters) && allParameters.StartsWith(this.restGrammar.FieldSeparator));
      while (shouldTruncateBaseUrl)
      {
        allParameters = allParameters.Substring(1);
        shouldTruncateBaseUrl = (!string.IsNullOrEmpty(allParameters) && allParameters.StartsWith(this.restGrammar.FieldSeparator));
      }


      string result = hostUrl;

      if (!string.IsNullOrEmpty(allParameters))
      {
        result =
          result +
          this.restGrammar.HostAndArgsSeparator + allParameters;
      }

      return result;
    }
コード例 #4
0
        private string PrepareRequestUrl(ISessionConfig request)
        {
            WebApiActionBuilder builder = new WebApiActionBuilder(this.restGrammar, this.webApiGrammar);

            return(builder.GetAuthenticateActionUrlForSession(request));
        }
コード例 #5
0
    public string BuildUrlToRequestHashForPath(string path, IDownloadMediaOptions options)
    {
      string originalUrl = this.BuildUrlStringForPath(path, options);
      string encodedOriginalUrl = UrlBuilderUtils.EscapeDataString(originalUrl);

      var actionBuilder = new WebApiActionBuilder(this.restGrammar, this.webApiGrammar);
      string result = actionBuilder.GetHashedMediaUrlAction(this.sessionConfig);

      result = result +
        this.restGrammar.HostAndArgsSeparator + 
        this.webApiGrammar.UrlForHashingParameterName + this.restGrammar.KeyValuePairSeparator + encodedOriginalUrl;

      return result;
    }