public class WebSocketResponse extends WebResponse
Response
used to cache the written data to the web socket client
when Wicket thread locals are available.
When the thread locals are not available then you can write directly to the IWebSocketConnection
taken from IWebSocketConnectionRegistry
.
In this case the response wont be cached.WebResponse.CacheScope
MAX_CACHE_DURATION
Constructor and Description |
---|
WebSocketResponse(IWebSocketConnection conn) |
Modifier and Type | Method and Description |
---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Add a cookie to the web response
|
void |
addHeader(String name,
String value)
Add a value to the servlet response stream.
|
void |
clearCookie(javax.servlet.http.Cookie cookie)
Convenience method for clearing a cookie.
|
void |
close()
Closes the response
|
String |
encodeRedirectURL(CharSequence url)
Encodes urls used to redirect.
|
String |
encodeURL(CharSequence url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed,
returns the URL unchanged.
|
void |
flush()
Flushes the response.
|
IWebSocketConnection |
getContainerResponse()
Provides access to the low-level container response object that implementaion of this
Response delegate to. |
boolean |
isRedirect() |
void |
reset()
Called when the Response needs to reset itself.
|
void |
sendError(int sc,
String msg)
Send error status code with optional message.
|
void |
sendRedirect(String url)
Redirects the response to specified URL.
|
void |
setContentLength(long length)
Set the content length on the response, if appropriate in the subclass.
|
void |
setContentType(String mimeType)
Set the content type on the response, if appropriate in the subclass.
|
void |
setDateHeader(String name,
Time date)
Set a header to the date value in the servlet response stream.
|
void |
setHeader(String name,
String value)
Set a header to the string value in the servlet response stream.
|
void |
setStatus(int sc)
Sets the status code for this response.
|
void |
write(byte[] array)
Writes the buffer to output.
|
void |
write(byte[] array,
int offset,
int length)
Writes the buffer to output.
|
void |
write(CharSequence sequence)
Writes the
CharSequence to output. |
disableCaching, enableCaching, setAcceptRange, setAttachmentHeader, setContentRange, setInlineHeader, setLastModifiedTime
getOutputStream
public WebSocketResponse(IWebSocketConnection conn)
public void write(CharSequence sequence)
Response
CharSequence
to output.public void write(byte[] array)
Response
public void write(byte[] array, int offset, int length)
Response
public void close()
Response
public void reset()
Response
public String encodeURL(CharSequence url)
Response
public final IWebSocketConnection getContainerResponse()
Response
Response
delegate to. This allows users to access features provided by the container
response but not by generalized Wicket Response
objects.getContainerResponse
in class Response
null
if nonepublic void addCookie(javax.servlet.http.Cookie cookie)
WebResponse
addCookie
in class WebResponse
public void clearCookie(javax.servlet.http.Cookie cookie)
WebResponse
clearCookie
in class WebResponse
cookie
- The cookie to setWebResponse.addCookie(Cookie)
public void setHeader(String name, String value)
WebResponse
setHeader
in class WebResponse
public void addHeader(String name, String value)
WebResponse
addHeader
in class WebResponse
public void setDateHeader(String name, Time date)
WebResponse
setDateHeader
in class WebResponse
public void setContentLength(long length)
WebResponse
setContentLength
in class WebResponse
length
- The length of the contentpublic void setContentType(String mimeType)
WebResponse
setContentType
in class WebResponse
mimeType
- The mime typepublic void setStatus(int sc)
WebResponse
setStatus
in class WebResponse
sc
- status codepublic void sendError(int sc, String msg)
WebResponse
sendError
in class WebResponse
public String encodeRedirectURL(CharSequence url)
WebResponse
Response.encodeURL(CharSequence)
.encodeRedirectURL
in class WebResponse
public void sendRedirect(String url)
WebResponse
url
parameters
through the WebResponse.encodeRedirectURL(CharSequence)
method.sendRedirect
in class WebResponse
public boolean isRedirect()
isRedirect
in class WebResponse
true
is WebResponse.sendRedirect(String)
was called, false
otherwise.public void flush()
WebResponse
flush
in class WebResponse
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.