[JBoss JIRA] Created: (RF-8197) Optimize AjaxChildrenRenderer render component check algorithm
by Jan Ziegler (JIRA)
Optimize AjaxChildrenRenderer render component check algorithm
--------------------------------------------------------------
Key: RF-8197
URL: https://jira.jboss.org/jira/browse/RF-8197
Project: RichFaces
Issue Type: Patch
Security Level: Public (Everyone can see)
Affects Versions: 3.3.2.SR1
Environment: Myfaces 1.2.8, Facelets 1.1.15, Tomcat 6.0.20
Reporter: Jan Ziegler
I just realized some possible "lifecycle processing overhead" when doing ajax actions:
In render response phase each ajax component is checked for rendering by the method AjaxChildrenRenderer.encodeAjaxComponent(). That - what I could see - is the case when:
# the component´s rendered-attribute is true
# the component is ajaxRendered
# the componentId is defined in the reRenderId-List
This also reflects the order of checking, so the first thing to be done is check if the component´s rendered-attribute is true. But this might also lead to additional lifecycle processings when
rendered-conditions are bound to managed beans by el expressions. To evaluate the rendered condition, request scoped managed beans must be created. to my opion this is suboptimal, like in my case the managed bean performs some (time intensive?) actions in its constructor or the rendered conditions relies on a list which must be fetched from the database - and this also happens even if the componentId is not in den reRenderId-List.
So why not first evaluate if the componentId is in the reRenderId-List or the component is ajaxRendered and then (if one of this conditions is true) additionally check the rendered-condition?
This might be accomplished with a small change AjaxChildrenRenderer.encodeAjaxComponent():
{code}
public void encodeAjaxComponent(FacesContext context,
UIComponent component, String currentPath, Set<String> ids,
Set<String> renderedAreas) throws IOException {
if (component.isRendered()) { // skip not-rendered components.
boolean found = false;
boolean limitToList = AjaxContext.getCurrentInstance(context).isLimitToList();
String elementId = component.getId();
String absoluteId = currentPath + elementId;
if (!ids.isEmpty()) {
// list for rendering may contains absolute id ( best ),
// component Id or client ID
// String clientId = element.getClientId(context);
if (ids.contains(absoluteId) || ids.contains(elementId)) {
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(
Messages.RENDER_AJAX_AREA_INFO, absoluteId));
}
// renderChild(context, element);
found = true;
}
}
//
if (!found && limitToList
&& component instanceof NamingContainer
&& noIdUnderPath(absoluteId
+ NamingContainer.SEPARATOR_CHAR, ids)) {
return;
}
if (!found && !limitToList && component instanceof AjaxOutput) {
if (((AjaxOutput) component).isAjaxRendered()) {
// renderChild(context, element);
found = true;
}
}
if (!found) {
if (component instanceof AjaxChildrenEncoder) {
((AjaxChildrenEncoder) component).encodeAjaxChild(context,
currentPath, ids, renderedAreas);
} else {
// Special case - for control components, not produced
// html code - such as message bundles loaders,
// MyFaces aliases etc. we call encodeBegin/end methods
// even if components not in rendered areas.
boolean special = isSpecialElement(context, component);
if (special) {
component.encodeBegin(context);
}
encodeAjaxChildren(context, component, currentPath, ids,
renderedAreas);
if (special) {
component.encodeEnd(context);
}
}
} else {
renderedAreas.add(component.getClientId(context));
renderChild(context, component);
}
}
}
{code}
Patched version (the isRendered()-condition is moved the the last else-Block before the component will be rendered):
public void encodeAjaxComponent(FacesContext context,
UIComponent component, String currentPath, Set<String> ids,
Set<String> renderedAreas) throws IOException {
boolean found = false;
boolean limitToList = AjaxContext.getCurrentInstance(context).isLimitToList();
String elementId = component.getId();
String absoluteId = currentPath + elementId;
if (!ids.isEmpty()) {
// list for rendering may contains absolute id ( best ),
// component Id or client ID
// String clientId = element.getClientId(context);
if (ids.contains(absoluteId) || ids.contains(elementId)) {
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(
Messages.RENDER_AJAX_AREA_INFO, absoluteId));
}
// renderChild(context, element);
found = true;
}
}
//
if (!found && limitToList
&& component instanceof NamingContainer
&& noIdUnderPath(absoluteId
+ NamingContainer.SEPARATOR_CHAR, ids)) {
return;
}
if (!found && !limitToList && component instanceof AjaxOutput) {
if (((AjaxOutput) component).isAjaxRendered()) {
// renderChild(context, element);
found = true;
}
}
if (!found) {
if (component instanceof AjaxChildrenEncoder) {
((AjaxChildrenEncoder) component).encodeAjaxChild(context,
currentPath, ids, renderedAreas);
} else {
// Special case - for control components, not produced
// html code - such as message bundles loaders,
// MyFaces aliases etc. we call encodeBegin/end methods
// even if components not in rendered areas.
boolean special = isSpecialElement(context, component);
if (special) {
component.encodeBegin(context);
}
encodeAjaxChildren(context, component, currentPath, ids,
renderedAreas);
if (special) {
component.encodeEnd(context);
}
}
} else if (component.isRendered()) { // skip not-rendered components.
renderedAreas.add(component.getClientId(context));
renderChild(context, component);
}
}
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (RF-8067) keyboard navigable rich:datascroller
by Gary Hu (JIRA)
keyboard navigable rich:datascroller
------------------------------------
Key: RF-8067
URL: https://jira.jboss.org/jira/browse/RF-8067
Project: RichFaces
Issue Type: Feature Request
Affects Versions: 3.3.2.SR1
Reporter: Gary Hu
The rich:datascroller generates the markup html code like this:
<td class="dr-dscr-inact rich-datascr-inact" onclick="Event.fire(this, 'rich:datascroller:onscroll', {'page': '1'});">1</td>
The code above is not keyboard navigable. For example, it can not be set focus.
Can we generate the html markup like the following?
<td class="dr-dscr-inact rich-datascr-inact" onclick="Event.fire(this, 'rich:datascroller:onscroll', {'page': '1'});"><a href="javascript:void(0)">1</a></td>
The <a> tag will enable it to be keyboard navigable.
Furthermore, maybe we can add one property for rich:datascroller to determine if needing to generate keyboard navigable page link or not.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (RF-8425) rich:tooltip performance
by Mark Torres (JIRA)
rich:tooltip performance
------------------------
Key: RF-8425
URL: https://jira.jboss.org/jira/browse/RF-8425
Project: RichFaces
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: component-output
Affects Versions: 3.3.1
Reporter: Mark Torres
We have used rich:tooltip in a lot of places within our application. And while profiling, we came to a bottleneck caused by repeated calls to RendererBase.getResource(String resourceURI ) during the constructor of ToolTipRenderer. I think the main issue is the ToolTipRenderer.getRenderer(UIToolTip toolTip) method never caches the subclasses and thus created a lot of HtmlToolTipRendererBlock, HtmlToolTipRenderer objects, and calls to RendererBase.getResource(String resourceURI ). We've overriden the renderer in our environment to use something that caches the subclass and it improved performance a lot.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (RF-7984) I would be nice to have the BaseXML redirecting-code in a util-class
by Andreas Höhmann (JIRA)
I would be nice to have the BaseXML redirecting-code in a util-class
--------------------------------------------------------------------
Key: RF-7984
URL: https://jira.jboss.org/jira/browse/RF-7984
Project: RichFaces
Issue Type: Feature Request
Affects Versions: 3.3.2.GA
Reporter: Andreas Höhmann
Priority: Minor
I wrote a special spring security entry point to handle missing authentication *after* a a4j-request:
/**
* {@inheritDoc}
*/
@Override
protected void sendRedirect(final HttpServletRequest theRequest, final HttpServletResponse theResponse,
final String theUrl) throws IOException {
if (!isAjaxRequest(theRequest)) {
LOG.debug("normal redirect to " + theUrl);
super.sendRedirect(theRequest, theResponse, theUrl);
} else {
LOG.debug("ajax redirect to " + theUrl);
final FilterServletResponseWrapper servletResponseWrapper = new FilterServletResponseWrapper(theResponse);
final Writer output = resetResponse(theResponse, servletResponseWrapper, "redirect");
theResponse.setHeader(AjaxContainerRenderer.AJAX_LOCATION_HEADER, theUrl);
// For buggy XmlHttpRequest realisations repeat headers in
// <meta>
output.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>" + "<meta name=\""
+ AjaxContainerRenderer.AJAX_FLAG_HEADER + "\" content=\"redirect\" />" + "<meta name=\""
+ AjaxContainerRenderer.AJAX_LOCATION_HEADER + "\" content=\"" + theUrl + "\" />" + "</head></html>");
output.flush();
theResponse.flushBuffer();
}
}
Currently i'm must copy the redirecting-code from org.ajax4jsf.webapp.BaseXMLFilter to reuse it.
It would be nice to have a "A4JResponseUtils" with this methods:
- boolean isAjaxRequest(final ServletRequest request)
- void sendRedirect(final HttpServletRequest theRequest, final HttpServletResponse theResponse, final String theUrl)
The advantage of such a utils-class would be a always compatibly thirdparty code (integration code), if the redirecting-code changes in a4j my code should still work :D
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months