Icefaces outputResource:找不到404资源

时间:2011-11-16 10:58:30

标签: java jsf liferay portlet icefaces

我对<ice:outputResouce>有疑问。它按预期工作,但当我按下载按钮时,我得到一个错误:HTTP Status 404 - Resource not found

这是我的环境:

  • Icefaces 2.0
  • on Liferay 6.0.6 via PortletFaces
  • 在JBoss 5.1上运行

public Resource getPdfResource()方法:

 public Resource getPdfResource() {
    System.out.println("GET PDF Ressource: " + getPDF());
    if (getPDF() == null) {
        return null;
    }
    try {
        File f = PDFFileUtils.getFile(getPDF());
        Resource res = new ByteArrayResource(
                IOUtils.toByteArray(new FileInputStream(f)));
        return res;
    } catch (IOException e) {
    //...
    }
    //...
    return null;
}

以及<ice:outputResouce>

中的.xhmtl
<ice:outputResource
   label="#{i18n['download']} #{publishBackingBean.pdfName}"
   type="button"
   shared="false"
   fileName="#{publishBackingBean.pdfName}"
  resource="#{publishBackingBean.pdfResource}" attachment="true">
</ice:outputResource>

resouceservlet工作正常。

有人有想法吗?我认为liferay&amp; |可能存在问题portletbridge ...

编辑

我现在已经在FileResouce

中添加了一些调试消息
Resource res = new FileResource(f){
            /* (non-Javadoc)
             * @see com.icesoft.faces.context.FileResource#calculateDigest()
             */
            @Override
            public String calculateDigest() {
                System.out.println("Calc Dig calld: "+ super.calculateDigest());
                Thread.dumpStack();
                return super.calculateDigest();
            }
            /* (non-Javadoc)
             * @see com.icesoft.faces.context.FileResource#open()
             */
            @Override
            public InputStream open() throws IOException {
                System.out.println("open called");
                return super.open();
            }
            /* (non-Javadoc)
             * @see com.icesoft.faces.context.FileResource#lastModified()
             */
            @Override
            public Date lastModified() {
                System.out.println("lm called");
                return super.lastModified();
            }
        };

调用gets的唯一方法是calculateDigest

2011-11-16 13:13:32,546 INFO  [STDOUT] (http-0.0.0.0-8080-8) Calc Dig calld: /opt/dreipp/webpublish/pdf/aed91373-f5b7-407b-9f35-e21e7ec6f059/PRESENTATION_PDF/Envlisch version-en_US.pdf
2011-11-16 13:13:32,546 ERROR [STDERR] (http-0.0.0.0-8080-8) java.lang.Exception: Stack trace
2011-11-16 13:13:32,546 ERROR [STDERR] (http-0.0.0.0-8080-8)    at java.lang.Thread.dumpStack(Thread.java:1249)
2011-11-16 13:13:32,546 ERROR [STDERR] (http-0.0.0.0-8080-8)    at com.dreipplus.web.profiler.publish.beans.PublishBackingBean$1.calculateDigest(PublishBackingBean.java:126)
2011-11-16 13:13:32,546 ERROR [STDERR] (http-0.0.0.0-8080-8)    at com.icesoft.faces.component.outputresource.RegisteredResource.calculateDigest(OutputResource.java:466)
2011-11-16 13:13:32,546 ERROR [STDERR] (http-0.0.0.0-8080-8)    at com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter.calculateDigest(ResourceRegistryLocator.java:113)
2011-11-16 13:13:32,546 ERROR [STDERR] (http-0.0.0.0-8080-8)    at org.icefaces.impl.push.DynamicResourceDispatcher.encode(DynamicResourceDispatcher.java:291)
2011-11-16 13:13:32,547 ERROR [STDERR] (http-0.0.0.0-8080-8)    at org.icefaces.impl.push.DynamicResourceDispatcher.registerResource(DynamicResourceDispatcher.java:161)
2011-11-16 13:13:32,547 ERROR [STDERR] (http-0.0.0.0-8080-8)    at org.icefaces.impl.push.DynamicResourceDispatcher.registerResource(DynamicResourceDispatcher.java:136)
2011-11-16 13:13:32,547 ERROR [STDERR] (http-0.0.0.0-8080-8)    at com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter.registerResource(ResourceRegistryLocator.java:93)
2011-11-16 13:13:32,547 ERROR [STDERR] (http-0.0.0.0-8080-8)    at com.icesoft.faces.component.outputresource.OutputResource.getResource(OutputResource.java:120)
2011-11-16 13:13:32,547 ERROR [STDERR] (http-0.0.0.0-8080-8)    at com.icesoft.faces.component.outputresource.OutputResourceRenderer.encodeBegin(OutputResourceRenderer.java:47)
2011-11-16 13:13:32,547 ERROR [STDERR] (http-0.0.0.0-8080-8)    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
提前thx itshorty

0 个答案:

没有答案