voyent
Standard JSF page within icefaces  XML
Forum Index -> General Help
Author Message
intercollector

Joined: 11/Jan/2008 00:00:00
Messages: 17
Offline


Hi All,

Been working with icefaces for a few weeks now, and I've run into a problem with rendering of a standard JSF form. I've used the timezone application as an example for this problem. If the form is requested with timezone.faces, the following exception occurs:

java.lang.ClassCastException: org.apache.myfaces.context.servlet.ServletFacesContextImpl
at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:283)
at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
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:274)
at ca.bc.gov.educ.registry.course.acegi.NoRolesFilter.doFilter(NoRolesFilter.java:81)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
at ca.bc.gov.educ.registry.course.ui.filter.SiteminderHeaderFilter.doFilter(SiteminderHeaderFilter.java:131)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)



We can actual request the page fine if you request with a suffix of .iface, however when the form is rendered, the html result has the form submiting with an action of "timezone.jspx". This makes sense, since the
javax.faces.DEFAULT_SUFFIX parameter is set to "jspx". If you switch this to "iface", then this form will render fine, however that will break how iceface requests are made.

Here are some details on my current jars:

icefaces 1.6.1
just-ice.jar - We've used this because we want some pages to be just plain old JSF pages.
icefaces-facelets.jar - Need this for the site layout/templates.

Here are some configuration details:

web.xml:

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>

<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jspx</param-value>
</context-param>

<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Persistent Faces Servlet</servlet-name>
<servlet-class>
com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>

<!-- Persistent Faces Servlet Mappings -->
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.iface</url-pattern>
</servlet-mapping>

-----------------------------------------------
Faces Config:
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<view-handler>com.icesoft.faces.facelets.D2DFaceletViewHandler</view-handler>
</application>
intercollector

Joined: 11/Jan/2008 00:00:00
Messages: 17
Offline


And my timezone.jspx:


<f:view xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<html>
<head><title>ICEfaces: TimeZone Sample Application</title></head>
<body>
<h3>ICEfaces: TimeZone Sample Application</h3>
<h:form>
<h:panelGrid columns="2">
<h:outputText style="font-weight:600" value="Server Time Zone"/>
<h:outputText style="font-weight:600"
value="Time Zone Selected from Map"/>
<h:outputText value="#{timeZoneBean.serverTimeZoneName}"/>
<h:outputText value="#{timeZoneBean.selectedTimeZoneName}"/>
<h:outputText style="font-weight:800"
value="#{timeZoneBean.serverTime}"/>
<h:outputText style="font-weight:800"
value="#{timeZoneBean.selectedTime}"/>
</h:panelGrid>
<h:commandButton id="map" image="images/map.jpg"
actionListener="#{timeZoneBean.listen}" />
</h:form>
</body>
</html>
</f:view>
intercollector

Joined: 11/Jan/2008 00:00:00
Messages: 17
Offline


After some fairly deep digging into the JSF/Icefaces relationship, my college and I have discovered a partial solution.

It seems that the JSF specification contains a method for delegating the viewHandler. just-icefaces uses this mechanism in the D2DViewHandlerDelegating. If ice-faces view handler determines that it should delegate based on the request's suffix (.iface or .faces), it will delegate to the appropriate handler.

Unfortunately, the D2DFaceletViewHandler does not delegate properly, and thus the class cast exception.

In the web.xml, you can automatically set the delegate parameter with the following:

<context-param>
<param-name>com.icesoft.faces.delegateNonIface</param-name>
<param-value>true</param-value>
</context-param>

Unfortunately, there is a side effect of setting this. There is no way of specifying which ViewHandler to delegate to, so it seems that it always delegates to the one specified as the default by the JSF implementation (in the case of MyFaces, it is JspViewHandlerImpl). Because of this, you lose the ability to use the JSF FaceletViewHandler, and thus cannot use any facelets.
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team