|
||||||||||
| 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
public class 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 | |
|---|---|
protected String |
redirected
|
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. |
String |
getRedirected()
|
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, getContentType, getResponse, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, 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, getContentType, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength |
| Field Detail |
|---|
public static String TEXT_XML_DEFAULT_CHARSET
protected String redirected
| Constructor Detail |
|---|
public GenericResponseWrapper(HttpServletResponse resp)
public GenericResponseWrapper(HttpServletResponse resp,
String encoding)
| Method Detail |
|---|
public HttpServletResponse getHttpServletResponse()
public void sendRedirect(String location)
throws IOException
sendRedirect in interface HttpServletResponsesendRedirect in class HttpServletResponseWrapperIOExceptionpublic String getRedirected()
public void setStatus(int s)
setStatus in interface HttpServletResponsesetStatus in class HttpServletResponseWrapperpublic void addCookie(Cookie c)
addCookie in interface HttpServletResponseaddCookie in class HttpServletResponseWrapper
public void setHeader(String header,
String value)
setHeader in interface HttpServletResponsesetHeader in class HttpServletResponseWrapper
public void addDateHeader(String arg0,
long arg1)
addDateHeader in interface HttpServletResponseaddDateHeader in class HttpServletResponseWrapperHttpServletResponse.addDateHeader(java.lang.String, long)
public void addHeader(String arg0,
String arg1)
addHeader in interface HttpServletResponseaddHeader in class HttpServletResponseWrapperHttpServletResponse.addHeader(java.lang.String, java.lang.String)
public void addIntHeader(String arg0,
int arg1)
addIntHeader in interface HttpServletResponseaddIntHeader in class HttpServletResponseWrapperHttpServletResponse.addIntHeader(java.lang.String, int)public boolean containsHeader(String arg0)
containsHeader in interface HttpServletResponsecontainsHeader in class HttpServletResponseWrapperHttpServletResponse.containsHeader(java.lang.String)public String encodeRedirectURL(String arg0)
encodeRedirectURL in interface HttpServletResponseencodeRedirectURL in class HttpServletResponseWrapperHttpServletResponse.encodeRedirectURL(java.lang.String)public String encodeURL(String arg0)
encodeURL in interface HttpServletResponseencodeURL in class HttpServletResponseWrapperHttpServletResponse.encodeURL(java.lang.String)public Locale getLocale()
getLocale in interface ServletResponsegetLocale in class ServletResponseWrapperServletResponse.getLocale()
public void sendError(int arg0,
String arg1)
throws IOException
sendError in interface HttpServletResponsesendError in class HttpServletResponseWrapperIOExceptionHttpServletResponse.sendError(int, java.lang.String)
public void sendError(int arg0)
throws IOException
sendError in interface HttpServletResponsesendError in class HttpServletResponseWrapperIOExceptionHttpServletResponse.sendError(int)
public void setDateHeader(String arg0,
long arg1)
setDateHeader in interface HttpServletResponsesetDateHeader in class HttpServletResponseWrapperHttpServletResponse.setDateHeader(java.lang.String, long)
public void setIntHeader(String arg0,
int arg1)
setIntHeader in interface HttpServletResponsesetIntHeader in class HttpServletResponseWrapperHttpServletResponse.setIntHeader(java.lang.String, int)public void setLocale(Locale arg0)
setLocale in interface ServletResponsesetLocale in class ServletResponseWrapperServletResponse.setLocale(java.util.Locale)
public ServletOutputStream getOutputStream()
throws IOException
getOutputStream in interface ServletResponsegetOutputStream in class ServletResponseWrapperIOException
public PrintWriter getWriter()
throws IOException
getWriter in interface ServletResponsegetWriter in class ServletResponseWrapperIOExceptionpublic void setContentType(String ct)
setContentType in interface ServletResponsesetContentType in class ServletResponseWrapperpublic String getCharacterEncoding()
getCharacterEncoding in interface ServletResponsegetCharacterEncoding in class ServletResponseWrapperprotected byte[] determinXMLEncoding()
public String toString()
toString in class Objectpublic 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 | |||||||||