public abstract class AbstractHttpResponse
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
AbstractHttpResponse(AbstractHttpRequest request) |
Modifier and Type | Method and Description |
---|---|
void |
addDateHeader(java.lang.String key,
long value)
Convenience for adding a date header.
|
void |
addFooter(java.lang.String key,
java.lang.String value)
Adds a new footer.
|
void |
addHeader(java.lang.String key,
java.lang.String value)
Adds a new header.
|
void |
addHeaderImpl(java.lang.String key,
java.lang.String value)
Adds a new header.
|
void |
addIntHeader(java.lang.String key,
int value)
Convenience for adding an integer header.
|
void |
clientDisconnect()
Called when the client has disconnected
|
void |
close()
Closes the request, called from web-app for early close.
|
boolean |
containsHeader(java.lang.String name)
Returns true if the response already contains the named header.
|
protected abstract AbstractResponseStream |
createResponseStream() |
boolean |
fillCookie(CharBuffer cb,
Cookie cookie,
long date,
int version,
boolean isCookie2)
Fills the response for a cookie
|
byte[] |
fillDateBuffer(long now) |
byte[] |
fillLogDateBuffer(long now,
java.lang.String timeFormat) |
void |
finishInvocation()
Complete the invocation.
|
void |
finishRequest()
Complete the invocation.
|
protected void |
free() |
protected QDate |
getCalendar() |
int |
getContentLength()
Returns the number of bytes sent to the output.
|
long |
getContentLengthHeader()
Returns the value of the content-length header.
|
int |
getDateBufferLength() |
java.util.ArrayList<java.lang.String> |
getFooterKeys() |
java.util.ArrayList<java.lang.String> |
getFooterValues() |
java.lang.String |
getHeader(java.lang.String name)
Returns the value of an already set output header.
|
java.util.ArrayList<java.lang.String> |
getHeaderKeys() |
java.util.Collection<java.lang.String> |
getHeaderNames() |
java.util.Collection<java.lang.String> |
getHeaders(java.lang.String name) |
java.util.ArrayList<java.lang.String> |
getHeaderValues() |
LogBuffer |
getLogBuffer() |
int |
getLogDateBufferLength() |
int |
getRawDateBufferLength() |
int |
getRawDateBufferOffset() |
AbstractHttpRequest |
getRequest()
Returns the corresponding request.
|
ServletResponse |
getResponse()
Returns the next response.
|
protected ServletOutputStreamImpl |
getResponseOutputStream() |
protected ResponseWriter |
getResponsePrintWriter() |
protected AbstractResponseStream |
getResponseStream()
Gets the response stream.
|
java.lang.String |
getServerHeader() |
protected boolean |
hasFooter() |
boolean |
isClosed()
Returns true for closed requests.
|
boolean |
isCommitted()
Returns true if some data has been sent to the browser.
|
boolean |
isConnectionClosed()
Return true if the connection has disconnected
|
protected boolean |
isHead()
For a HEAD request, the response stream should write no data.
|
boolean |
isHeaderWritten()
Returns true if the headers have been written.
|
boolean |
isIgnoreClientDisconnect()
If set true, client disconnect exceptions are no propagated to the
server code.
|
protected static com.caucho.server.http.ContentType |
parseContentType(java.lang.String contentType) |
void |
removeHeader(java.lang.String key) |
protected void |
reset() |
void |
setContentLength(long length)
Sets the content length of the result.
|
void |
setDateHeader(java.lang.String name,
long value)
Convenience for setting a date header.
|
void |
setFooter(java.lang.String key,
java.lang.String value)
Sets a footer, replacing an already-existing footer
|
protected void |
setHead()
For a HEAD request, the response stream should write no data.
|
void |
setHeader(java.lang.String key,
java.lang.String value)
Sets a header, replacing an already-existing header.
|
protected void |
setHeaderImpl(java.lang.String key,
java.lang.String value)
Sets a header, replacing an already-existing header.
|
void |
setHeaderWritten(boolean isWritten)
Returns true if the headers have been written.
|
void |
setIntHeader(java.lang.String name,
int value)
Convenience for setting an integer header.
|
protected boolean |
setSpecial(java.lang.String key,
java.lang.String value)
Special processing for a special value.
|
void |
startInvocation() |
void |
startRequest()
Initializes the Response at the beginning of the request.
|
protected void |
writeContinueInt()
Writes the continue
|
boolean |
writeHeaders(int length)
Writes the headers to the stream.
|
protected abstract boolean |
writeHeadersInt(int length,
boolean isHead) |
protected AbstractHttpResponse(AbstractHttpRequest request)
protected final QDate getCalendar()
public boolean isIgnoreClientDisconnect()
public boolean isConnectionClosed()
public void clientDisconnect()
public ServletResponse getResponse()
public AbstractHttpRequest getRequest()
public boolean isClosed()
public void startRequest() throws java.io.IOException
java.io.IOException
public void startInvocation()
protected abstract AbstractResponseStream createResponseStream()
protected void setHead()
protected final boolean isHead()
public boolean containsHeader(java.lang.String name)
name
- name of the header to test.public java.lang.String getHeader(java.lang.String name)
name
- name of the header to get.public void setHeader(java.lang.String key, java.lang.String value)
key
- the header key to set.value
- the header value to set.protected void setHeaderImpl(java.lang.String key, java.lang.String value)
key
- the header key to set.value
- the header value to set.public void addHeader(java.lang.String key, java.lang.String value)
key
- the header key.value
- the header value.public void addHeaderImpl(java.lang.String key, java.lang.String value)
key
- the header key.value
- the header value.protected static com.caucho.server.http.ContentType parseContentType(java.lang.String contentType)
protected boolean setSpecial(java.lang.String key, java.lang.String value)
public void removeHeader(java.lang.String key)
public void setIntHeader(java.lang.String name, int value)
name
- the header name.value
- an integer to be converted to a string for the header.public void addIntHeader(java.lang.String key, int value)
key
- the header name.value
- an integer to be converted to a string for the header.public void setDateHeader(java.lang.String name, long value)
name
- the header name.value
- an time in milliseconds to be converted to a date string.public void addDateHeader(java.lang.String key, long value)
key
- the header name.value
- an time in milliseconds to be converted to a date string.public java.util.ArrayList<java.lang.String> getHeaderKeys()
public java.util.ArrayList<java.lang.String> getHeaderValues()
public java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
public java.util.Collection<java.lang.String> getHeaderNames()
public java.util.ArrayList<java.lang.String> getFooterKeys()
public java.util.ArrayList<java.lang.String> getFooterValues()
public void setContentLength(long length)
length
- the length of the content.public final long getContentLengthHeader()
public java.lang.String getServerHeader()
public void setFooter(java.lang.String key, java.lang.String value)
key
- the header key to set.value
- the header value to set.public void addFooter(java.lang.String key, java.lang.String value)
key
- the footer key.value
- the footer value.protected boolean hasFooter()
protected AbstractResponseStream getResponseStream()
protected ServletOutputStreamImpl getResponseOutputStream()
protected ResponseWriter getResponsePrintWriter()
public boolean isCommitted()
protected void reset()
public int getContentLength()
public boolean isHeaderWritten()
public void setHeaderWritten(boolean isWritten)
protected void writeContinueInt() throws java.io.IOException
java.io.IOException
public final boolean writeHeaders(int length) throws java.io.IOException
os
- browser stream.length
- length of the response if known, or -1 is unknown.java.io.IOException
protected abstract boolean writeHeadersInt(int length, boolean isHead) throws java.io.IOException
java.io.IOException
public boolean fillCookie(CharBuffer cb, Cookie cookie, long date, int version, boolean isCookie2)
cb
- result buffer to contain the generated stringcookie
- the cookiedate
- the current dateversion
- the cookies versionpublic final LogBuffer getLogBuffer()
public final byte[] fillDateBuffer(long now)
public final int getDateBufferLength()
public final int getRawDateBufferOffset()
public final int getRawDateBufferLength()
public final byte[] fillLogDateBuffer(long now, java.lang.String timeFormat)
public final int getLogDateBufferLength()
public void close() throws java.io.IOException
java.io.IOException
public void finishInvocation() throws java.io.IOException
java.io.IOException
public void finishRequest() throws java.io.IOException
java.io.IOException
protected void free()