Java Doc for ResponseContext.java in  » Forum » JForum-2.1.8 » net » jforum » context » 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 » Forum » JForum 2.1.8 » net.jforum.context 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


net.jforum.context.ResponseContext

All known Subclasses:   net.jforum.context.web.WebResponseContext,
ResponseContext
public interface ResponseContext (Code)
User: SergeMaslyukov Date: 20.08.2006 Time: 18:48:56

$Id: WebContextResponse.java,v 1.1 2006/08/20 15:30:30 sergemaslyukov Exp $





Method Summary
public  voidaddCookie(Cookie cookie)
     Adds the specified cookie to the response.
public  voidaddHeader(String name, String value)
     Adds a response header with the given name and value.
public  booleancontainsHeader(String name)
     Returns a boolean indicating whether the named response header has already been set.
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  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  StringgetCharacterEncoding()
     Returns the name of the character encoding (MIME charset) used for the body sent in this response.
public  ServletOutputStreamgetOutputStream()
     Returns a javax.servlet.ServletOutputStream suitable for writing binary data in the response.
public  PrintWritergetWriter()
     Returns a PrintWriter object that can send character text to the client.
public  voidsendError(int sc)
     Sends an error response to the client using the specified status code and clearing the buffer.
public  voidsendRedirect(String location)
     Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client.
public  voidsetContentLength(int len)
     Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.
public  voidsetContentType(String type)
     Sets the content type of the response being sent to the client, if the response has not been committed yet.
public  voidsetHeader(String name, String value)
     Sets a response header with the given name and value.



Method Detail
addCookie
public void addCookie(Cookie cookie)(Code)
Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie.
Parameters:
  cookie - the Cookie to return to the client



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.
Parameters:
  name - the name of the header
Parameters:
  value - the additional header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)



containsHeader
public boolean containsHeader(String name)(Code)
Returns a boolean indicating whether the named response header has already been set.
Parameters:
  name - the header name true if the named response header has already been set;false otherwise



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 includes the logic to determine whether the session ID needs to be encoded in the URL. Because the rules for making this determination can differ from those used to decide whether to encode a normal link, this method is separated from the encodeURL method.

All URLs sent to the HttpServletResponse.sendRedirect method should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
Parameters:
  url - the url to be encoded. the encoded URL if encoding is needed; the unchanged URL otherwise.
See Also:   ResponseContext.sendRedirect
See Also:   ResponseContext.encodeUrl




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 includes 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.

For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
Parameters:
  url - the url to be encoded. the encoded URL if encoding is needed; the unchanged URL otherwise.




getCharacterEncoding
public String getCharacterEncoding()(Code)
Returns the name of the character encoding (MIME charset) used for the body sent in this response. The character encoding may have been specified explicitly using the ResponseContext.setCharacterEncoding or ResponseContext.setContentType methods, or implicitly using the ResponseContext.setLocale method. Explicit specifications take precedence over implicit specifications. Calls made to these methods after getWriter has been called or after the response has been committed have no effect on the character encoding. If no character encoding has been specified, ISO-8859-1 is returned.

See RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt) for more information about character encoding and MIME. a String specifying the name of the character encoding, for example,UTF-8




getOutputStream
public ServletOutputStream getOutputStream() throws IOException(Code)
Returns a javax.servlet.ServletOutputStream suitable for writing binary data in the response. The servlet container does not encode the binary data.

Calling flush() on the ServletOutputStream commits the response. Either this method or ResponseContext.getWriter may be called to write the body, not both. a javax.servlet.ServletOutputStream for writing binary data
exception:
  IllegalStateException - if the getWriter method has been called on this response
exception:
  IOException - if an input or output exception occurred
See Also:   ResponseContext.getWriter




getWriter
public PrintWriter getWriter() throws IOException(Code)
Returns a PrintWriter object that can send character text to the client. The PrintWriter uses the character encoding returned by ResponseContext.getCharacterEncoding . If the response's character encoding has not been specified as described in getCharacterEncoding (i.e., the method just returns the default value ISO-8859-1), getWriter updates it to ISO-8859-1.

Calling flush() on the PrintWriter commits the response.

Either this method or ResponseContext.getOutputStream may be called to write the body, not both. a PrintWriter object that can return character data to the client
exception:
  java.io.UnsupportedEncodingException - if the character encoding returned by getCharacterEncoding cannot be used
exception:
  IllegalStateException - if the getOutputStream method has already been called for this response object
exception:
  IOException - if an input or output exception occurred
See Also:   ResponseContext.getOutputStream
See Also:   ResponseContext.setCharacterEncoding




sendError
public void sendError(int sc) throws IOException(Code)
Sends an error response to the client using the specified status code and clearing the buffer.

If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
Parameters:
  sc - the error status code
exception:
  java.io.IOException - If an input or output exception occurs
exception:
  IllegalStateException - If the response was committed before this method call




sendRedirect
public void sendRedirect(String location) throws IOException(Code)
Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root.

If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
Parameters:
  location - the redirect location URL
exception:
  IOException - If an input or output exception occurs
exception:
  IllegalStateException - If the response was committed or if a partial URL is given and cannot be converted into a valid URL




setContentLength
public void setContentLength(int len)(Code)
Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.
Parameters:
  len - an integer specifying the length of the content being returned to the client; sets the Content-Length header



setContentType
public void setContentType(String type)(Code)
Sets the content type of the response being sent to the client, if the response has not been committed yet. The given content type may include a character encoding specification, for example, text/html;charset=UTF-8. The response's character encoding is only set from the given content type if this method is called before getWriter is called.

This method may be called repeatedly to change content type and character encoding. This method has no effect if called after the response has been committed. It does not set the response's character encoding if it is called after getWriter has been called or after the response has been committed.

Containers must communicate the content type and the character encoding used for the servlet response's writer to the client if the protocol provides a way for doing so. In the case of HTTP, the Content-Type header is used.
Parameters:
  type - a String specifying the MIME type of the content
See Also:   ResponseContext.setLocale
See Also:   ResponseContext.setCharacterEncoding
See Also:   ResponseContext.getOutputStream
See Also:   ResponseContext.getWriter




setHeader
public void setHeader(String name, String value)(Code)
Sets a response header with the given name and value. If the header 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.
Parameters:
  name - the name of the header
Parameters:
  value - the header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)
See Also:   ResponseContext.containsHeader
See Also:   ResponseContext.addHeader



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