|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.ServletResponseWrapper
javax.servlet.http.HttpServletResponseWrapper
org.mmbase.util.GenericResponseWrapper
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.
| Field Summary | |
static String |
TEXT_XML_DEFAULT_CHARSET
|
| Constructor Summary | |
GenericResponseWrapper(HttpServletResponse resp)
Public constructor |
|
GenericResponseWrapper(HttpServletResponse resp,
String encoding)
Sets also a value for the characterEncoding which must be supposed. |
|
| Method Summary | |
void |
addCookie(Cookie c)
|
void |
addDateHeader(String arg0,
long arg1)
|
void |
addHeader(String arg0,
String arg1)
|
void |
addIntHeader(String arg0,
int arg1)
|
boolean |
containsHeader(String arg0)
|
protected byte[] |
determinXMLEncoding()
|
String |
encodeRedirectURL(String arg0)
|
String |
encodeURL(String arg0)
|
String |
getCharacterEncoding()
Returns the name of the charset used for the MIME body sent in this response. |
static String |
getDefaultEncoding(String contentType)
Supposes that no explicit charset is mentioned in a contentType, and returns a default. |
static String |
getEncoding(String contentType)
Takes the value of a Content-Type header, and tries to find the encoding from it. |
HttpServletResponse |
getHttpServletResponse()
Gets the response object which this wrapper is wrapping. |
Locale |
getLocale()
|
ServletOutputStream |
getOutputStream()
Return the OutputStream. |
PrintWriter |
getWriter()
Return the PrintWriter |
static String |
getXMLEncoding(byte[] allBytes)
Takes a ByteArrayInputStream, which is considered to be (the first) part of an XML, and returns the encoding. |
static String |
getXMLEncoding(String xmlString)
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) |
void |
sendError(int arg0)
|
void |
sendError(int arg0,
String arg1)
|
void |
sendRedirect(String location)
|
void |
setContentType(String ct)
Sets the content type of the response being sent to the client. |
void |
setDateHeader(String arg0,
long arg1)
|
void |
setHeader(String header,
String value)
|
void |
setIntHeader(String arg0,
int arg1)
|
void |
setLocale(Locale arg0)
|
void |
setStatus(int s)
|
String |
toString()
Return all data that has been written to the PrintWriter. |
| Methods inherited from class javax.servlet.http.HttpServletResponseWrapper |
encodeRedirectUrl, encodeUrl, setStatus |
| Methods inherited from class javax.servlet.ServletResponseWrapper |
flushBuffer, getBufferSize, getResponse, isCommitted, reset, resetBuffer, setBufferSize, setContentLength, setResponse |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface javax.servlet.ServletResponse |
flushBuffer, getBufferSize, isCommitted, reset, resetBuffer, setBufferSize, setContentLength |
| Field Detail |
public static String TEXT_XML_DEFAULT_CHARSET
| Constructor Detail |
public GenericResponseWrapper(HttpServletResponse resp)
public GenericResponseWrapper(HttpServletResponse resp,
String encoding)
| Method Detail |
public HttpServletResponse getHttpServletResponse()
public void sendRedirect(String location)
throws IOException
IOExceptionpublic void setStatus(int s)
public void addCookie(Cookie c)
public void setHeader(String header,
String value)
public void addDateHeader(String arg0,
long arg1)
HttpServletResponse.addDateHeader(java.lang.String, long)
public void addHeader(String arg0,
String arg1)
HttpServletResponse.addHeader(java.lang.String, java.lang.String)
public void addIntHeader(String arg0,
int arg1)
HttpServletResponse.addIntHeader(java.lang.String, int)public boolean containsHeader(String arg0)
HttpServletResponse.containsHeader(java.lang.String)public String encodeRedirectURL(String arg0)
HttpServletResponse.encodeRedirectURL(java.lang.String)public String encodeURL(String arg0)
HttpServletResponse.encodeURL(java.lang.String)public Locale getLocale()
ServletResponse.getLocale()
public void sendError(int arg0,
String arg1)
throws IOException
IOExceptionHttpServletResponse.sendError(int, java.lang.String)
public void sendError(int arg0)
throws IOException
IOExceptionHttpServletResponse.sendError(int)
public void setDateHeader(String arg0,
long arg1)
HttpServletResponse.setDateHeader(java.lang.String, long)
public void setIntHeader(String arg0,
int arg1)
HttpServletResponse.setIntHeader(java.lang.String, int)public void setLocale(Locale arg0)
ServletResponse.setLocale(java.util.Locale)
public ServletOutputStream getOutputStream()
throws IOException
IOException
public PrintWriter getWriter()
throws IOException
IOExceptionpublic void setContentType(String ct)
public String getCharacterEncoding()
protected byte[] determinXMLEncoding()
public String toString()
public static final String getXMLEncoding(String xmlString)
null if the String was not recognized as XML (no <?xml> header found)getXMLEncoding(byte[])public static String getXMLEncoding(byte[] allBytes)
null if the String was not recognized as XML (not <?xml> header found)getXMLEncoding(String)public static String getEncoding(String contentType)
public static String getDefaultEncoding(String contentType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||