users@woodstock.java.net

Re: submit (), refresh () and filter

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Fri, 28 Mar 2008 08:46:59 -0700

I'm sure you can do something in a filter to break things. :) But I
don't think the nature of a filter alone will have any effect on this.
The code that is throwing an exception appears to be doing so b/c the
PartialTraversalViewRoot is not a UIComponent. I'm 99% sure this means
its (null) as it is always a UIComponent.

It could be null if the FacesContext is null. Or if the ViewRoot to be
created is created as something other than a PartialTraversalViewRoot
implementation (i.e. the normal UIViewRoot). The 2nd cause should not
happen unless you've done something to configure how JSF creates the
ViewRoot (perhaps used a framework like Ajax4JSF, or some other
framework); this is the configuration that ensure a proper ViewRoot is
created (this is done for you automatically):

    <component>
        <component-type>javax.faces.ViewRoot</component-type>
        
<component-class>com.sun.faces.extensions.avatar.components.PartialTraversalViewRootImpl</component-class>
        <component-extension>
            <component-family>javax.faces.ViewRoot</component-family>
        </component-extension>
    </component>

The ViewRoot will be null if the FacesServlet is not executed. In your
stack trace, I do not see the FacesServlet, however, I'm not sure if
there's more to it than this. I'm guessing that is your problem.

Good luck!

Ken

Wei Chiang wrote:
> Hi,
>
> Does AJAX partial update work together with the filters? From the log
> below, it seems they don't. But it could also be the mistakes I made in
> the jsp page.
>
> Thank you in advance if someone can point out the mistakes or provide a
> solution.
>
> Kind regards,
> Wei
> =================================================================================0
>
> Below is the snippet of the jsp page.
> <w:hyperlink url="#" id="popupMenuLink"
> text="#{mcMsgs.popupMenu}"
> onClick="displayPopupMenu(event);return false;"
> onKeyDown="displayPopupMenu(event);"/>
> <w:textField id="hiddenSelected" disabled="true" visible="false"
> text="#{popupMenu.selected}"/>
> <w:menu id="popupMenu" styleClass="popup"
> items="#{popupMenu.optionItems}"
> eventListenerExpression="#{popupMenu.selectOptionListener}"
> onChange="setTimeout('changeEvent();', 0);"/>
>
> The displayPopupMenu () works fine.
>
> The changeEvent() script is
> function changeEvent ()
> {
> var domNode = document.getElementById(hiddenSelected);
> domNode.refresh (popupMenuId);
> }
> where hiddenSelected and popupMenuId are defined as the identifiers of
> the corresponding components.
>
> The menu's event listener never gets called, therefore the hidden text
> never gets updated.
>
> Part of the error dump in the log is
> SEVERE: Servlet.service() for servlet Faces Servlet threw exception
> java.lang.IllegalStateException: Class returned from
> AsyncResponse.getPartialTraversalViewRoot must be a UIComponent
> at
> com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.render(PartialTraversalLifecycle.java:132)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> com.rihotec.apogee.common.webapps.jsf.AppSessionTimeoutFilter.doFilter(AppSessionTimeoutFilter.java:63)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
> at
> org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
> at
> org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
> at
> org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:188)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_woodstock.dev.java.net
> For additional commands, e-mail: users-help_at_woodstock.dev.java.net
>
>