public interface VaadinResponse
Modifier and Type | Method and Description |
---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Adds the specified cookie to the response.
|
static VaadinResponse |
getCurrent()
Gets the currently processed Vaadin response.
|
OutputStream |
getOutputStream()
Returns a
OutputStream for writing binary data in the
response. |
VaadinService |
getService()
Gets the vaadin service for the context of this response.
|
PrintWriter |
getWriter()
Returns a
PrintWriter object that can send character text to
the client. |
void |
sendError(int errorCode,
String message)
Sends an error response to the client using the specified status code and
clears the buffer.
|
void |
setCacheTime(long milliseconds)
Sets cache time in milliseconds, -1 means no cache at all.
|
void |
setContentLength(int len)
Sets the length of the content body in the response In HTTP servlets,
this method sets the HTTP Content-Length header.
|
void |
setContentType(String contentType)
Sets the content type of this response.
|
void |
setDateHeader(String name,
long timestamp)
Properly formats a timestamp as a date header.
|
void |
setHeader(String name,
String value)
Sets the value of a generic response header.
|
default void |
setNoCacheHeaders()
Sets all conceivable headers that might prevent a response from being
stored in any caches.
|
void |
setStatus(int statusCode)
Sets the (http) status code for the response.
|
void setStatus(int statusCode)
sendError(int, String)
instead.statusCode
- the status code to setHttpServletResponse.setStatus(int)
void setContentType(String contentType)
getWriter()
is invoked, the returned
PrintWriter will automatically use the defined charset.contentType
- a string specifying the MIME type of the contentServletResponse.setContentType(String)
void setHeader(String name, String value)
name
- the name of the headervalue
- the header value.HttpServletResponse.setHeader(String, String)
void setDateHeader(String name, long timestamp)
name
- the name of the headertimestamp
- the number of milliseconds since epochHttpServletResponse.setDateHeader(String, long)
OutputStream getOutputStream() throws IOException
OutputStream
for writing binary data in the
response.
Either this method or getWriter() may be called to write the response, not both.
OutputStream
for writing binary dataIOException
- if an input or output exception occurredgetWriter()
,
ServletResponse.getOutputStream()
PrintWriter getWriter() throws IOException
PrintWriter
object that can send character text to
the client. The PrintWriter uses the character encoding defined using
setContentType.
Either this method or getOutputStream() may be called to write the response, not both.
PrintWriter
for writing character textIOException
- if an input or output exception occurredgetOutputStream()
,
ServletResponse.getWriter()
void setCacheTime(long milliseconds)
milliseconds
- Cache time in millisecondsvoid sendError(int errorCode, String message) throws IOException
errorCode
- the HTTP status codemessage
- a message to accompany the errorIOException
- if an input or output exception occursHttpServletResponse.sendError(int, String)
VaadinService getService()
VaadinService
void addCookie(javax.servlet.http.Cookie cookie)
cookie
- the Cookie to return to the clientHttpServletResponse.addCookie(Cookie)
void setContentLength(int len)
len
- an integer specifying the length of the content being returned
to the clientdefault void setNoCacheHeaders()
static VaadinResponse getCurrent()
null
Copyright © 2019. All rights reserved.