class EndpointHandler
cangjie
public abstract class EndpointHandler <: IEndpointHandler功能:表示端点处理器的抽象基类。
父类型:
成员概览
| 成员 | 功能 |
|---|---|
| func status(UInt16) | 创建状态码响应结果。 |
| func json(JsonValue) | 使用 JSON 值创建响应结果。 |
| func json(String) | 使用 JSON 字符串创建响应结果。 |
| func redirect(String) | 创建重定向响应结果。 |
| func badRequest(String, ?String) | 创建错误请求响应结果。 |
func status(UInt16)
cangjie
public func status(status: UInt16): IEndpointResult功能:创建状态码响应结果。
参数:
- status:
UInt16- HTTP 状态码。
返回值:
- IEndpointResult - 返回状态码响应结果。
func json(JsonValue)
cangjie
public func json(value: JsonValue): IEndpointResult功能:使用 JSON 值创建响应结果。
参数:
- value:
JsonValue- JSON 响应内容。
返回值:
- IEndpointResult - 返回 JSON 响应结果。
func json(String)
cangjie
public func json(json: String): IEndpointResult功能:使用 JSON 字符串创建响应结果。
参数:
- json:
String- JSON 字符串内容。
返回值:
- IEndpointResult - 返回 JSON 文本响应结果。
func redirect(String)
cangjie
public func redirect(location: String): IEndpointResult功能:创建重定向响应结果。
参数:
- location:
String- 重定向目标地址。
返回值:
- IEndpointResult - 返回重定向响应结果。
func badRequest(String, ?String)
cangjie
public func badRequest(error: String, errorDescription: ?String): IEndpointResult功能:创建错误请求响应结果。
参数:
- error:
String- 错误代码。 - errorDescription:
?String- 错误描述。
返回值:
- IEndpointResult - 返回错误请求响应结果。