|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.tui.MockHttpServletResponse
public class MockHttpServletResponse
This is a partial implementation of the HttpServletResponse where just enough is present to allow for communication between Mondrian's XMLA code and other code in the same JVM. Currently it is used in both the CmdRunner and in XMLA JUnit tests.
If you need to add to this implementation, please do so.
Nested Class Summary | |
---|---|
(package private) static class |
MockHttpServletResponse.MockServletOutputStream
|
Field Summary | |
---|---|
static String |
DATE_FORMAT_HEADER
|
Constructor Summary | |
---|---|
MockHttpServletResponse()
|
Method Summary | |
---|---|
void |
addCookie(Cookie cookie)
Adds the specified cookie to the response. |
void |
addDateHeader(String name,
long date)
Adds a response header with the given name and date-value. |
void |
addHeader(String name,
String value)
Adds a response header with the given name and value. |
void |
addIntHeader(String name,
int value)
Adds a response header with the given name and integer value. |
boolean |
containsHeader(String name)
Returns a boolean indicating whether the named response header has already been set. |
protected String |
encode(String s)
|
String |
encodeRedirectUrl(String s)
Deprecated. Method encodeRedirectUrl is deprecated |
String |
encodeRedirectURL(String url)
Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged. |
String |
encodeUrl(String s)
Deprecated. Method encodeUrl is deprecated |
String |
encodeURL(String url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. |
void |
flushBuffer()
Forces any content in the buffer to be written to the client. |
int |
getBufferSize()
Returns the actual buffer size used for the response. |
String |
getCharacterEncoding()
Returns the name of the charset used for the MIME body sent in this response. |
String |
getContentType()
|
List |
getCookies()
|
int |
getErrorCode()
|
String |
getHeader(String name)
|
List<String> |
getHeaderList(String name)
|
Locale |
getLocale()
Returns the locale assigned to the response. |
ServletOutputStream |
getOutputStream()
Returns a ServletOutputStream suitable for writing binary data in the response. |
int |
getStatusCode()
|
PrintWriter |
getWriter()
Returns a PrintWriter object that can send character text to the client. |
boolean |
isCommitted()
Returns a boolean indicating if the response has been committed. |
void |
reset()
Clears any data that exists in the buffer as well as the status code and headers. |
void |
resetBuffer()
|
void |
sendError(int code)
Sends an error response to the client using the specified status. |
void |
sendError(int code,
String msg)
Sends an error response to the client using the specified status code and descriptive message. |
void |
sendRedirect(String location)
Sends a temporary redirect response to the client using the specified redirect location URL. |
void |
setBufferSize(int size)
Sets the preferred buffer size for the body of the response. |
void |
setCharacterEncoding(String charEncoding)
|
void |
setContentLength(int len)
Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header. |
void |
setContentType(String contentType)
Sets the content type of the response being sent to the client. |
void |
setDateHeader(String name,
long date)
Sets a response header with the given name and date-value. |
void |
setHeader(String name,
String value)
Sets a response header with the given name and value. |
void |
setIntHeader(String name,
int value)
Sets a response header with the given name and integer value. |
void |
setLocale(Locale locale)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. |
void |
setStatus(int status)
Sets the status code for this response. |
void |
setStatus(int status,
String s)
Deprecated. Method setStatus is deprecated Deprecated. As of version 2.1, due to ambiguous meaning of the message parameter. To set a status code use setStatus(int), to send an error with a description use sendError(int, String). Sets the status code and message for this response. |
byte[] |
toByteArray()
|
boolean |
wasErrorSent()
|
boolean |
wasRedirectSent()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DATE_FORMAT_HEADER
Constructor Detail |
---|
public MockHttpServletResponse()
Method Detail |
---|
public String getCharacterEncoding()
getCharacterEncoding
in interface ServletResponse
public ServletOutputStream getOutputStream() throws IOException
getOutputStream
in interface ServletResponse
IOException
public PrintWriter getWriter() throws IOException
getWriter
in interface ServletResponse
IOException
public void setCharacterEncoding(String charEncoding)
setCharacterEncoding
in interface ServletResponse
public void setContentLength(int len)
setContentLength
in interface ServletResponse
public void setContentType(String contentType)
setContentType
in interface ServletResponse
public void setBufferSize(int size)
setBufferSize
in interface ServletResponse
public int getBufferSize()
getBufferSize
in interface ServletResponse
public void flushBuffer() throws IOException
flushBuffer
in interface ServletResponse
IOException
public void resetBuffer()
resetBuffer
in interface ServletResponse
public boolean isCommitted()
isCommitted
in interface ServletResponse
public void reset()
reset
in interface ServletResponse
public void setLocale(Locale locale)
setLocale
in interface ServletResponse
public Locale getLocale()
getLocale
in interface ServletResponse
public void addCookie(Cookie cookie)
addCookie
in interface HttpServletResponse
public boolean containsHeader(String name)
containsHeader
in interface HttpServletResponse
public String encodeURL(String url)
encodeURL
in interface HttpServletResponse
public String encodeRedirectURL(String url)
encodeRedirectURL
in interface HttpServletResponse
public String encodeUrl(String s)
encodeUrl
in interface HttpServletResponse
public String encodeRedirectUrl(String s)
encodeRedirectUrl
in interface HttpServletResponse
public void sendError(int code, String msg) throws IOException
sendError
in interface HttpServletResponse
IOException
public void sendError(int code) throws IOException
sendError
in interface HttpServletResponse
IOException
public void sendRedirect(String location) throws IOException
sendRedirect
in interface HttpServletResponse
IOException
public void setDateHeader(String name, long date)
setDateHeader
in interface HttpServletResponse
public void addDateHeader(String name, long date)
addDateHeader
in interface HttpServletResponse
public void setHeader(String name, String value)
setHeader
in interface HttpServletResponse
public void addHeader(String name, String value)
addHeader
in interface HttpServletResponse
public void setIntHeader(String name, int value)
setIntHeader
in interface HttpServletResponse
public void addIntHeader(String name, int value)
addIntHeader
in interface HttpServletResponse
public void setStatus(int status)
setStatus
in interface HttpServletResponse
public void setStatus(int status, String s)
setStatus
in interface HttpServletResponse
public byte[] toByteArray() throws IOException
IOException
public String getHeader(String name)
public String getContentType()
getContentType
in interface ServletResponse
public List<String> getHeaderList(String name)
public int getStatusCode()
public int getErrorCode()
public List getCookies()
public boolean wasErrorSent()
public boolean wasRedirectSent()
protected String encode(String s)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |