类的使用
org.redkale.net.http.HttpResponse
-
使用HttpResponse的程序包 程序包 说明 org.redkale.cluster.spi org.redkale.mq.spi org.redkale.net.http HTTP协议包,提供HTTP协议服务器 -
-
org.redkale.cluster.spi中HttpResponse的使用
org.redkale.cluster.spi中HttpResponse的子类 修饰符和类型 类 说明 static class
HttpLocalRpcClient.HttpMessageLocalResponse
-
org.redkale.mq.spi中HttpResponse的使用
org.redkale.mq.spi中HttpResponse的子类 修饰符和类型 类 说明 class
HttpMessageResponse
详情见: https://redkale.org -
org.redkale.net.http中HttpResponse的使用
返回HttpResponse的org.redkale.net.http中的方法 修饰符和类型 方法 说明 HttpResponse
HttpResponse. addCookie(HttpCookie... cookies)
增加Cookie值HttpResponse
HttpResponse. addCookie(Collection<HttpCookie> cookies)
增加Cookie值HttpResponse
HttpResponse. addHeader(String name, Object value)
添加Header值HttpResponse
HttpResponse. addHeader(Map<String,?> map)
添加Header值HttpResponse
HttpResponse. setContentLength(long contentLength)
设置内容长度HttpResponse
HttpResponse. setContentType(String contentType)
设置 ContentTypeHttpResponse
HttpResponse. setHeader(String name, Object value)
设置Header值HttpResponse
HttpResponse. setStatus(int status)
设置状态码HttpResponse
HttpResponse. skipHeader()
跳过header的输出 通常应用场景是,调用者的输出内容里已经包含了HTTP的响应头信息,因此需要调用此方法避免重复输出HTTP响应头信息。返回变量类型为HttpResponse的类型的org.redkale.net.http中的方法 修饰符和类型 方法 说明 protected ObjectPool<HttpResponse>
HttpServer. createSafeResponsePool(LongAdder createCounter, LongAdder cycleCounter, int responsePoolSize)
protected BiConsumer<HttpResponse,byte[]>
HttpResponse. getCacheHandler()
获取输出时的拦截器protected BiFunction<HttpResponse,ByteArray,ByteArray>
HttpResponse. getSendHandler()
获取输出RetResult时的拦截器参数类型为HttpResponse的org.redkale.net.http中的方法 修饰符和类型 方法 说明 boolean
HttpRpcAuthenticator. auth(HttpRequest request, HttpResponse response)
成功返回true, 不成功返回false,且需要response.finish()输出失败的信息, 比如404boolean
HttpRpcSecretAuthenticator. auth(HttpRequest request, HttpResponse response)
protected void
HttpServlet. authenticate(HttpRequest request, HttpResponse response)
用户登录或权限验证, 注解为@HttpMapping.auth == true 的方法会执行authenticate方法, 若验证成功则必须调用response.nextEvent();进行下一步操作, 例如:
void
HttpDispatcherServlet. execute(HttpRequest request, HttpResponse response)
void
HttpResourceServlet. execute(HttpRequest request, HttpResponse response)
void
HttpServlet. execute(HttpRequest request, HttpResponse response)
void
WebSocketServlet. execute(HttpRequest request, HttpResponse response)
protected void
HttpServlet. finish404(HttpRequest request, HttpResponse response)
提供404状态码的可定制接口protected void
HttpServlet. finish405(HttpRequest request, HttpResponse response)
提供405状态码的可定制接口protected void
HttpServlet. preExecute(HttpRequest request, HttpResponse response)
预执行方法,在execute方法之前运行,设置当前用户信息,或者加入常规统计和基础检测,例如 :
void
HttpRender. renderTo(HttpRequest request, HttpResponse response, Convert convert, HttpScope scope)
protected void
HttpFilter. setFilter(HttpResponse response, HttpFilter filter)
protected void
HttpFilter. thenEvent(HttpResponse response, HttpFilter filter)
类型变量类型为HttpResponse的org.redkale.net.http中的方法参数 修饰符和类型 方法 说明 void
HttpDispatcherServlet. addFilter(Filter<HttpContext,HttpRequest,HttpResponse> filter, AnyValue conf)
HttpServer
HttpServer. addHttpServlet(String mapping, BiConsumer<HttpRequest,HttpResponse> consumer)
添加HttpServletvoid
HttpResponse. sendHandler(BiFunction<HttpResponse,ByteArray,ByteArray> sendHandler)
设置输出结果时的拦截器protected void
HttpResponse. setCacheHandler(BiConsumer<HttpResponse,byte[]> cacheHandler)
设置输出时的拦截器
-