public class EsiRenderer extends Object implements Renderer, FutureAppendable
This class is based on EsiRenderer
EsiRenderer
Modifier and Type | Field and Description |
---|---|
static String |
DATA_EXECUTOR
Key for the executor for future tasks.
|
Constructor and Description |
---|
EsiRenderer(Executor executor)
Constructor used to render a complete page.
|
EsiRenderer(String page,
String name,
Executor executor)
Constructor used to render a fragment Retrieves a fragment inside a page.
|
Modifier and Type | Method and Description |
---|---|
FutureAppendable |
enqueueAppend(Future<CharSequence> csq)
Queue the Future<CharSequence> for append in this FutureAppendable.
|
Map<String,CharSequence> |
getFragmentsToReplace() |
String |
getName() |
boolean |
hasPending()
Check if some append operations are still waiting for
FutureAppendable.performAppends() to be called. |
boolean |
isWrite() |
FutureAppendable |
performAppends()
Wait for all computation to complete and perform the pending append operations.
|
FutureAppendable |
performAppends(int timeout,
TimeUnit unit)
Wait for all computation to complete and perform the pending append operations.
|
void |
render(DriverRequest originalRequest,
String content,
Writer out)
Renders provided source and writes results to the output.
|
void |
setFound(boolean found) |
void |
setFragmentsToReplace(Map<String,CharSequence> fragmentsToReplace) |
void |
setWrite(boolean write) |
public static final String DATA_EXECUTOR
public EsiRenderer(Executor executor)
executor
- Executor to use for background operations or null if single-thread operations.public EsiRenderer(String page, String name, Executor executor)
<esi:fragment name="myFragment">
and </esi:fragment>
page
- name
- executor
- Executor to use for background operations or null if single-thread operations.public String getName()
public void setWrite(boolean write)
public Map<String,CharSequence> getFragmentsToReplace()
public void setFragmentsToReplace(Map<String,CharSequence> fragmentsToReplace)
public void render(DriverRequest originalRequest, String content, Writer out) throws IOException, HttpErrorPage
Renderer
render
in interface Renderer
originalRequest
- request received by esigate.content
- source to be renderedout
- output destination. This writer is not thread-safe, use proper synchronization if writing output from
multiple threads.IOException
HttpErrorPage
public FutureAppendable enqueueAppend(Future<CharSequence> csq)
FutureAppendable
Caller may start computing the content of the Future parameter before or after calling this method (using other Thread) or simply wait for Future#get() to be called (deferred computation).
enqueueAppend
in interface FutureAppendable
csq
- The Future character sequence to append. If csq is null, then the four characters
"null" are appended to this FutureAppendable.public boolean isWrite()
public void setFound(boolean found)
public FutureAppendable performAppends() throws IOException, HttpErrorPage
FutureAppendable
performAppends
in interface FutureAppendable
IOException
HttpErrorPage
public boolean hasPending()
FutureAppendable
FutureAppendable.performAppends()
to be called.hasPending
in interface FutureAppendable
public FutureAppendable performAppends(int timeout, TimeUnit unit) throws IOException, HttpErrorPage, TimeoutException
FutureAppendable
performAppends
in interface FutureAppendable
IOException
HttpErrorPage
TimeoutException
Copyright © 2008–2018. All rights reserved.