TestOSHttpResponse.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.IO;
  30. using System.Text;
  31. using System.Web;
  32. using OpenSim.Framework.Servers.HttpServer;
  33. namespace OpenSim.Tests.Common
  34. {
  35. public class TestOSHttpResponse : IOSHttpResponse
  36. {
  37. /// <summary>
  38. /// Content type property.
  39. /// </summary>
  40. /// <remarks>
  41. /// Setting this property will also set IsContentTypeSet to
  42. /// true.
  43. /// </remarks>
  44. public string ContentType { get; set; }
  45. /// <summary>
  46. /// Boolean property indicating whether the content type
  47. /// property actively has been set.
  48. /// </summary>
  49. /// <remarks>
  50. /// IsContentTypeSet will go away together with .NET base.
  51. /// </remarks>
  52. // public bool IsContentTypeSet
  53. // {
  54. // get { return _contentTypeSet; }
  55. // }
  56. // private bool _contentTypeSet;
  57. /// <summary>
  58. /// Length of the body content; 0 if there is no body.
  59. /// </summary>
  60. public long ContentLength { get; set; }
  61. /// <summary>
  62. /// Alias for ContentLength.
  63. /// </summary>
  64. public long ContentLength64 { get; set; }
  65. /// <summary>
  66. /// Encoding of the body content.
  67. /// </summary>
  68. public Encoding ContentEncoding { get; set; }
  69. public bool KeepAlive { get; set; }
  70. /// <summary>
  71. /// Get or set the keep alive timeout property (default is
  72. /// 20). Setting this to 0 also disables KeepAlive. Setting
  73. /// this to something else but 0 also enable KeepAlive.
  74. /// </summary>
  75. public int KeepAliveTimeout { get; set; }
  76. /// <summary>
  77. /// Return the output stream feeding the body.
  78. /// </summary>
  79. /// <remarks>
  80. /// On its way out...
  81. /// </remarks>
  82. public Stream OutputStream { get; private set; }
  83. public string ProtocolVersion { get; set; }
  84. /// <summary>
  85. /// Return the output stream feeding the body.
  86. /// </summary>
  87. public Stream Body { get; private set; }
  88. /// <summary>
  89. /// Set a redirct location.
  90. /// </summary>
  91. public string RedirectLocation { private get; set; }
  92. /// <summary>
  93. /// Chunk transfers.
  94. /// </summary>
  95. public bool SendChunked { get; set; }
  96. /// <summary>
  97. /// HTTP status code.
  98. /// </summary>
  99. public int StatusCode { get; set; }
  100. /// <summary>
  101. /// HTTP status description.
  102. /// </summary>
  103. public string StatusDescription { get; set; }
  104. /// <summary>
  105. /// Add a header field and content to the response.
  106. /// </summary>
  107. /// <param name="key">string containing the header field
  108. /// name</param>
  109. /// <param name="value">string containing the header field
  110. /// value</param>
  111. public void AddHeader(string key, string value) { throw new NotImplementedException(); }
  112. public void Send() { }
  113. }
  114. }