Liferay - Creating PDF and outputing to stream

北战南征 提交于 2019-12-08 05:32:24

The exception that you get, java.lang.ClassCastException: com.liferay.portlet.RenderResponseImpl cannot be cast to javax.portlet.ResourceResponse sounds like you have some classes (e.g. portlet.jar) twice on your classpath. This typically is in the global classpath and you must not have it in your web application.

This is almost always the case when you have an exception like subclass cannot be cast to superclass

Try calling serveResource() in a portlet. when you hit a button, add ajax and call resource url which will serveResource.

HTH

I would recommend that you look at the jsf2-export-pdf-portlet demo. It uses a JSF 2.x ResourceHandler in order to return a PDF using the RESOURCE_PHASE of the portlet lifecycle.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!