ResponseAdapter
public class HttpServletResponseAdapter extends AbstractResponseAdapter
adaptee
Constructor | Description |
---|---|
HttpServletResponseAdapter(javax.servlet.http.HttpServletResponse response,
Activity activity) |
Instantiates a new HttpServletResponseAdapter.
|
Modifier and Type | Method | Description |
---|---|---|
void |
flush() |
|
java.lang.String |
getContentType() |
Returns the content type used for the MIME body sent in this response.
|
java.lang.String |
getEncoding() |
Returns the name of the character encoding (MIME charset) used for the body
sent in this response.
|
java.io.OutputStream |
getOutputStream() |
Returns a
OutputStream suitable for writing binary data in the response. |
java.io.Writer |
getWriter() |
Returns a
Writer object that can send character text to the client. |
java.lang.String |
redirect(RedirectResponseRule redirectResponseRule) |
Redirects a client to a new URL.
|
void |
redirect(java.lang.String target) |
Redirects a client to a new URL.
|
void |
setContentType(java.lang.String contentType) |
Sets the content type of the response being sent to the client,
if the response has not been committed yet.
|
void |
setEncoding(java.lang.String encoding) |
Sets the character encoding of the response being sent to the client.
|
addHeader, containsHeader, getHeader, getHeaderNames, getHeaders, getHeaders, getStatus, setHeader, setStatus, touchHeaders
getAdaptee
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addHeader, containsHeader, getHeader, getHeaderNames, getHeaders, getHeaders, getStatus, setHeader, setStatus, touchHeaders
public HttpServletResponseAdapter(javax.servlet.http.HttpServletResponse response, Activity activity)
response
- the HTTP responseactivity
- the activitypublic java.lang.String getEncoding()
ResponseAdapter
String
specifying the name of the character encoding,
for example, UTF-8public void setEncoding(java.lang.String encoding) throws java.io.UnsupportedEncodingException
ResponseAdapter
encoding
- a String
specifying only the character set
defined by IANA Character Sets (http://www.iana.org/assignments/character-sets)java.io.UnsupportedEncodingException
- if character encoding is not supportedpublic java.lang.String getContentType()
ResponseAdapter
String
specifying the content type,
for example, text/html
, or nullpublic void setContentType(java.lang.String contentType)
ResponseAdapter
contentType
- a String
specifying the MIME type of the contentpublic java.io.OutputStream getOutputStream() throws java.io.IOException
ResponseAdapter
OutputStream
suitable for writing binary data in the response.OutputStream
for writing binary datajava.io.IOException
- if an input or output exception occurspublic java.io.Writer getWriter() throws java.io.IOException
ResponseAdapter
Writer
object that can send character text to the client.Writer
object that can return character data to the clientjava.io.IOException
- if an input or output exception occurspublic void redirect(java.lang.String target) throws java.io.IOException
ResponseAdapter
target
- the redirect targetjava.io.IOException
- if an input or output exception occurspublic java.lang.String redirect(RedirectResponseRule redirectResponseRule) throws java.io.IOException
ResponseAdapter
redirectResponseRule
- the redirect response rulejava.io.IOException
- if an input or output exception occurspublic void flush()
Copyright © 2008–2018 The Aspectran Project. All rights reserved.