public abstract class AbstractAjaxResponse extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractAjaxResponse.AjaxResponse
Response that uses an encoder to encode its contents
|
Modifier and Type | Field and Description |
---|---|
protected List<CharSequence> |
appendJavaScripts
A list of scripts (JavaScript) which should be executed on the client side after the
components' replacement
|
protected boolean |
componentsFrozen
A flag that indicates that components cannot be added to AjaxRequestTarget anymore.
|
protected List<CharSequence> |
domReadyJavaScripts
A list of scripts (JavaScript) which should be executed on the client side after the
components' replacement.
|
protected AbstractAjaxResponse.AjaxResponse |
encodingBodyResponse
Create a response for component body and javascript that will escape output to make it safe
to use inside a CDATA block
|
protected AbstractAjaxResponse.AjaxResponse |
encodingHeaderResponse
Response for header contribution that will escape output to make it safe to use inside a
CDATA block
|
protected HtmlHeaderContainer |
header |
protected Map<String,Component> |
markupIdToComponent
The component instances that will be rendered/replaced.
|
protected List<CharSequence> |
prependJavaScripts
A list of scripts (JavaScript) which should be executed on the client side before the
components' replacement
|
Constructor and Description |
---|
AbstractAjaxResponse(Page page)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Component component,
String markupId)
Adds a component to be updated at the client side with its current markup
|
void |
appendJavaScript(CharSequence javascript)
Adds script to the ones which are executed after the component replacement.
|
protected boolean |
containsAncestorFor(Component component)
Checks if the target contains an ancestor for the given component
|
void |
detach(IRequestCycle requestCycle)
Detaches the page if at least one of its components was updated.
|
boolean |
equals(Object o) |
protected abstract void |
fireOnAfterRespondListeners(Response response) |
protected abstract void |
fireOnBeforeRespondListeners() |
Collection<? extends Component> |
getComponents() |
protected String |
getEncodingName() |
IHeaderResponse |
getHeaderResponse()
Gets or creates an IHeaderResponse instance to use for the header contributions.
|
int |
hashCode() |
void |
prependJavaScript(CharSequence javascript)
Adds script to the ones which are executed before the component replacement.
|
protected abstract void |
setContentType(WebResponse response,
String encoding)
Sets the Content-Type header to indicate the type of the Ajax response.
|
protected abstract void |
writeComponent(Response response,
String markupId,
Component component,
String encoding)
Writes a single component
|
protected abstract void |
writeFooter(Response response,
String encoding) |
protected abstract void |
writeHeader(Response response,
String encoding)
Writes the head part of the response.
|
protected abstract void |
writeHeaderContribution(Response response)
Writes header contribution ( or ) to the response.
|
protected void |
writeHeaderContribution(Response response,
Component component) |
protected abstract void |
writeNormalEvaluations(Response response,
Collection<CharSequence> js) |
protected abstract void |
writePriorityEvaluations(Response response,
Collection<CharSequence> js) |
void |
writeTo(Response response,
String encoding)
Serializes this object to the response.
|
protected final List<CharSequence> prependJavaScripts
protected final List<CharSequence> appendJavaScripts
protected final List<CharSequence> domReadyJavaScripts
protected final Map<String,Component> markupIdToComponent
protected transient boolean componentsFrozen
protected final AbstractAjaxResponse.AjaxResponse encodingBodyResponse
protected final AbstractAjaxResponse.AjaxResponse encodingHeaderResponse
protected HtmlHeaderContainer header
public AbstractAjaxResponse(Page page)
page
- the page which components are being updated.public void writeTo(Response response, String encoding)
response
- the response to write toencoding
- the encoding for the responseprotected abstract void fireOnAfterRespondListeners(Response response)
protected abstract void fireOnBeforeRespondListeners()
protected abstract void writeFooter(Response response, String encoding)
response
- the response to write toencoding
- the encoding for the responseprotected abstract void writePriorityEvaluations(Response response, Collection<CharSequence> js)
response
- the response to write tojs
- the JavaScript to evaluateprotected abstract void writeNormalEvaluations(Response response, Collection<CharSequence> js)
response
- the response to write tojs
- the JavaScript to evaluateprotected abstract void writeComponent(Response response, String markupId, Component component, String encoding)
response
- the response to write tomarkupId
- the markup id to use for the component replacementcomponent
- the component which markup will be used as replacementencoding
- the encoding for the responseprotected abstract void writeHeader(Response response, String encoding)
response
- the response to write toencoding
- the encoding for the responseprotected abstract void writeHeaderContribution(Response response)
response
- the response to write topublic final void appendJavaScript(CharSequence javascript)
javascript
- the javascript to executepublic final void prependJavaScript(CharSequence javascript)
javascript
- the javascript to executepublic final void add(Component component, String markupId) throws IllegalArgumentException, IllegalStateException
component
- the component to updatemarkupId
- the markup id to use to find the component in the page's markupIllegalArgumentException
- thrown when a Page or an AbstractRepeater is addedIllegalStateException
- thrown when components no more can be added for replacement.public final Collection<? extends Component> getComponents()
public void detach(IRequestCycle requestCycle)
requestCycle
- the current request cycleprotected boolean containsAncestorFor(Component component)
component
- the component which ancestors should be checked.true
if target contains an ancestor for the given componentpublic IHeaderResponse getHeaderResponse()
protected void writeHeaderContribution(Response response, Component component)
response
- the response to write tocomponent
- to component which will contribute to the headerprotected abstract void setContentType(WebResponse response, String encoding)
response
- the current we responseencoding
- the encoding to useprotected String getEncodingName()
Copyright © 2006–2014 Apache Software Foundation. All rights reserved.