1 /*global $k*/ 2 3 /** 4 * @class A HTTP response 5 * @extends $k.NetEntity 6 **/ 7 $k.HttpResponse = function() { }; 8 9 /** 10 * Returns the status code of the response 11 * 12 * @function 13 * @returns {number} 14 **/ 15 $k.HttpResponse.prototype.code = function() { }; 16 17 /** 18 * Set the status code of the response 19 * 20 * @function 21 * @param {number} code 22 * @throws {$k.exception.InvalidValue} If the code is not a valid HTTP status code 23 **/ 24 $k.HttpResponse.prototype.setCode = function(code) { }; 25 26 /** 27 * Set the status code of the response to 400 (Bad request). Equivalent to setCode($k.HttpResponse.BAD_REQUEST) 28 * 29 * @function 30 **/ 31 $k.HttpResponse.prototype.setCodeBadRequest = function() { }; 32 33 /** 34 * Set the status code of the response to 404 (Not found). Equivalent to setCode($k.HttpResponse.NOT_FOUND) 35 * 36 * @function 37 **/ 38 $k.HttpResponse.prototype.setCodeNotFound = function() { }; 39 40 /** 41 * Set the status code of the response to 304 (Not Modified). Equivalent to setCode($k.HttpResponse.NOT_MODIFIED) 42 * 43 * @function 44 **/ 45 $k.HttpResponse.prototype.setCodeNotModified = function() { }; 46 47 /** 48 * Set the status code of the response to 200 (Ok). Equivalent to setCode($k.HttpResponse.OK) 49 * 50 * @function 51 **/ 52 $k.HttpResponse.prototype.setCodeOk = function() { }; 53 54 /** 55 * Set the status code of the response to 401 (Unauthorized). Equivalent to setCode($k.HttpResponse.UNAUTHORIZED) 56 * 57 * @function 58 **/ 59 $k.HttpResponse.prototype.setCodeUnauthorized = function() { }; 60 61 /** 62 * Add the cookie to the response, instructing the client to set the cookie 63 * 64 * @function 65 * @param {$k.NewCookie} cookie The new cookie 66 * @throws {$k.exception.TypeError} If the cookie is not a valid new cookie 67 **/ 68 $k.HttpResponse.prototype.setCookie = function(cookie) { }; 69 70 /** 71 * Status code 400 Bad Request 72 **/ 73 $k.HttpResponse.BAD_REQUEST = 400; 74 75 /** 76 * 77 * Status code 500 Internal Server Error 78 **/ 79 $k.HttpResponse.INTERNAL_SERVER_ERROR = 500; 80 81 /** 82 * 83 * Status code 404 Not Found 84 **/ 85 $k.HttpResponse.NOT_FOUND = 404; 86 87 /** 88 * 89 * Status code 304 Not Modified 90 **/ 91 $k.HttpResponse.NOT_MODIFIED = 304; 92 93 /** 94 * 95 * Status code 200 OK 96 **/ 97 $k.HttpResponse.OK = 200; 98 99 /** 100 * 101 * Status code 401 Unauthorized 102 **/ 103 $k.HttpResponse.UNAUTHORIZED = 401; 104 105