ResponseAdapterDaemonResponseAdapter, EmbeddedResponseAdapter, QuartzJobResponseAdapter, ShellResponseAdapterpublic class BasicResponseAdapter extends AbstractResponseAdapter
| Constructor | Description |
|---|---|
BasicResponseAdapter(java.lang.Object adaptee) |
Instantiates a new Basic response adapter.
|
BasicResponseAdapter(java.lang.Object adaptee,
java.io.Writer writer) |
Instantiates a new Basic response adapter.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addHeader(java.lang.String name,
java.lang.String value) |
Add the given single header value to the current list of values
for the given header.
|
boolean |
containsHeader(java.lang.String name) |
Returns a boolean indicating whether the named response header
has already been set.
|
void |
flush() |
Forces any content in the buffer to be written to the client.
|
MultiValueMap<java.lang.String,java.lang.String> |
getAllHeaders() |
Returns a map of the request headers that can be modified.
|
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.lang.String |
getHeader(java.lang.String name) |
Returns the value of the response header with the given name.
|
java.util.Collection<java.lang.String> |
getHeaderNames() |
Returns the names of the headers of this response.
|
java.util.Collection<java.lang.String> |
getHeaders(java.lang.String name) |
Returns the values of the response header with the given name.
|
java.io.OutputStream |
getOutputStream() |
Returns a
OutputStream suitable for writing binary data in the response. |
int |
getStatus() |
Returns the status code.
|
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 path) |
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.
|
void |
setHeader(java.lang.String name,
java.lang.String value) |
Set the given single header value under the given header name.
|
protected void |
setOutputStream(java.io.OutputStream outputStream) |
|
void |
setStatus(int status) |
Sets the status code.
|
protected void |
setWriter(java.io.Writer writer) |
|
MultiValueMap<java.lang.String,java.lang.String> |
touchHeaders() |
Returns a map of the response headers that can be modified.
|
getAdapteepublic BasicResponseAdapter(java.lang.Object adaptee)
adaptee - the adaptee objectpublic BasicResponseAdapter(java.lang.Object adaptee,
java.io.Writer writer)
adaptee - the adaptee objectwriter - the writer to outputpublic java.lang.String getHeader(java.lang.String name)
If a response header with the given name exists and contains multiple values, the value that was added first will be returned.
name - the name of the response header whose value to returnnull if no header with the given name has been set
on this responsepublic java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
name - the name of the response header whose values to returnCollection of the values
of the response header with the given namepublic java.util.Collection<java.lang.String> getHeaderNames()
Collection of the names
of the headers of this responsepublic boolean containsHeader(java.lang.String name)
name - the header nametrue if the named response header
has already been set; false otherwisepublic void setHeader(java.lang.String name,
java.lang.String value)
name - the header namevalue - the header value to setpublic void addHeader(java.lang.String name,
java.lang.String value)
name - the header namevalue - the header value to be addedpublic MultiValueMap<java.lang.String,java.lang.String> getAllHeaders()
MultiValueMap object, may be nullpublic MultiValueMap<java.lang.String,java.lang.String> touchHeaders()
MultiValueMap object, may not be nullpublic java.lang.String getEncoding()
ResponseAdapterString specifying the name of the character encoding,
for example, UTF-8public void setEncoding(java.lang.String encoding)
ResponseAdapterencoding - a String specifying only the character set
defined by IANA Character Sets (http://www.iana.org/assignments/character-sets)public java.lang.String getContentType()
ResponseAdapterString specifying the content type,
for example, text/html, or nullpublic void setContentType(java.lang.String contentType)
ResponseAdaptercontentType - a String specifying the MIME type of the contentpublic java.io.OutputStream getOutputStream()
throws java.io.IOException
ResponseAdapterOutputStream suitable for writing binary data in the response.OutputStream for writing binary datajava.io.IOException - if an input or output exception occursprotected void setOutputStream(java.io.OutputStream outputStream)
public java.io.Writer getWriter()
throws java.io.IOException
ResponseAdapterWriter 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 occursprotected void setWriter(java.io.Writer writer)
public void flush()
throws java.io.IOException
ResponseAdapterjava.io.IOException - if an input or output exception occurspublic void redirect(java.lang.String path)
throws java.io.IOException
ResponseAdapterpath - the redirect pathjava.io.IOException - if an input or output exception occurspublic java.lang.String redirect(RedirectResponseRule redirectResponseRule)
ResponseAdapterredirectResponseRule - the redirect response rulepublic int getStatus()
public void setStatus(int status)
status - the status codeCopyright © 2008–2018 The Aspectran Project. All rights reserved.