public class SmHttpContext extends WebContextBase
| 限定符和类型 | 字段和说明 |
|---|---|
protected AsyncContextState |
asyncState |
_fileMapcharset, errors, result, sessionState| 构造器和说明 |
|---|
SmHttpContext(org.smartboot.http.server.HttpRequest request,
org.smartboot.http.server.HttpResponse response,
java.util.concurrent.CompletableFuture<java.lang.Object> future) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
asyncComplete()
异步完成
|
void |
asyncListener(ContextAsyncListener listener)
异步监听
|
void |
asyncStart(long timeout,
java.lang.Runnable runnable)
异步开始
|
boolean |
asyncStarted()
异步已开始
|
boolean |
asyncSupported()
是否支持异步
|
java.lang.String |
body(java.lang.String charset)
获取body内容
|
java.io.InputStream |
bodyAsStream()
获取body内容为Stream
|
void |
close()
关闭响应(一些特殊的boot才有效)
|
long |
contentLength()
获取内容长度
|
void |
contentLength(long size)
设置内容长度
|
protected void |
contentTypeDoSet(java.lang.String contentType) |
MultiMap<java.lang.String> |
cookieMap()
获取小饼字典集合
|
void |
cookieSet(Cookie cookie)
设置 cookie
|
MultiMap<UploadedFile> |
fileMap()
获取上传文件字典集合
|
void |
flush()
冲刷
|
void |
headerAdd(java.lang.String key,
java.lang.String val)
添加 header
|
MultiMap<java.lang.String> |
headerMap()
获取头字典集合
|
java.util.Collection<java.lang.String> |
headerNamesOfResponse()
获取响应 headerNames
|
java.lang.String |
headerOfResponse(java.lang.String name)
获取响应 header
|
void |
headerSet(java.lang.String key,
java.lang.String val)
设置 header
|
java.util.Collection<java.lang.String> |
headerValuesOfResponse(java.lang.String name)
获取响应 header
|
protected void |
innerCommit() |
protected org.smartboot.http.server.HttpRequest |
innerGetRequest() |
protected org.smartboot.http.server.HttpResponse |
innerGetResponse() |
boolean |
isHeadersSent()
是否头部已发送
|
boolean |
isSecure()
是否为 ssl 请求
|
java.lang.String |
method()
获取请求方法
|
void |
output(byte[] bytes)
输出 字节数组
|
void |
output(java.io.InputStream stream)
输出 流对象
|
java.io.OutputStream |
outputStream()
获取输出流
|
MultiMap<java.lang.String> |
paramMap()
获取参数字典集合
|
java.lang.String |
protocol()
获取请求协议
|
java.lang.String |
queryString()
获取查询字符串
|
void |
redirect(java.lang.String url,
int code)
跳转地址
|
java.lang.String |
remoteIp()
获取远程IP
|
int |
remotePort()
获取远程Port
|
java.lang.Object |
request()
获取请求对象
|
java.lang.Object |
response()
获取响应对象
|
int |
status()
获取输出状态
|
protected void |
statusDoSet(int status) |
java.net.URI |
uri()
获取请求的URI
|
java.lang.String |
url()
获取请求的URL字符串
|
contentCharset, contentType, filesDelete, outputAsFile, outputAsFile, outputStreamAsGzip, path, session, sessionAsDouble, sessionAsDouble, sessionAsInt, sessionAsInt, sessionAsLong, sessionAsLong, sessionClear, sessionId, sessionOrDefault, sessionRemove, sessionReset, sessionSetaccept, accept, acceptNew, action, asyncStart, attr, attrMap, attrNames, attrOrDefault, attrsClear, attrSet, attrSet, autoMultipart, autoMultipart, body, bodyAsBytes, bodyNew, bodyNew, cacheControl, charset, contentType, contentTypeNew, controller, cookie, cookieNames, cookieOrDefault, cookieRemove, cookieSet, cookieSet, cookieSet, cookieSet, cookieValues, current, file, fileNames, fileValues, forward, getHandled, getLocale, getRendered, header, headerNames, headerOrDefault, headerValues, isFormUrlencoded, isMultipart, isMultipartFormData, keepAlive, mainHandler, output, output, outputAsHtml, outputAsJson, param, paramAsBean, paramAsDecimal, paramAsDecimal, paramAsDouble, paramAsDouble, paramAsInt, paramAsInt, paramAsLong, paramAsLong, paramNames, paramOrDefault, paramValues, pathAsLower, pathAsUpper, pathMap, pathNew, pathNew, protocolAsUpper, pull, realIp, redirect, referer, remoting, remotingSet, render, render, renderAndReturn, returnValue, session, sessionState, sessionState, setHandled, setLocale, setRendered, status, userAgentprotected final AsyncContextState asyncState
public SmHttpContext(org.smartboot.http.server.HttpRequest request,
org.smartboot.http.server.HttpResponse response,
java.util.concurrent.CompletableFuture<java.lang.Object> future)
protected org.smartboot.http.server.HttpRequest innerGetRequest()
protected org.smartboot.http.server.HttpResponse innerGetResponse()
public boolean isHeadersSent()
ContextisHeadersSent 在类中 Contextpublic int remotePort()
ContextremotePort 在类中 Contextpublic long contentLength()
ContextcontentLength 在类中 Contextpublic java.lang.String queryString()
ContextqueryString 在类中 Contextpublic java.lang.String body(java.lang.String charset)
throws java.io.IOException
Contextpublic java.io.InputStream bodyAsStream()
throws java.io.IOException
ContextbodyAsStream 在类中 Contextjava.io.IOExceptionpublic MultiMap<UploadedFile> fileMap()
Contextprotected void contentTypeDoSet(java.lang.String contentType)
contentTypeDoSet 在类中 Contextpublic java.io.OutputStream outputStream()
throws java.io.IOException
ContextoutputStream 在类中 Contextjava.io.IOExceptionpublic void output(java.io.InputStream stream)
Contextpublic void headerSet(java.lang.String key,
java.lang.String val)
Contextpublic void headerAdd(java.lang.String key,
java.lang.String val)
Contextpublic java.lang.String headerOfResponse(java.lang.String name)
ContextheaderOfResponse 在类中 Contextpublic java.util.Collection<java.lang.String> headerValuesOfResponse(java.lang.String name)
ContextheaderValuesOfResponse 在类中 Contextpublic java.util.Collection<java.lang.String> headerNamesOfResponse()
ContextheaderNamesOfResponse 在类中 Contextpublic void redirect(java.lang.String url,
int code)
Contextprotected void statusDoSet(int status)
statusDoSet 在类中 Contextpublic void contentLength(long size)
ContextcontentLength 在类中 Contextpublic void flush()
throws java.io.IOException
Contextpublic void close()
throws java.io.IOException
Contextprotected void innerCommit()
throws java.io.IOException
innerCommit 在类中 WebContextBasejava.io.IOExceptionpublic boolean asyncSupported()
ContextasyncSupported 在类中 Contextpublic boolean asyncStarted()
ContextasyncStarted 在类中 Contextpublic void asyncListener(ContextAsyncListener listener)
ContextasyncListener 在类中 Contextpublic void asyncStart(long timeout,
java.lang.Runnable runnable)
ContextasyncStart 在类中 Contexttimeout - 超时runnable - 运行器public void asyncComplete()
ContextasyncComplete 在类中 Context