public class CachedAction.OutputProvider
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
cacheKey |
private java.util.concurrent.Future |
future |
private java.io.OutputStream |
out |
private javax.servlet.http.HttpServletResponse |
resp |
Modifier | Constructor and Description |
---|---|
private |
OutputProvider(javax.servlet.http.HttpServletResponse resp) |
private |
OutputProvider(java.io.OutputStream out) |
private |
OutputProvider(java.lang.String cacheKey) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.Future |
getFuture()
Returns a future object representing a returnOutput method
call.
|
java.io.OutputStream |
getOutputStream()
Opens and returns the output stream where page contents can
be written.
|
private java.lang.String cacheKey
private java.io.OutputStream out
private javax.servlet.http.HttpServletResponse resp
private java.util.concurrent.Future future
private OutputProvider(javax.servlet.http.HttpServletResponse resp)
private OutputProvider(java.io.OutputStream out)
private OutputProvider(java.lang.String cacheKey)
public java.util.concurrent.Future getFuture()
Returns a future object representing a returnOutput method call. In case output is written directly into an HTTP response, the whole thing is done with piped input and output streams to avoid buffering all the results. Another thread is created to call the returnOutput method while page contents are written in doOutput. The Future object returned by this method represents the returnOutput call. Calling get method of the Future object will wait for that process to finish. Prior to that, the output stream must be closed, otherwise returnOutput won't know when the end of stream has been reached and the threads will dead lock.
This is all done in the CachedAction implementation of handleAction. Unless you completely circumvent this implementation, you don't need to worry about any of this.
public java.io.OutputStream getOutputStream()
Copyright 2004-2015 Wandora Team