public interface Response
限定符和类型 | 方法和说明 |
---|---|
default Response |
badRequest()
Set current response http code 400
|
Body |
body() |
Response |
body(Body body)
Send body to client
|
default void |
body(String body)
Send a string response to the client
|
String |
contentType()
Get current response headers: 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()
Get current response cookies
|
Set<io.netty.handler.codec.http.cookie.Cookie> |
cookiesRaw() |
void |
download(String fileName,
File file)
download some file to client
|
Response |
header(String name,
String value)
Set current response header
|
Map<String,String> |
headers()
Get current response headers
|
default void |
html(String html)
Render by html
|
default void |
json(Object bean)
Render by json
|
default void |
json(String json)
Render by json
|
ModelAndView |
modelAndView() |
default Response |
notFound()
Set current response http code 404
|
OutputStreamWrapper |
outputStream()
已过时。
|
void |
redirect(String newUri)
Redirect to newUri
|
Response |
removeCookie(String name)
remove cookie
|
void |
render(ModelAndView modelAndView)
Render view And Setting Data, can be modified after WebHook
|
default void |
render(String view)
Render view, can be modified after WebHook
|
Response |
status(int status)
Setting Response Status
|
int |
statusCode()
Get current response http status code. e.g: 200
|
default void |
text(String text)
Render by text
|
default Response |
unauthorized()
Set current response http code 401
|
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 ValueSet<io.netty.handler.codec.http.cookie.Cookie> cookiesRaw()
Response cookie(Cookie cookie)
cookie
- Response 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 SSLResponse removeCookie(String name)
name
- default void text(String text)
text
- text contentdefault void html(String html)
html
- html contentdefault void json(String json)
json
- json contentdefault void json(Object bean)
bean
- bean instancedefault void body(String body)
body
- string contentvoid download(String fileName, File file) throws Exception
fileName
- give client file namefile
- file storage locationException
@Deprecated OutputStreamWrapper outputStream() throws IOException
IOException
- throw IOExceptiondefault void render(String view)
view
- view pagevoid render(ModelAndView modelAndView)
modelAndView
- ModelAndView objectvoid redirect(String newUri)
newUri
- new urlModelAndView modelAndView()
Body body()
Copyright © 2018. All rights reserved.