本文整理汇总了C#中IHttpResponse.AppendHeader方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpResponse.AppendHeader方法的具体用法?C# IHttpResponse.AppendHeader怎么用?C# IHttpResponse.AppendHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHttpResponse
的用法示例。
在下文中一共展示了IHttpResponse.AppendHeader方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteHeaders
public static void WriteHeaders(IHttpResponse response, IFubuFile file)
{
var mimeType = MimeType.MimeTypeByFileName(file.Path);
if (mimeType != null)
{
response.AppendHeader(HttpResponseHeaders.ContentType, mimeType.Value);
}
response.AppendHeader(HttpResponseHeaders.LastModified, file.LastModified().ToString("r"));
response.AppendHeader(HttpResponseHeaders.ETag, file.Etag().Quoted());
}
示例2: Write
public override void Write(IHttpResponse response)
{
response.WriteFile(_file.Path);
WriteFileHeadContinuation.WriteHeaders(response, _file);
_settings.Headers.Each((key, source) => response.AppendHeader(key, source()));
response.WriteResponseCode(HttpStatusCode.OK);
}
示例3: Write
public override void Write(IHttpResponse response)
{
WriteHeaders(response, _file);
if (_status == HttpStatusCode.OK)
{
response.AppendHeader(HttpResponseHeaders.ContentLength, _file.Length().ToString());
}
response.WriteResponseCode(_status);
}
示例4: GetHttpResponse
/// <summary>
/// Sets the parameters of the incoming http response from a CoAP response.
/// The status code is mapped through the properties file and is set through
/// the StatusLine. The options are translated to the corresponding headers
/// and the max-age (in the header cache-control) is set to the default value
/// (60 seconds) if not already present. If the request method was not HEAD
/// and the coap response has a payload, the entity and the content-type are
/// set in the http response.
/// </summary>
public static void GetHttpResponse(IHttpRequest httpRequest, Response coapResponse, IHttpResponse httpResponse)
{
if (httpRequest == null)
throw ThrowHelper.ArgumentNull("httpRequest");
if (coapResponse == null)
throw ThrowHelper.ArgumentNull("coapResponse");
if (httpResponse == null)
throw ThrowHelper.ArgumentNull("httpResponse");
HttpStatusCode httpCode;
if (!coap2httpCode.TryGetValue(coapResponse.StatusCode, out httpCode))
throw ThrowHelper.TranslationException("Cannot convert the coap code in http status code: " + coapResponse.StatusCode);
httpResponse.StatusCode = (Int32)httpCode;
NameValueCollection nvc = GetHttpHeaders(coapResponse.GetOptions());
// set max-age if not already set
if (nvc["cache-control"] == null)
nvc.Set("cache-control", "max-age=" + CoapConstants.DefaultMaxAge);
foreach (String key in nvc.Keys)
{
httpResponse.AppendHeader(key, nvc[key]);
}
Byte[] payload = coapResponse.Payload;
if (payload != null)
{
httpResponse.OutputStream.Write(payload, 0, payload.Length);
String contentType;
if (coap2httpContentType.TryGetValue(coapResponse.ContentType, out contentType))
httpResponse.AppendHeader("content-type", contentType);
}
}
示例5: Write
public void Write(IHttpResponse response)
{
response.AppendHeader(_name, _value);
}
示例6: Replay
public Task Replay(IHttpResponse response)
{
response.AppendHeader(Name, Value);
return Task.CompletedTask;
}
示例7: Replay
public void Replay(IHttpResponse response)
{
response.AppendHeader(Name, Value);
}