fileDownload issue

UI Components for JSF
trank
Posts: 11
Joined: 16 Jun 2010, 12:22

26 Jun 2010, 16:31

Hi
I have a table linket to a List of StreamedContent object, when I try do download one file all thing works, but when I try to download a differnet file I got an Exception, the stack trace is

Code: Select all

javax.faces.FacesException
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:105)
        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:532)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
        at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
        at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)

        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
        at org.primefaces.application.CleanupActionListener.processAction(CleanupActionListener.java:49)

        at javax.faces.component.UICommand.broadcast(UICommand.java:383)
        at javax.faces.component.UIData.broadcast(UIData.java:854)

        at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
        at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
        at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
        at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
        ... 37 more
I have also checked the CleanupActionListener.java line that throw the nullPointer:
RequestContext.getCurrentInstance().release();

seems the currentistance is null...

by the way the tag is this:

Code: Select all

<h:dataTable value="#{attachmentBean.attachList}" var="attachment">
<p:commandLink ajax="false" title="Download">
     <p:graphicImage value="/img/icona_download.gif" height="20px" width="20px"/>
     <p:fileDownload value="#{attachment}" />
</p:commandLink>
I use jboss 5.0, jsf 1.2, facelet 1.14, primefeces: primefaces-1.0.2.jar

Regards
Pier Luigi Ambrosini
Last edited by trank on 02 Jul 2010, 10:15, edited 1 time in total.

trank
Posts: 11
Joined: 16 Jun 2010, 12:22

28 Jun 2010, 22:03

Any news?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

28 Jun 2010, 23:52

Hi,

Try putting the commandLink inside a column also please read forum posting guidelines especially number 3.

http://primefaces.prime.com.tr/forum/vi ... f=3&t=1194

Thank you.

trank
Posts: 11
Joined: 16 Jun 2010, 12:22

30 Jun 2010, 10:33

Sorry for the inconvenience, the code I have give isn't correct, in fact there is the <h:column> tag

Code: Select all

<h:dataTable value="#{attachmentBean.attachList}" 
                    var="attachment"
     <h:column>
        <f:facet name="header">
            <h:outputText value="#{msg.label_AttachFile}" />
        </f:facet>
        <p:commandLink ajax="false" title="Download">
              <p:graphicImage value="/img/icona_download.gif" height="20px" width="20px"/>
              <p:fileDownload value="#{attachment}" />
        </p:commandLink>
        <h:outputText value="  #{attachment.name}"/>
      </h:column>
</h:dataTable>

trank
Posts: 11
Joined: 16 Jun 2010, 12:22

06 Jul 2010, 11:26

Fixed, by using <h:commandLink> instead of <p:commandLink>

so, from:

Code: Select all

<p:commandLink ajax="false" title="Download">
              <p:graphicImage value="/img/icona_download.gif" height="20px" width="20px"/>
              <p:fileDownload value="#{attachment}" />
</p:commandLink>
to:

Code: Select all

<h:commandLink title="Download">
     <p:graphicImage value="/img/icona_download.gif" height="20px" width="20px"/>
     <p:fileDownload value="#{attachment}"/>
</h:commandLink>

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

06 Jul 2010, 12:39

Strange as showcase uses p:commandLink with no issues;

http://www.primefaces.org:8080/prime-sh ... wnload.jsf

trank
Posts: 11
Joined: 16 Jun 2010, 12:22

06 Jul 2010, 12:45

maybe is our configuration... we use jsf 1.2 (Myfaces) and primefaces 1.0.2, the showcase run on 2.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

06 Jul 2010, 12:53

I see but why do you have com.sun.lifecycle (Mojarra) classes in stack trace if you are using myfaces?

zkropotkine
Posts: 24
Joined: 10 Jul 2010, 17:42

13 Jul 2010, 23:06

Hi,

I having the same problem , we have a primafeces' datatable that show several documents. If I use the <p:commandLink> it open the same file in all the cases. However, if I use the <h:commandLink> it works perfect :S

Code: Select all

<p:dataTable var="documento" id="tablaDoc-${solicitud.convenio.ssconvId}" value="#{solicitud.archivosConvenio}" styleClass="primefaces-skin">

        <p:column>
            <f:facet name="header">
                <h:outputText value="Nombre Archivo" />
            </f:facet>
            <h:outputText id="nomArchLab-${solicitud.convenio.ssconvId}-${documento.ssarchId}" value="#{documento.ssarchNombre}" />
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Tipo" />
            </f:facet>
            <h:outputText id="tipoArchLab-${solicitud.convenio.ssconvId}-${documento.ssarchId}" value="#{documento.ssarchTipo}" />
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Ver"/>
            </f:facet>
            <h:commandLink  id="desc-${solicitud.convenio.ssconvId}-${documento.ssarchId}" ajax="false" immediate="true">
                <p:graphicImage value="/resources/images/download.gif"  styleClass="img_sinborde"/>
                <p:fileDownload  id="downl-${solicitud.convenio.ssconvId}-${documento.ssarchId}" value="#{documento.contenido}" />
            </h:commandLink>
        </p:column>
        <p:column>
            <f:facet name="header">
                <h:outputText value="Eliminar" />
            </f:facet>
            <h:outputText id="eliminarButLab-${solicitud.convenio.ssconvId}-${documento.ssarchId}" value="" />
        </p:column>
    </p:dataTable>
We are using:

Glassfish 2.1.1
Mojarra 2.0.3
  • Glassfish 2.1.1
  • Mojara 2.0.3
  • PF 2.2M1
  • JSF 2.0
  • Firefox 3.6.10
  • Ubuntu 10
  • Netbeans 6.8

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

14 Jul 2010, 18:56

If you use p:commandLink, you need to set ajax="false" for filedownload to work.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests