Java Doc for HttpResponse.java in  » Web-Server » Quadcap-Web-Server » com » quadcap » http » server22 » 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 » Web Server » Quadcap Web Server » com.quadcap.http.server22 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.quadcap.http.server22.HttpResponse

HttpResponse
public class HttpResponse implements HttpServletResponse(Code)
An HTTP servlet response. This interface allows a servlet's service method to manipulate HTTP-protocol specified header information and return data to its client. It is implemented by network service developers for use within servlets.
author:
   Stan Bailes


Field Summary
final static  byte[]CONNECTION_CLOSE
    
final static  byte[]CONNECTION_KEEPALIVE
    
final static  byte[]CONTENT_LENGTH
    
final static  byte[]CONTENT_TYPE
    
final static  byte[]CRLF
    
final static  byte[]DEFAULT_CONTENT_TYPE
    
static  TimeZoneGMT
    
static  byte[]GMTString
    
final static  byte[]OKRESPONSE
    
 booleananyHeaders
    
 longcalbase
    
 booleanchangedCode
    
 intcontentLength
    
 StringcontentType
    
static  DateFormatcookieDateFormat
    
 Vectorcookies
    
 byte[]curTime
    
 LocaledefaultLocale
    
static  SimpleDateFormatdf
    
static  SimpleDateFormatdf2
    
static  byte[]digits
    
 ByteArrayOutputStreamfixedH
    
 byte[]fixedHeaders
    
public  booleangetOutputStreamCalled
    
public  booleangetWriterCalled
    
 StringBufferheaderBuf
    
 booleanheaderBufValid
    
final static  byte[]headerSep
    
 Hashtableheaders
    
 JspWriterjWriter
    
 booleanjWriterInit
    
 booleankeepAlive
    
 Localelocale
    
 HttpOutputStreamos
    
 Stringprotocol
    
 intsc
    
 Stringsm
    
 WebWorkerw
    
 PrintWriterwriter
    

Constructor Summary
public  HttpResponse(WebWorker w)
     Construct a new HttpResponse for the specified worker.

Method Summary
public  voidaddCookie(Cookie cookie)
     Adds the specified cookie to the response.
public  voidaddDateHeader(String name, long date)
    
public  voidaddHeader(String name, String value)
     Add a new header value -- this method allows multiple headers with the same name.
public  voidaddIntHeader(String name, int value)
    
final  voidappendHeader(String name, String value)
    
public  booleancontainsHeader(String name)
     Checks whether the response message header has a field with the specified name.
public  StringencodeRedirectURL(String url)
    
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)
    
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. 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.

All URLs emitted by a Servlet should be run through this method.

 voidflush()
    
public  voidflushBuffer()
    
public  intgetBufferSize()
    
public  StringgetCharacterEncoding()
     Returns the character set encoding used for this MIME body.
 intgetContentLength()
    
public  JspWritergetJspWriter(int bufferSize, boolean autoFlush)
    
public  LocalegetLocale()
    
public  ServletOutputStreamgetOutputStream()
     Returns an output stream for writing binary response data.
public  PrintWritergetWriter()
     Returns a print writer for writing formatted text responses.
public  booleanisCommitted()
    
final  voidmaybeSetContentLength(int len)
    
public  voidreset(HttpOutputStream os)
    
public  voidreset()
    
public  voidsendError(int scode, String msg)
     Sends an error response to the client using the specified status code and descriptive message.
public  voidsendError(int scode)
     Sends an error response to the client using the specified status code and a default message.
public  voidsendRedirect(String location)
     Sends a temporary redirect response to the client using the specified redirect location URL.
public  voidsetBufferSize(int size)
    
public  voidsetContentLength(int len)
     Sets the content length for this response.
public  voidsetContentType(String type)
     Sets the content type for this response.
public  voidsetDateHeader(String name, long date)
     Adds a field to the response header with the given name and date-valued field.
final  voidsetFixedHeader(String name, String val)
    
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.
 voidsetKeepAlive(boolean v)
    
public  voidsetLocale(Locale locale)
    
 voidsetProtocol(String p)
    
public  voidsetStatus(int sc, String sm)
     Sets the status code and message for this response.
public  voidsetStatus(int sc)
     Sets the status code for this response.
final static  voidwrite(OutputStream out, String s)
    
 voidwriteAttr(WorkerOutputStream out, String name, String val)
    
 voidwriteCookies(WorkerOutputStream out)
    
final  voidwriteDateHeader(WorkerOutputStream out)
    
final  voidwriteHeader(WorkerOutputStream out, String name, String val)
    
public  voidwriteHeaders()
    

Field Detail
CONNECTION_CLOSE
final static byte[] CONNECTION_CLOSE(Code)



CONNECTION_KEEPALIVE
final static byte[] CONNECTION_KEEPALIVE(Code)



CONTENT_LENGTH
final static byte[] CONTENT_LENGTH(Code)



CONTENT_TYPE
final static byte[] CONTENT_TYPE(Code)



CRLF
final static byte[] CRLF(Code)



DEFAULT_CONTENT_TYPE
final static byte[] DEFAULT_CONTENT_TYPE(Code)



GMT
static TimeZone GMT(Code)



GMTString
static byte[] GMTString(Code)



OKRESPONSE
final static byte[] OKRESPONSE(Code)



anyHeaders
boolean anyHeaders(Code)



calbase
long calbase(Code)



changedCode
boolean changedCode(Code)



contentLength
int contentLength(Code)



contentType
String contentType(Code)



cookieDateFormat
static DateFormat cookieDateFormat(Code)



cookies
Vector cookies(Code)



curTime
byte[] curTime(Code)



defaultLocale
Locale defaultLocale(Code)



df
static SimpleDateFormat df(Code)



df2
static SimpleDateFormat df2(Code)



digits
static byte[] digits(Code)



fixedH
ByteArrayOutputStream fixedH(Code)



fixedHeaders
byte[] fixedHeaders(Code)



getOutputStreamCalled
public boolean getOutputStreamCalled(Code)



getWriterCalled
public boolean getWriterCalled(Code)



headerBuf
StringBuffer headerBuf(Code)



headerBufValid
boolean headerBufValid(Code)



headerSep
final static byte[] headerSep(Code)



headers
Hashtable headers(Code)



jWriter
JspWriter jWriter(Code)



jWriterInit
boolean jWriterInit(Code)



keepAlive
boolean keepAlive(Code)



locale
Locale locale(Code)



os
HttpOutputStream os(Code)



protocol
String protocol(Code)



sc
int sc(Code)



sm
String sm(Code)



w
WebWorker w(Code)



writer
PrintWriter writer(Code)




Constructor Detail
HttpResponse
public HttpResponse(WebWorker w)(Code)
Construct a new HttpResponse for the specified worker.
Parameters:
  w - the worker handling this http request




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.
Parameters:
  cookie - the Cookie to return to the client



addDateHeader
public void addDateHeader(String name, long date)(Code)



addHeader
public void addHeader(String name, String value)(Code)
Add a new header value -- this method allows multiple headers with the same name.



addIntHeader
public void addIntHeader(String name, int value)(Code)



appendHeader
final void appendHeader(String name, String value)(Code)



containsHeader
public boolean containsHeader(String name)(Code)
Checks whether the response message header has a field with the specified name.
Parameters:
  name - the header field name true if the response message header has a field withthe specified name; false otherwise



encodeRedirectURL
public String encodeRedirectURL(String url)(Code)



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.

All URLs sent to the HttpServletResponse.sendRedirect method should be run through this method. Otherwise, URL rewriting canont 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 URLotherwise.




encodeURL
public String encodeURL(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.

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




flush
void flush() throws IOException(Code)
Flush the underlying output stream



flushBuffer
public void flushBuffer() throws IOException(Code)



getBufferSize
public int getBufferSize()(Code)



getCharacterEncoding
public String getCharacterEncoding()(Code)
Returns the character set encoding used for this MIME body. The character encoding is either the one specified in the assigned content type, or one which the client understands. If no content type has yet been assigned, it is implicitly set to text/plain



getContentLength
int getContentLength()(Code)



getJspWriter
public JspWriter getJspWriter(int bufferSize, boolean autoFlush) throws IOException(Code)



getLocale
public Locale getLocale()(Code)



getOutputStream
public ServletOutputStream getOutputStream() throws IOException(Code)
Returns an output stream for writing binary response data.
exception:
  IllegalStateException - if getWriter has beencalled on this same request.
exception:
  IOException - if an I/O exception has occurred



getWriter
public PrintWriter getWriter() throws IOException(Code)
Returns a print writer for writing formatted text responses. The MIME type of the response will be modified, if necessary, to reflect the character encoding used, through the charset=... property. This means that the content type must be set before calling this method.
exception:
  UnsupportedEncodingException - if no such encoding canbe provided
exception:
  IllegalStateException - if getOutputStream has beencalled on this same request.
exception:
  IOException - on other errors.



isCommitted
public boolean isCommitted()(Code)



maybeSetContentLength
final void maybeSetContentLength(int len)(Code)



reset
public void reset(HttpOutputStream os)(Code)



reset
public void reset() throws IllegalStateException(Code)



sendError
public void sendError(int scode, 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>).
Parameters:
  sc - the status code
Parameters:
  msg - the detail message
exception:
  IOException - If an I/O error has occurred.



sendError
public void sendError(int scode) throws IOException(Code)
Sends an error response to the client using the specified status code and a default message.
Parameters:
  scode - the status code
exception:
  IOException - If an I/O error has occurred.



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.
Parameters:
  location - the redirect location URL
exception:
  IOException - If an I/O error has occurred.



setBufferSize
public void setBufferSize(int size) throws IllegalStateException(Code)



setContentLength
public void setContentLength(int len)(Code)
Sets the content length for this response.
Parameters:
  len - the content length



setContentType
public void setContentType(String type)(Code)
Sets the content type for this response. This type may later be implicitly modified by addition of properties such as the MIME charset=<value> if the service finds it necessary, and the appropriate media type property has not been set.

This response property may only be assigned one time. If a writer is to be used to write a text response, this method must be called before the method getWriter. If an output stream will be used to write a response, this method must be called before the output stream is used to write response data.
Parameters:
  type - the content's MIME type




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.
Parameters:
  name - the name of the header field
Parameters:
  value - the header field's date value



setFixedHeader
final void setFixedHeader(String name, String val)(Code)



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.
Parameters:
  name - the name of the header field
Parameters:
  value - the header field's 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.
Parameters:
  name - the name of the header field
Parameters:
  value - the header field's integer value



setKeepAlive
void setKeepAlive(boolean v)(Code)



setLocale
public void setLocale(Locale locale)(Code)



setProtocol
void setProtocol(String p)(Code)



setStatus
public void setStatus(int sc, String sm)(Code)
Sets the status code and message for this response. If the field had already been set, the new value overwrites the previous one. 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>).
Parameters:
  sc - the status code
Parameters:
  sm - the status message



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.
Parameters:
  sc - the status code



write
final static void write(OutputStream out, String s) throws IOException(Code)



writeAttr
void writeAttr(WorkerOutputStream out, String name, String val) throws IOException(Code)



writeCookies
void writeCookies(WorkerOutputStream out) throws IOException(Code)



writeDateHeader
final void writeDateHeader(WorkerOutputStream out) throws IOException(Code)



writeHeader
final void writeHeader(WorkerOutputStream out, String name, String val) throws IOException(Code)



writeHeaders
public void writeHeaders() throws IOException(Code)
Write the result code and the message headers for the response



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.