Java Doc for ServletUnitHttpResponse.java in  » Testing » HttpUnit » com » meterware » servletunit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » HttpUnit » com.meterware.servletunit 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.meterware.servletunit.ServletUnitHttpResponse

ServletUnitHttpResponse
class ServletUnitHttpResponse implements HttpServletResponse(Code)




Method Summary
public  voidaddCookie(Cookie cookie)
     Adds the specified cookie to the response.
public  voidaddDateHeader(String name, long value)
     Adds a response header with the given name and value.
public  voidaddHeader(String name, String value)
     Adds a response header with the given name and value.
public  voidaddIntHeader(String name, int value)
     Adds a response header with the given name and value.
public  booleancontainsHeader(String name)
     Checks whether the response message header has a field with the specified name.
public  StringencodeRedirectURL(String url)
     Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged.
public  StringencodeRedirectUrl(String url)
    
public  StringencodeURL(String url)
     Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.
public  StringencodeUrl(String url)
    
public  voidflushBuffer()
     Forces any content in the buffer to be written to the client.
public  intgetBufferSize()
     Returns the actual buffer size used for the response.
public  StringgetCharacterEncoding()
     Returns the name of the character set encoding used for the MIME body sent by this response.
public  StringgetContentType()
     Returns the content type defined for this response.
 byte[]getContents()
     Returns the contents of this response.
 StringgetHeaderField(String name)
     Returns the headers defined for this response.
public  String[]getHeaderFieldNames()
    
public  String[]getHeaderFields(String name)
     Return an array of all the header values associated with the specified header name, or an zero-length array if there are no such header values.
public  LocalegetLocale()
     Returns the locale assigned to the response.
 StringgetMessage()
     Returns the message associated with this response's status.
public  ServletOutputStreamgetOutputStream()
     Returns a ServletOutputStream suitable for writing binary data in the response.
 intgetStatus()
     Returns the status of this response.
public  PrintWritergetWriter()
     Returns a PrintWriter object that you can use to send character text to the client.
public  booleanisCommitted()
     Returns a boolean indicating if the response has been committed.
public  voidreset()
     Clears any data that exists in the buffer as well as the status code and headers.
public  voidresetBuffer()
     Clears the content of the underlying buffer in the response without clearing headers or status code.
public  voidsendError(int sc)
     Sends an error response to the client using the specified status code and descriptive message.
public  voidsendError(int sc, String msg)
     Sends an error response to the client using the specified status code and descriptive message.
public  voidsendRedirect(String location)
     Sends a temporary redirect response to the client using the specified redirect location URL.
public  voidsetBufferSize(int size)
     Sets the preferred buffer size for the body of the response.
public  voidsetCharacterEncoding(String string)
    
public  voidsetContentLength(int len)
     Sets the length of the content the server returns to the client.
public  voidsetContentType(String type)
     Sets the content type of the response the server sends to the client.
public  voidsetDateHeader(String name, long date)
     Adds a field to the response header with the given name and date-valued field.
public  voidsetHeader(String name, String value)
     Adds a field to the response header with the given name and value. If the field had already been set, the new value overwrites the previous one.
public  voidsetIntHeader(String name, int value)
     Adds a field to the response header with the given name and integer value.
public  voidsetLocale(Locale locale)
     Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate.
public  voidsetStatus(int sc)
     Sets the status code for this response.
public  voidsetStatus(int sc, String msg)
    



Method Detail
addCookie
public void addCookie(Cookie cookie)(Code)
Adds the specified cookie to the response. It can be called multiple times to set more than one cookie.



addDateHeader
public void addDateHeader(String name, long value)(Code)
Adds a response header with the given name and value. This method allows response headers to have multiple values.



addHeader
public void addHeader(String name, String value)(Code)
Adds a response header with the given name and value. This method allows response headers to have multiple values.



addIntHeader
public void addIntHeader(String name, int value)(Code)
Adds a response header with the given name and value. This method allows response headers to have multiple values.



containsHeader
public boolean containsHeader(String name)(Code)
Checks whether the response message header has a field with the specified name.



encodeRedirectURL
public String encodeRedirectURL(String url)(Code)
Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged. The implementation of this method should include the logic to determine whether the session ID needs to be encoded in the URL. Because the rules for making this determination differ from those used to decide whether to encode a normal link, this method is seperate from the encodeUrl method.



encodeRedirectUrl
public String encodeRedirectUrl(String url)(Code)



encodeURL
public String encodeURL(String url)(Code)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. The implementation of this method should include the logic to determine whether the session ID needs to be encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary.



encodeUrl
public String encodeUrl(String url)(Code)



flushBuffer
public void flushBuffer() throws IOException(Code)
Forces any content in the buffer to be written to the client. A call to this method automatically commits the response, meaning the status code and headers will be written.



getBufferSize
public int getBufferSize()(Code)
Returns the actual buffer size used for the response. If no buffering is used, this method returns 0.



getCharacterEncoding
public String getCharacterEncoding()(Code)
Returns the name of the character set encoding used for the MIME body sent by this response.



getContentType
public String getContentType()(Code)
Returns the content type defined for this response.



getContents
byte[] getContents()(Code)
Returns the contents of this response.



getHeaderField
String getHeaderField(String name)(Code)
Returns the headers defined for this response.



getHeaderFieldNames
public String[] getHeaderFieldNames()(Code)



getHeaderFields
public String[] getHeaderFields(String name)(Code)
Return an array of all the header values associated with the specified header name, or an zero-length array if there are no such header values.
Parameters:
  name - Header name to look up



getLocale
public Locale getLocale()(Code)
Returns the locale assigned to the response.



getMessage
String getMessage()(Code)
Returns the message associated with this response's status.



getOutputStream
public ServletOutputStream getOutputStream() throws IOException(Code)
Returns a ServletOutputStream suitable for writing binary data in the response. The servlet engine does not encode the binary data.
exception:
  IllegalStateException - if you have already called the getWriter method



getStatus
int getStatus()(Code)
Returns the status of this response.



getWriter
public PrintWriter getWriter() throws UnsupportedEncodingException(Code)
Returns a PrintWriter object that you can use to send character text to the client. The character encoding used is the one specified in the charset= property of the ServletUnitHttpResponse.setContentType method, which you must call before you call this method.

If necessary, the MIME type of the response is modified to reflect the character encoding used.

You cannot use this method if you have already called ServletUnitHttpResponse.getOutputStream for this ServletResponse object.
exception:
  UnsupportedEncodingException - if the character encoding specified insetContentType cannot beused
exception:
  IllegalStateException - if the getOutputStreammethod has already been called for thisresponse object; in that case, you can'tuse this method




isCommitted
public boolean isCommitted()(Code)
Returns a boolean indicating if the response has been committed. A committed response has already had its status code and headers written.



reset
public void reset()(Code)
Clears any data that exists in the buffer as well as the status code and headers. If the response has been committed, this method throws an IllegalStateException.



resetBuffer
public void resetBuffer()(Code)
Clears the content of the underlying buffer in the response without clearing headers or status code. If the response has been committed, this method throws an IllegalStateException.
since:
   1.3



sendError
public void sendError(int sc) throws IOException(Code)
Sends an error response to the client using the specified status code and descriptive message. If setStatus has previously been called, it is reset to the error status code. The message is sent as the body of an HTML page, which is returned to the user to describe the problem. The page is sent with a default HTML header; the message is enclosed in simple body tags (<body></body>).



sendError
public void sendError(int sc, String msg) throws IOException(Code)
Sends an error response to the client using the specified status code and descriptive message. If setStatus has previously been called, it is reset to the error status code. The message is sent as the body of an HTML page, which is returned to the user to describe the problem. The page is sent with a default HTML header; the message is enclosed in simple body tags (<body></body>).



sendRedirect
public void sendRedirect(String location) throws IOException(Code)
Sends a temporary redirect response to the client using the specified redirect location URL. The URL must be absolute (for example, https://hostname/path/file.html). Relative URLs are not permitted here.



setBufferSize
public void setBufferSize(int size)(Code)
Sets the preferred buffer size for the body of the response. The servlet container will use a buffer at least as large as the size requested. The actual buffer size used can be found using getBufferSize.



setCharacterEncoding
public void setCharacterEncoding(String string)(Code)



setContentLength
public void setContentLength(int len)(Code)
Sets the length of the content the server returns to the client. In HTTP servlets, this method sets the HTTP Content-Length header.



setContentType
public void setContentType(String type)(Code)
Sets the content type of the response the server sends to the client. The content type may include the type of character encoding used, for example, text/html; charset=ISO-8859-4.

You can only use this method once, and you should call it before you obtain a PrintWriter or ServletOutputStream object to return a response.




setDateHeader
public void setDateHeader(String name, long date)(Code)
Adds a field to the response header with the given name and date-valued field. The date is specified in terms of milliseconds since the epoch. If the date field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.



setHeader
public void setHeader(String name, String value)(Code)
Adds a field to the response header with the given name and value. If the field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.



setIntHeader
public void setIntHeader(String name, int value)(Code)
Adds a field to the response header with the given name and integer value. If the field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.



setLocale
public void setLocale(Locale locale)(Code)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. This method should be called before a call to getWriter(). By default, the response locale is the default locale for the server.



setStatus
public void setStatus(int sc)(Code)
Sets the status code for this response. This method is used to set the return status code when there is no error (for example, for the status codes SC_OK or SC_MOVED_TEMPORARILY). If there is an error, the sendError method should be used instead.



setStatus
public void setStatus(int sc, String msg)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.