Represents parameters for the GET WebDAV method.
        internal virtual WebDavStreamResponse GetFile(Uri requestUri, bool translate, GetFileParameters parameters)
        {
            Guard.NotNull(requestUri, "requestUri");

            var headers = new HeaderBuilder()
                          .Add(WebDavHeaders.Translate, translate ? "t" : "f")
                          .AddWithOverwrite(parameters.Headers)
                          .Build();

            var requestParams = new RequestParameters
            {
                Headers           = headers,
                OperationProgress = parameters.OperationProgress
            };

            using (var response = _dispatcher.Send(requestUri, HttpMethod.Get, requestParams))
            {
                return(new WebDavStreamResponse(response));
            }
        }
 /// <summary>
 /// Retrieves the file identified by the request URI telling the server to return a processed response, if possible.
 /// </summary>
 /// <param name="requestUri">A string that represents the request URI.</param>
 /// <param name="parameters">Parameters of the GET operation.</param>
 /// <returns>An instance of <see cref="WebDavStreamResponse" />.</returns>
 public WebDavStreamResponse GetProcessedFile(string requestUri, GetFileParameters parameters)
 {
     return(GetFile(CreateUri(requestUri), true, parameters));
 }
 /// <summary>
 /// Retrieves the file identified by the request URI telling the server to return a processed response, if possible.
 /// </summary>
 /// <param name="requestUri">The <see cref="Uri"/> to request.</param>
 /// <param name="parameters">Parameters of the GET operation.</param>
 /// <returns>An instance of <see cref="WebDavStreamResponse" />.</returns>
 public WebDavStreamResponse GetProcessedFile(Uri requestUri, GetFileParameters parameters)
 {
     return(GetFile(requestUri, true, parameters));
 }
 /// <summary>
 /// Retrieves the file identified by the request URI telling the server to return it without processing.
 /// </summary>
 /// <param name="requestUri">A string that represents the request URI.</param>
 /// <param name="parameters">Parameters of the GET operation.</param>
 /// <returns>An instance of <see cref="WebDavStreamResponse" />.</returns>
 public WebDavStreamResponse GetRawFile(string requestUri, GetFileParameters parameters)
 {
     return(GetFile(CreateUri(requestUri), false, parameters));
 }
 /// <summary>
 /// Retrieves the file identified by the request URI telling the server to return it without processing.
 /// </summary>
 /// <param name="requestUri">The <see cref="Uri"/> to request.</param>
 /// <param name="parameters">Parameters of the GET operation.</param>
 /// <returns>An instance of <see cref="WebDavStreamResponse" />.</returns>
 public WebDavStreamResponse GetRawFile(Uri requestUri, GetFileParameters parameters)
 {
     return(GetFile(requestUri, false, parameters));
 }
示例#6
0
 /// <summary>
 /// Retrieves the file identified by the request URI telling the server to return a processed response, if possible.
 /// </summary>
 /// <param name="requestUri">The <see cref="System.Uri"/> to request.</param>
 /// <param name="parameters">Parameters of the GET operation.</param>
 /// <returns>An instance of <see cref="WebDavStreamResponse" /></returns>
 public Task <WebDavStreamResponse> GetProcessedFile(Uri requestUri, GetFileParameters parameters)
 {
     return(GetFile(requestUri, true, parameters.CancellationToken));
 }
示例#7
0
 /// <summary>
 /// Retrieves the file identified by the request URI telling the server to return it without processing.
 /// </summary>
 /// <param name="requestUri">The <see cref="System.Uri"/> to request.</param>
 /// <param name="parameters">Parameters of the GET operation.</param>
 /// <returns>An instance of <see cref="WebDavStreamResponse" /></returns>
 public Task <WebDavStreamResponse> GetRawFile(Uri requestUri, GetFileParameters parameters)
 {
     return(GetFile(requestUri, false, parameters.CancellationToken));
 }
示例#8
0
        /// <summary>
        /// Retrieves the raw http response of a file identified by the request URI.
        /// </summary>
        /// <param name="requestUri">The <see cref="Uri"/> to request.</param>
        /// <param name="translate">A parameter indicating if the response can be processed by the web server.</param>
        /// <param name="parameters">Parameters of the GET operation.</param>
        /// <returns>An instance of <see cref="HttpResponseMessage" />.</returns>
        public async Task <HttpResponseMessage> GetFileResponse(Uri requestUri, bool translate, GetFileParameters parameters)
        {
            Guard.NotNull(requestUri, "requestUri");

            var headers = new HeaderBuilder()
                          .Add(WebDavHeaders.Translate, translate ? "t" : "f")
                          .AddWithOverwrite(parameters.Headers)
                          .Build();

            var requestParams = new RequestParameters {
                Headers = headers
            };
            var response = await _dispatcher.Send(
                requestUri,
                HttpMethod.Get,
                requestParams,
                parameters.CancellationToken,
                HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);

            return(response);
        }
示例#9
0
        internal virtual async Task <WebDavStreamResponse> GetFile(Uri requestUri, bool translate, GetFileParameters parameters)
        {
            var response = await GetFileResponse(requestUri, translate, parameters).ConfigureAwait(false);

            var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);

            return(new WebDavStreamResponse(response, stream));
        }
示例#10
0
        internal virtual async Task <WebDavStreamResponse> GetFile(Uri requestUri, bool translate, GetFileParameters parameters)
        {
            Guard.NotNull(requestUri, "requestUri");

            var headers = new HeaderBuilder()
                          .Add(WebDavHeaders.Translate, translate ? "t" : "f")
                          .AddWithOverwrite(parameters.Headers)
                          .Build();

            var requestParams = new RequestParameters {
                Headers = headers
            };
            var response = await _dispatcher.Send(
                requestUri,
                HttpMethod.Get,
                requestParams,
                parameters.CancellationToken,
                HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);

            var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);

            return(new WebDavStreamResponse(response, stream));
        }