ResponseHeaderOverrides.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) Alibaba Cloud Computing
  3. * All rights reserved.
  4. *
  5. * 版权所有 (C)阿里云计算有限公司
  6. */
  7. using System.Collections.Generic;
  8. namespace Aliyun.OSS
  9. {
  10. /// <summary>
  11. /// 包含了在发送OSS GET请求时可以重载的返回请求头。
  12. /// </summary>
  13. public class ResponseHeaderOverrides
  14. {
  15. internal const string ResponseHeaderContentType = "response-content-type";
  16. internal const string ResponseHeaderContentLanguage = "response-content-language";
  17. internal const string ResponseHeaderExpires = "response-expires";
  18. internal const string ResponseCacheControl = "response-cache-control";
  19. internal const string ResponseContentDisposition = "response-content-disposition";
  20. internal const string ResponseContentEncoding = "response-content-encoding";
  21. /// <summary>
  22. /// 获取或设置重载的Content-Type返回请求头。如果未指定,则返回null。
  23. /// </summary>
  24. public string ContentType { get; set; }
  25. /// <summary>
  26. /// 获取或设置返回重载的Content-Language返回请求头。如果未指定,则返回null。
  27. /// </summary>
  28. public string ContentLanguage { get; set; }
  29. /// <summary>
  30. /// 获取或设置返回重载的Expires返回请求头。如果未指定,则返回null。
  31. /// </summary>
  32. public string Expires { get; set; }
  33. /// <summary>
  34. /// 获取或设置返回重载的Cache-Control返回请求头。如果未指定,则返回null。
  35. /// </summary>
  36. public string CacheControl { get; set; }
  37. /// <summary>
  38. /// 获取或设置返回重载的Content-Disposition返回请求头。如果未指定,则返回null。
  39. /// </summary>
  40. public string ContentDisposition { get; set; }
  41. /// <summary>
  42. /// 获取或设置返回重载的Content-Encoding返回请求头。如果未指定,则返回null。
  43. /// </summary>
  44. public string ContentEncoding { get; set; }
  45. internal void Populate(IDictionary<string, string> parameters)
  46. {
  47. if (CacheControl != null)
  48. parameters.Add(ResponseCacheControl, CacheControl);
  49. if (ContentDisposition != null)
  50. parameters.Add(ResponseContentDisposition, ContentDisposition);
  51. if (ContentEncoding != null)
  52. parameters.Add(ResponseContentEncoding, ContentEncoding);
  53. if (ContentLanguage != null)
  54. parameters.Add(ResponseHeaderContentLanguage, ContentLanguage);
  55. if (ContentType != null)
  56. parameters.Add(ResponseHeaderContentType, ContentType);
  57. if (Expires != null)
  58. parameters.Add(ResponseHeaderExpires, Expires);
  59. }
  60. }
  61. }