コード例 #1
0
        protected static string GetResponseStr(HTTPResponseCode code)
        {
            switch (code)
            {
            case HTTPResponseCode.Continue:
                return("Continue");

            case HTTPResponseCode.SwitchingProtocols:
                return("Switching Protocols");

            case HTTPResponseCode.Ok:
                return("Ok");

            case HTTPResponseCode.Created:
                return("Created");

            case HTTPResponseCode.Accepted:
                return("Accepted");

            case HTTPResponseCode.NonAuthoritativeInformation:
                return("Non-Authoritative Information");

            case HTTPResponseCode.NoContent:
                return("No Content");

            case HTTPResponseCode.ResetContent:
                return("Reset Content");

            case HTTPResponseCode.PartialContent:
                return("Partial Content");

            case HTTPResponseCode.MultipleChoices:
                return("Multiple Choices");

            case HTTPResponseCode.MovedPermanently:
                return("Moved Permanently");

            case HTTPResponseCode.Found:
                return("Found");

            case HTTPResponseCode.SeeOther:
                return("See Other");

            case HTTPResponseCode.NotModified:
                return("Not Modified");

            case HTTPResponseCode.UseProxy:
                return("Use Proxy");

            case HTTPResponseCode.TemporaryRedirect:
                return("Temporary Redirect");

            case HTTPResponseCode.BadRequest:
                return("Bad Request");

            case HTTPResponseCode.Unauthorized:
                return("Unauthorized");

            case HTTPResponseCode.PaymentRequired:
                return("Payment Required");

            case HTTPResponseCode.Forbidden:
                return("Forbidden");

            case HTTPResponseCode.NotFound:
                return("Not Found");

            case HTTPResponseCode.MethodNotAllowed:
                return("Method Not Allowed");

            case HTTPResponseCode.NotAcceptable:
                return("Not Acceptable");

            case HTTPResponseCode.ProxyAuthenticationRequired:
                return("Proxy Authentication Required");

            case HTTPResponseCode.RequestTimeout:
                return("Request Timeout");

            case HTTPResponseCode.Conflict:
                return("Conflict");

            case HTTPResponseCode.Gone:
                return("Gone");

            case HTTPResponseCode.LengthRequired:
                return("Length Required");

            case HTTPResponseCode.PreconditionFailed:
                return("Precondition Failed");

            case HTTPResponseCode.RequestEntityTooLarge:
                return("Request Entity Too Large");

            case HTTPResponseCode.RequestURITooLong:
                return("Request-URI Too Long");

            case HTTPResponseCode.UnsupportedMediaType:
                return("Unsupported Media Type");

            case HTTPResponseCode.RequestedRangeNotSatisfiable:
                return("Requested Range Not Satisfiable");

            case HTTPResponseCode.ExpectationFailed:
                return("Expectation Failed");

            case HTTPResponseCode.InternalServerError:
                return("Internal Server Error");

            case HTTPResponseCode.NotImplemented:
                return("Not Implemented");

            case HTTPResponseCode.BadGateway:
                return("Bad Gateway");

            case HTTPResponseCode.ServiceUnavailable:
                return("Service Unavailable");

            case HTTPResponseCode.GatewayTimeout:
                return("Gateway Timeout");

            case HTTPResponseCode.HTTPVersionNotSupported:
                return("HTTP Version Not Supported");
            }
            throw new NotImplementedException(string.Format("HTTP response code '{0}' is not implemented", code));
        }
コード例 #2
0
 protected static string GetResponseStr(HTTPResponseCode code)
 {
   switch (code)
   {
     case HTTPResponseCode.Continue:
       return "Continue";
     case HTTPResponseCode.SwitchingProtocols:
       return "Switching Protocols";
     case HTTPResponseCode.Ok:
       return "Ok";
     case HTTPResponseCode.Created:
       return "Created";
     case HTTPResponseCode.Accepted:
       return "Accepted";
     case HTTPResponseCode.NonAuthoritativeInformation:
       return "Non-Authoritative Information";
     case HTTPResponseCode.NoContent:
       return "No Content";
     case HTTPResponseCode.ResetContent:
       return "Reset Content";
     case HTTPResponseCode.PartialContent:
       return "Partial Content";
     case HTTPResponseCode.MultipleChoices:
       return "Multiple Choices";
     case HTTPResponseCode.MovedPermanently:
       return "Moved Permanently";
     case HTTPResponseCode.Found:
       return "Found";
     case HTTPResponseCode.SeeOther:
       return "See Other";
     case HTTPResponseCode.NotModified:
       return "Not Modified";
     case HTTPResponseCode.UseProxy:
       return "Use Proxy";
     case HTTPResponseCode.TemporaryRedirect:
       return "Temporary Redirect";
     case HTTPResponseCode.BadRequest:
       return "Bad Request";
     case HTTPResponseCode.Unauthorized:
       return "Unauthorized";
     case HTTPResponseCode.PaymentRequired:
       return "Payment Required";
     case HTTPResponseCode.Forbidden:
       return "Forbidden";
     case HTTPResponseCode.NotFound:
       return "Not Found";
     case HTTPResponseCode.MethodNotAllowed:
       return "Method Not Allowed";
     case HTTPResponseCode.NotAcceptable:
       return "Not Acceptable";
     case HTTPResponseCode.ProxyAuthenticationRequired:
       return "Proxy Authentication Required";
     case HTTPResponseCode.RequestTimeout:
       return "Request Timeout";
     case HTTPResponseCode.Conflict:
       return "Conflict";
     case HTTPResponseCode.Gone:
       return "Gone";
     case HTTPResponseCode.LengthRequired:
       return "Length Required";
     case HTTPResponseCode.PreconditionFailed:
       return "Precondition Failed";
     case HTTPResponseCode.RequestEntityTooLarge:
       return "Request Entity Too Large";
     case HTTPResponseCode.RequestURITooLong:
       return "Request-URI Too Long";
     case HTTPResponseCode.UnsupportedMediaType:
       return "Unsupported Media Type";
     case HTTPResponseCode.RequestedRangeNotSatisfiable:
       return "Requested Range Not Satisfiable";
     case HTTPResponseCode.ExpectationFailed:
       return "Expectation Failed";
     case HTTPResponseCode.InternalServerError:
       return "Internal Server Error";
     case HTTPResponseCode.NotImplemented:
       return "Not Implemented";
     case HTTPResponseCode.BadGateway:
       return "Bad Gateway";
     case HTTPResponseCode.ServiceUnavailable:
       return "Service Unavailable";
     case HTTPResponseCode.GatewayTimeout:
       return "Gateway Timeout";
     case HTTPResponseCode.HTTPVersionNotSupported:
       return "HTTP Version Not Supported";
   }
   throw new NotImplementedException(string.Format("HTTP response code '{0}' is not implemented", code));
 }
コード例 #3
0
 /// <summary>
 /// Creates a new HTTP response with the specified response <paramref name="code"/>.
 /// </summary>
 /// <param name="code">The response code to use for the created HTTP response.</param>
 public SimpleHTTPResponse(HTTPResponseCode code)
 {
     _code = code;
 }
コード例 #4
0
 /// <summary>
 /// Creates a new HTTP response with the specified response <paramref name="code"/>.
 /// </summary>
 /// <param name="code">The response code to use for the created HTTP response.</param>
 public SimpleHTTPResponse(HTTPResponseCode code)
 {
   _code = code;
 }