Refactored HttpRequestEventArgs.cs

This commit is contained in:
sta 2014-09-03 14:57:25 +09:00
parent faaa2e1939
commit a6128fc473

View File

@ -4,8 +4,8 @@
* *
* The MIT License * The MIT License
* *
* Copyright (c) 2012-2013 sta.blockhead * Copyright (c) 2012-2014 sta.blockhead
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
@ -15,7 +15,7 @@
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -29,24 +29,40 @@
using System; using System;
using WebSocketSharp.Net; using WebSocketSharp.Net;
namespace WebSocketSharp.Server { namespace WebSocketSharp.Server
{
/// <summary> /// <summary>
/// Contains the event data associated with the HTTP request events of the <see cref="HttpServer"/> class. /// Contains the event data associated with an HTTP request event that
/// the <see cref="HttpServer"/> emits.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// An HTTP request event occurs when a <see cref="HttpServer"/> instance receives an HTTP request. /// <para>
/// If you want to get the HTTP request objects, you should access the <see cref="Request"/> property. /// An HTTP request event occurs when the <see cref="HttpServer"/> receives an HTTP request.
/// If you want to get the HTTP response objects to send, you should access the <see cref="Response"/> property. /// </para>
/// <para>
/// If you would like to get the request data, you should access
/// the <see cref="HttpRequestEventArgs.Request"/> property.
/// </para>
/// <para>
/// And if you would like to get the data used to return a response, you should access
/// the <see cref="HttpRequestEventArgs.Response"/> property.
/// </para>
/// </remarks> /// </remarks>
public class HttpRequestEventArgs : EventArgs public class HttpRequestEventArgs : EventArgs
{ {
#region Private Fields
private HttpListenerRequest _request;
private HttpListenerResponse _response;
#endregion
#region Internal Constructors #region Internal Constructors
internal HttpRequestEventArgs(HttpListenerContext context) internal HttpRequestEventArgs (HttpListenerContext context)
{ {
Request = context.Request; _request = context.Request;
Response = context.Response; _response = context.Response;
} }
#endregion #endregion
@ -54,20 +70,29 @@ namespace WebSocketSharp.Server {
#region Public Properties #region Public Properties
/// <summary> /// <summary>
/// Gets the HTTP request objects sent from a client. /// Gets the <see cref="HttpListenerRequest"/> that represents the HTTP request sent from
/// a client.
/// </summary> /// </summary>
/// <value> /// <value>
/// A <see cref="HttpListenerRequest"/> that contains the HTTP request objects. /// A <see cref="HttpListenerRequest"/> that represents the request.
/// </value> /// </value>
public HttpListenerRequest Request { get; private set; } public HttpListenerRequest Request {
get {
return _request;
}
}
/// <summary> /// <summary>
/// Gets the HTTP response objects to send to the client in response to the client's request. /// Gets the <see cref="HttpListenerResponse"/> used to return an HTTP response to the client.
/// </summary> /// </summary>
/// <value> /// <value>
/// A <see cref="HttpListenerResponse"/> that contains the HTTP response objects. /// A <see cref="HttpListenerResponse"/> used to return a response.
/// </value> /// </value>
public HttpListenerResponse Response { get; private set; } public HttpListenerResponse Response {
get {
return _response;
}
}
#endregion #endregion
} }