| java.lang.Object javax.servlet.ServletResponseWrapper javax.servlet.http.HttpServletResponseWrapper org.mmbase.util.GenericResponseWrapper
GenericResponseWrapper | public class GenericResponseWrapper extends HttpServletResponseWrapper (Code) | | Wrapper around the response. It collects all data that is sent to it, and makes it available
through a toString() method. It is used by taglib's Include-Tag, but it might find more general
use, outside taglib.
author: Kees Jongenburger author: Johannes Verelst author: Michiel Meeuwissen since: MMBase-1.7 version: $Id: GenericResponseWrapper.java,v 1.22 2008/02/20 12:01:49 michiel Exp $ |
Method Summary | |
public void | addCookie(Cookie c) | public void | addDateHeader(String arg0, long arg1) | public void | addHeader(String arg0, String arg1) | public void | addIntHeader(String arg0, int arg1) | public boolean | containsHeader(String arg0) | protected byte[] | determinXMLEncoding() | public String | encodeRedirectURL(String arg0) | public String | encodeURL(String arg0) | public String | getCharacterEncoding() Returns the name of the charset used for the MIME body sent in this response. | public static String | getDefaultEncoding(String contentType) Supposes that no explicit charset is mentioned in a contentType, and returns a default. | public static String | getEncoding(String contentType) Takes the value of a Content-Type header, and tries to find the encoding from it. | public HttpServletResponse | getHttpServletResponse() Gets the response object which this wrapper is wrapping. | public Locale | getLocale() | public ServletOutputStream | getOutputStream() Return the OutputStream. | public String | getRedirected() | public PrintWriter | getWriter() | final public static String | getXMLEncoding(String xmlString) | public static String | getXMLEncoding(byte[] allBytes) Takes a ByteArrayInputStream, which is considered to be (the first) part of an XML, and returns the encoding. | public void | sendError(int arg0, String arg1) | public void | sendError(int arg0) | public void | sendRedirect(String location) | public void | setContentType(String ct) Sets the content type of the response being sent to the
client. | public void | setDateHeader(String arg0, long arg1) | public void | setHeader(String header, String value) | public void | setIntHeader(String arg0, int arg1) | public void | setLocale(Locale arg0) | public void | setStatus(int s) | public String | toString() Return all data that has been written to the PrintWriter. |
TEXT_XML_DEFAULT_CHARSET | public static String TEXT_XML_DEFAULT_CHARSET(Code) | | |
GenericResponseWrapper | public GenericResponseWrapper(HttpServletResponse resp, String encoding)(Code) | | Sets also a value for the characterEncoding which must be supposed.
Normally it would be determined automaticly right, but if for some reason it doesn't you can override it.
|
determinXMLEncoding | protected byte[] determinXMLEncoding()(Code) | | |
getCharacterEncoding | public String getCharacterEncoding()(Code) | | Returns the name of the charset used for the MIME body sent in this response.
If no charset has been assigned, it is implicitly set to ISO-8859-1 (Latin-1).
See RFC 2047 for more information about character encoding and MIME.
returns the encoding
|
getDefaultEncoding | public static String getDefaultEncoding(String contentType)(Code) | | Supposes that no explicit charset is mentioned in a contentType, and returns a default. (UTF-8 or US-ASCII
for XML types and ISO-8859-1 otherwise).
since: MMBase-1.7.1 A charset. |
getEncoding | public static String getEncoding(String contentType)(Code) | | Takes the value of a Content-Type header, and tries to find the encoding from it.
since: MMBase-1.7.1 The found charset if found, otherwise 'null' |
getHttpServletResponse | public HttpServletResponse getHttpServletResponse()(Code) | | Gets the response object which this wrapper is wrapping. You might need this when giving a
redirect or so.
since: MMBase-1.7.1 |
getRedirected | public String getRedirected()(Code) | | since: MMBase-1.8.5 |
getXMLEncoding | final public static String getXMLEncoding(String xmlString)(Code) | | Takes a String, which is considered to be (the first) part of an XML, and returns the
encoding (the specified one, or the XML default)
The XML Encoding, or null if the String was not recognized as XML (no <?xml> header found) since: MMBase-1.7.1 See Also: GenericResponseWrapper.getXMLEncoding(byte[]) |
getXMLEncoding | public static String getXMLEncoding(byte[] allBytes)(Code) | | Takes a ByteArrayInputStream, which is considered to be (the first) part of an XML, and returns the encoding.
The XML Encoding, or null if the String was not recognized as XML (not <?xml> header found) since: MMBase-1.7.1 See Also: GenericResponseWrapper.getXMLEncoding(String) |
setContentType | public void setContentType(String ct)(Code) | | Sets the content type of the response being sent to the
client. The content type may include the type of character
encoding used, for example, text/html; charset=ISO-8859-4. If
obtaining a PrintWriter, this method should be called first.
|
setStatus | public void setStatus(int s)(Code) | | |
toString | public String toString()(Code) | | Return all data that has been written to the PrintWriter.
|
|
|