xlang v5.1 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
HttpServletResponse.x
浏览该文件的文档.
1
6
7 // HTTP状态码常量定义
8 // 1xx: 信息性状态码,表示请求已接收,继续处理
9 public static const int SC_CONTINUE; // 100: 继续,请求者应继续其请求
10 public static const int SC_SWITCHING_PROTOCOLS; // 101: 切换协议,根据请求者的指令切换协议
11 // 2xx: 成功状态码,表示请求已成功被服务器接收、理解、并接受
12 public static const int SC_OK; // 200: 请求成功
13 public static const int SC_CREATED; // 201: 已创建,请求成功并且服务器创建了新的资源
14 public static const int SC_ACCEPTED; // 202: 已接受,请求已接受但尚未处理完成
15 public static const int SC_NON_AUTHORITATIVE_INFORMATION; // 203: 非授权信息,请求已成功但返回的信息可能来自第三方
16 public static const int SC_NO_CONTENT; // 204: 无内容,请求成功但不返回任何内容
17 public static const int SC_RESET_CONTENT; // 205: 重置内容,服务器成功处理了请求,但不需要返回任何实体内容
18 public static const int SC_PARTIAL_CONTENT; // 206: 部分内容,服务器成功执行了部分GET请求
19 // 3xx: 重定向状态码,表示要完成请求,需要进一步操作
20 public static const int SC_MULTIPLE_CHOICES; // 300: 多种选择,请求的资源包含多个选项
21 public static const int SC_MOVED_PERMANENTLY; // 301: 永久移动,请求的资源已被永久的移动到新的URI
22 public static const int SC_MOVED_TEMPORARILY; // 302: 临时移动,请求的资源已被临时的移动到新的URI
23 public static const int SC_FOUND; // 302的另一种表示,与SC_MOVED_TEMPORARILY相同
24 public static const int SC_SEE_OTHER; // 303: 查看其他地址,请求者应当对不同的资源使用GET方法请求
25 public static const int SC_NOT_MODIFIED; // 304: 未修改,服务器资源未发生改变
26 public static const int SC_USE_PROXY; // 305: 使用代理,请求者应该通过代理访问该资源
27 public static const int SC_TEMPORARY_REDIRECT; // 307: 临时重定向,与302类似,但客户端应当保持请求方法不变
28 // 4xx: 客户端错误状态码,表示包含语法错误或无法完成请求
29 public static const int SC_BAD_REQUEST; // 400: 错误请求,请求包含语法错误或无法完成请求
30 public static const int SC_UNAUTHORIZED; // 401: 未经授权,请求未经授权
31 public static const int SC_PAYMENT_REQUIRED; // 402: 需要支付,保留用于将来使用
32 public static const int SC_FORBIDDEN; // 403: 禁止访问,服务器拒绝执行请求
33 public static const int SC_NOT_FOUND; // 404: 未找到,服务器未找到与请求URI匹配的资源
34 public static const int SC_METHOD_NOT_ALLOWED; // 405: 方法不允许,请求方法不被允许
35 public static const int SC_NOT_ACCEPTABLE; // 406: 不可接受,服务器无法根据请求头的内容特性生成响应
36 public static const int SC_PROXY_AUTHENTICATION_REQUIRED; // 407: 需要代理认证,请求者需要使用代理认证
37 public static const int SC_REQUEST_TIMEOUT; // 408: 请求超时,服务器等待请求超时
38 public static const int SC_CONFLICT; // 409: 冲突,请求无法完成,因为与当前资源状态冲突
39 public static const int SC_GONE; // 410: 已删除,请求的资源已被永久删除
40 public static const int SC_LENGTH_REQUIRED; // 411: 需要内容长度,服务器拒绝处理不含内容长度头的请求
41 public static const int SC_PRECONDITION_FAILED; // 412: 前置条件失败,服务器未满足请求者在请求设置的其中一个前置条件
42 public static const int SC_REQUEST_ENTITY_TOO_LARGE; // 413: 请求实体过大,服务器拒绝处理当前尺寸的请求
43 public static const int SC_REQUEST_URI_TOO_LONG; // 414: 请求URI过长,服务器拒绝处理过长的URI
44 public static const int SC_UNSUPPORTED_MEDIA_TYPE; // 415: 不支持的媒体类型,服务器拒绝处理请求的格式
45 public static const int SC_REQUESTED_RANGE_NOT_SATISFIABLE; // 416: 请求范围不符合,服务器无法满足请求的范围
46 public static const int SC_EXPECTATION_FAILED; // 417: 期望失败,服务器无法满足 Expect 请求头字段的要求
47 // 5xx: 服务器错误状态码,表示服务器在处理请求的过程中发生了错误
48 public static const int SC_INTERNAL_SERVER_ERROR; // 500: 服务器内部错误,服务器遇到错误,无法完成请求
49 public static const int SC_NOT_IMPLEMENTED; // 501: 未实现,服务器不支持请求的功能
50 public static const int SC_BAD_GATEWAY; // 502: 网关错误,网关或代理从上游服务器收到无效响应
51 public static const int SC_SERVICE_UNAVAILABLE; // 503: 服务不可用,服务器暂时过载或维护
52 public static const int SC_GATEWAY_TIMEOUT; // 504: 网关超时,作为网关或代理的服务器,未及时从上游服务器接收请求
53 public static const int SC_HTTP_VERSION_NOT_SUPPORTED; // 505: HTTP版本不受支持,服务器不支持请求中所用的HTTP协议版本
54
55
56 // 构造函数
57 public HttpServletResponse(); // 构造函数,初始化HTTP响应对象
58
59
60 // 响应内容输出方法
61 public void print(String); // 向响应输出字符串内容
62 public void write(byte[], int, int); // 向响应输出字节数组,可指定偏移量和长度
63 public void setOutputStream(Stream); // 设置响应的输出流
64
65
66 // 状态和头部设置方法
67 public void setResponseCode(int); // 设置HTTP响应状态码
68 public void setCookie(String, String); // 设置响应中的Cookie
69 public void addHeader(String, String); // 添加HTTP响应头
70 public void setHeader(String, String); // 设置HTTP响应头
71 public void setContentType(String); // 设置响应的内容类型
72 public void setSessionParam(String); // 设置会话参数
73
74
75 // 析构函数
76 public void finalize(); // 析构函数,清理资源
77};
void setCookie(String, String)
static const int SC_BAD_REQUEST
static const int SC_NO_CONTENT
void addHeader(String, String)
static const int SC_CREATED
static const int SC_NOT_MODIFIED
static const int SC_PRECONDITION_FAILED
static const int SC_REQUEST_ENTITY_TOO_LARGE
static const int SC_UNAUTHORIZED
void setHeader(String, String)
static const int SC_TEMPORARY_REDIRECT
static const int SC_NON_AUTHORITATIVE_INFORMATION
static const int SC_MOVED_PERMANENTLY
static const int SC_GONE
static const int SC_PROXY_AUTHENTICATION_REQUIRED
static const int SC_REQUESTED_RANGE_NOT_SATISFIABLE
static const int SC_REQUEST_URI_TOO_LONG
static const int SC_CONTINUE
static const int SC_SWITCHING_PROTOCOLS
static const int SC_OK
void setResponseCode(int)
static const int SC_RESET_CONTENT
static const int SC_REQUEST_TIMEOUT
static const int SC_NOT_FOUND
static const int SC_USE_PROXY
static const int SC_LENGTH_REQUIRED
static const int SC_MOVED_TEMPORARILY
static const int SC_INTERNAL_SERVER_ERROR
static const int SC_METHOD_NOT_ALLOWED
static const int SC_FORBIDDEN
static const int SC_ACCEPTED
static const int SC_GATEWAY_TIMEOUT
static const int SC_HTTP_VERSION_NOT_SUPPORTED
void setOutputStream(Stream)
static const int SC_NOT_ACCEPTABLE
static const int SC_SERVICE_UNAVAILABLE
static const int SC_FOUND
static const int SC_MULTIPLE_CHOICES
static const int SC_SEE_OTHER
static const int SC_BAD_GATEWAY
static const int SC_CONFLICT
static const int SC_UNSUPPORTED_MEDIA_TYPE
void print(String)
static const int SC_PARTIAL_CONTENT
static const int SC_EXPECTATION_FAILED
void setContentType(String)
void write(byte[], int, int)
static const int SC_NOT_IMPLEMENTED
void setSessionParam(String)
static const int SC_PAYMENT_REQUIRED
Definition Stream.x:6
Definition String.x:5