public interface Response
限定符和类型 | 方法和说明 |
---|---|
default Response |
badRequest() |
default void |
body(byte[] data) |
default void |
body(io.netty.buffer.ByteBuf byteBuf) |
default void |
body(String data)
send body to client
|
String |
contentType() |
Response |
contentType(String contentType)
Setting Response ContentType
|
Response |
cookie(Cookie cookie)
add raw response cookie
|
Response |
cookie(String name,
String value)
add Cookie
|
Response |
cookie(String name,
String value,
int maxAge)
Setting Cookie
|
Response |
cookie(String name,
String value,
int maxAge,
boolean secured)
Setting Cookie
|
Response |
cookie(String path,
String name,
String value,
int maxAge,
boolean secured)
Setting Cookie
|
Map<String,String> |
cookies() |
void |
download(String fileName,
File file)
download some file to clinet
|
Response |
header(String name,
String value)
setting header
|
Map<String,String> |
headers() |
default void |
html(String html)
Render by html
|
boolean |
isCommit() |
default void |
json(Object bean)
Render by json
|
default void |
json(String json)
Render by json
|
default Response |
notFound() |
void |
redirect(String newUri)
Redirect to newUri
|
Response |
removeCookie(String name)
remove cookie
|
void |
render(ModelAndView modelAndView)
Render view And Setting Data
|
default void |
render(String view)
Render view
|
void |
send(io.netty.handler.codec.http.FullHttpResponse response) |
Response |
status(int status)
Setting Response Status
|
int |
statusCode() |
default void |
text(String text)
Render by text
|
default Response |
unauthorized() |
int statusCode()
Response status(int status)
status
- status codedefault Response badRequest()
default Response unauthorized()
default Response notFound()
Response contentType(String contentType)
contentType
- content typeString contentType()
Response header(String name, String value)
name
- Header Namevalue
- Header ValueResponse cookie(String name, String value)
name
- Cookie Namevalue
- Cookie ValueResponse cookie(String name, String value, int maxAge)
name
- Cookie Namevalue
- Cookie ValuemaxAge
- Period of validityResponse cookie(String name, String value, int maxAge, boolean secured)
name
- Cookie Namevalue
- Cookie ValuemaxAge
- Period of validitysecured
- Is SSLResponse cookie(String path, String name, String value, int maxAge, boolean secured)
path
- Cookie Domain Pathname
- Cookie Namevalue
- Cookie ValuemaxAge
- Period of validitysecured
- Is SSLdefault void text(@NonNull String text)
text
- text contentdefault void html(@NonNull String html)
html
- html contentdefault void json(@NonNull String json)
json
- json contentdefault void json(@NonNull Object bean)
bean
- default void body(@NonNull String data)
data
- default void body(@NonNull byte[] data)
default void body(@NonNull io.netty.buffer.ByteBuf byteBuf)
void download(String fileName, File file) throws Exception
fileName
- give client file namefile
- Exception
default void render(@NonNull String view)
view
- view pagevoid render(ModelAndView modelAndView)
modelAndView
- ModelAndView objectvoid redirect(String newUri)
newUri
- new urlboolean isCommit()
void send(io.netty.handler.codec.http.FullHttpResponse response)
Copyright © 2017. All rights reserved.