voyent
Seam PDF and IceFaces NPE  XML
Forum Index -> JBoss Seam Integration
Author Message
ivanflorentin

Joined: 23/Jan/2007 00:00:00
Messages: 4
Offline


I have problems integrating Seam-PDF with IceFaces.
I have the following test scenario:
jboss-seam-1.2.1-GA
project: itext example from seam 1.2.1GA
jboss-as-4.0.5-ejb3

Starting with a working project from the examples I added Icefaces jars and modified the web.xml accordingly. I tested with iceFaces 1.5.3 and 1.6.0DR4. with and without jsf-facelets.jar and i get the following exception:


ERROR [D2DFaceletViewHandler] Problem in renderResponse: java.lang.NullPointerException
java.lang.RuntimeException: java.lang.NullPointerException
at org.jboss.seam.pdf.ui.UIDocument.processHeaders(UIDocument.java:265)
at org.jboss.seam.pdf.ui.UIDocument.encodeBegin(UIDocument.java:222)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:510)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:517)
at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:301)
at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:150)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:125)
at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
at com.icesoft.faces.webapp.http.servlet.SingleViewServlet.service(SingleViewServlet.java:48)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:89)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at com.icesoft.faces.context.DOMResponseWriter.enhanceAndFixDocument(DOMResponseWriter.java:294)
at com.icesoft.faces.context.DOMResponseWriter.endDocument(DOMResponseWriter.java:171)
at com.icesoft.faces.context.DOMResponseWriter.cloneWithWriter(DOMResponseWriter.java:247)
at org.jboss.seam.pdf.ui.ITextComponent.extractText(ITextComponent.java:210)
at org.jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:190)
at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:235)
at org.jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:200)
at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:235)
at org.jboss.seam.pdf.ui.UIDocument.processHeaders(UIDocument.java:263)
... 42 more


judy.guglielmin

Joined: 20/Feb/2007 00:00:00
Messages: 1396
Offline


Sorry, this is a know problem and discussion is going on right now to determine how we will try to integrate seam-pdf.
ivanflorentin

Joined: 23/Jan/2007 00:00:00
Messages: 4
Offline


Is there a Jira Issue on this?
Do I need to create one?
Also, I have some experience with seam-pdf internals, I might be able to help.
Where can I find more information, other than the code, on this issue?
ted.goddard

Joined: 26/Oct/2004 00:00:00
Messages: 874
Offline



What appears to make this tricky is that Seam re-uses the FacesContext of the calling HTML page for the PDF page. ICEfaces has already prepared this FacesContext for Ajax rendering and isn't expecting PDF output. Perhaps this can be handled with ViewHandler delegation -- although it may be that the viewID during PDF rendering is actually associated with the calling HTML page.

This JIRA is related, however it may not be what you're after (eventually we would like to support PDF rendering for all ICEfaces components; Seam PDF rendering may simply require that ICEfaces does not interfere with Seam's PDF output).

http://jira.icefaces.org/browse/ICE-1319
[Email]
ivanflorentin

Joined: 23/Jan/2007 00:00:00
Messages: 4
Offline


I don't know how much work it will represent to support seam PDF, and I don't know if I am the only one trying to use it with IceFaces, but is definitly something I need. I already created some custom seam pdf components. (<p:barCode> is one that got its way to seam cvs now).
I am very interested in PDF rendering for ICEFaces components, it can overcome much of the limitations of seam-pdf specially in layout and styles. If I can help, I would like to test this functionality. I have basic experience with jsf and itext and i'm not afraid to learn some more.

ted.goddard

Joined: 26/Oct/2004 00:00:00
Messages: 874
Offline



For the short term, we recommend completely separate pages for ICEfaces and PDF. This should allow you to use the PDF-specific components in Seam. For the long term, I'm not sure that we want to implement iText renderers for all of the ICEfaces components. Moreover, many ICEfaces pages make good use of CSS, but CSS rendering is not a component feature, it's an HTML feature. In this case, we would prefer to pipe the HTML output of ICEfaces through a server-side HTML renderer (capable of CSS rendering) such as the ICEbrowser.

Which strategy would work best for your use?
[Email]
ted.goddard

Joined: 26/Oct/2004 00:00:00
Messages: 874
Offline


Here are the steps I took to enable ICEfaces in the Seam iText demo:

In web.xml:

Code:
     <context-param>
         <param-name>com.icesoft.faces.actionURLSuffix</param-name>
         <param-value>.seam</param-value>
     </context-param>
 
     <context-param>
         <param-name>com.icesoft.faces.doJSFStateManagement</param-name>
         <param-value>true</param-value>
     </context-param>
 
    <context-param>
         <param-name>com.icesoft.faces.delegateNonIface</param-name>
         <param-value>true</param-value>
     </context-param>
 
    <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>
         <servlet-name>Blocking Servlet</servlet-name>
         <servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
         <load-on-startup> 1 </load-on-startup>
     </servlet>
 
     <servlet-mapping>
         <servlet-name>Persistent Faces Servlet</servlet-name>
         <url-pattern>*.iface</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
         <servlet-name>Persistent Faces Servlet</servlet-name>
         <url-pattern>/xmlhttp/*</url-pattern>
     </servlet-mapping>
     <servlet-mapping>
         <servlet-name>Blocking Servlet</servlet-name>
         <url-pattern>/block/*</url-pattern>
     </servlet-mapping>
 
     <servlet>
         <servlet-name>Faces Servlet</servlet-name>
         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>
 
 


In faces-config.xml:

Code:
     <application>
         <view-handler>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</view-handler>
     </application>
     <application>
         <view-handler>com.icesoft.faces.facelets.D2DSeamFaceletViewHandler</view-handler>
     </application>
 


In application.xml:

Code:
     <module>
         <java>icefaces.jar</java>
     </module>
     <module>
         <java>icefaces-facelets.jar</java>
     </module>
     <module>
         <java>icefaces-comps.jar</java>
     </module>
     <module>
         <java>commons-fileupload.jar</java>
     </module>
     <module>
         <java>backport-util-concurrent.jar</java>
     </module>
 


Replacing jsf-facelets.jar with icefaces-facelets.jar was also necessary.

This means that pages requested with the .iface extension will be handled by ICEFaces, whereas pages requested with the .seam extension will be handled by the default JSF mechanism.

(I also checked in a change to the ICEfaces head to restore delegateNonIface for MyFaces.)
[Email]
ivanflorentin

Joined: 23/Jan/2007 00:00:00
Messages: 4
Offline


Thanks Ted for the response,
I didn't have much time to tests the configuration to use Seam-PDF with Icefaces, I think I can work on it during the week.
I agree that not every IceFaces component should be printed. For me, to have the possibility to use CSS in text components is already a big advance compared to the functionality present in Seam PDF. If the IceBrowser can render other more graphic/layout styles in Ice components, things can get really exiting.
I'll try to find some time to take a look at ICEBrowser.


nepveul

Joined: 13/May/2008 00:00:00
Messages: 13
Offline


Hey guys,

quick question, if the com.icesoft.faces.actionURLSuffix param stays .seam, how can I differentiate .iface and .seam views in my action param all over my application?

Thanks!
judy.guglielmin

Joined: 20/Feb/2007 00:00:00
Messages: 1396
Offline


Sorry....I didn't see this post and it came in when I was on holidays.

You can't differentiate between them using seam. If you look at the mail example, you can see that there is only the seam extension. BUT....the pages that have only ice tags will get the proper renderer and the other pages that have the h:tags, and mail tags (no ice tags) get delegated properly to jsf viewHandler.

I didn't spend a lot of time trying to get a pdf example yet. If you do get it working, please consider attaching it for others.
georges.goebel@pch.etat.l


Joined: 23/Jun/2007 00:00:00
Messages: 276
Offline


Hi,

I think the steps described by ted godard don't work anymore as the class org.jboss.seam.ui.facelet.SeamFaceletViewHandler is not included in the 2.1 branch of seam (https://jira.jboss.org/jira/browse/JBSEAM-1367)

Can anybody tell me in which status the developpment of the integration of seam pdf in icefaces is ? Is there already a working version in the svn repository ?

Thanks,

Georges
[Email]
jguglielmin

Joined: 20/Jul/2007 00:00:00
Messages: 181
Offline


It has been really difficult with all the evolution that Seam has been undergoing. We should be able to take the same approach taken for the seam-mail example (starting with Seam-2.1.0) that uses jsf delegation, but I haven't had a chance to try it out. It would be great if some of the users had a chance to try it out and posted back their results.
longwest

Joined: 08/Mar/2015 21:57:09
Messages: 7
Offline


jguglielmin wrote:
It has been really difficult with all the evolution that Seam has been undergoing. We should be able to take the same approach taken for the seam-mail example (starting with Seam-2.1.0) that uses jsf delegation, but I haven't had a chance to try it out. It would be great if some of the users had a chance to try it out and posted back their results.  

Did anyone try it and get a result?

Best regards.
Bar code create bar codes.
judy.guglielmin

Joined: 20/Feb/2007 00:00:00
Messages: 1396
Offline


The seam project has not been supported for some time now. The seam-mail did work in a quick example using jsf-delegation with ICEFaces-1.8 and setting up the java mail server (but that was a long time ago that it was tested!!). If you are a support customer, you could create a support ticket for any assistance you would require with ICEfaces 1.8.2.
 
Forum Index -> JBoss Seam Integration
Go to:   
Powered by JForum 2.1.7ice © JForum Team