Fórum

Primefaces UI broken when defining custom Resource Handler in faces-config

Namik Yaqubov, modificado 9 Anos atrás.

Primefaces UI broken when defining custom Resource Handler in faces-config

New Member Postagens: 3 Data de Entrada: 23/02/15 Postagens Recentes
Hello everyone. I am developing a portlet using Jsf+Primefaces, however i faced an annoying problem, when trying to implement a pdf viewing functionality. I downloaded the ExportPdf-Portlet sample and rewrote the functionality for my portlet. I couldnt view the pdf at first, but then i noticed that i missed the faces-config.xml resource-handler that was in the original portlet. The problem is that, if i dont add that parameter in faces-config, i cant view the pdf (could not create resource error), but if i do the primefaces UI gets broken. Even if i remove the parameter, it doesnt get fixed. I am using primefaces-5.1, liferay 6.1 and liferay-faces 3.1.3-ga4. Here are two screenshots before and after:


The contents of faces-config.xml:
<!--?xml version="1.0"?-->
<faces-config version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd">
<application>
		<resource-handler>report_utils.ReportResourceHandler</resource-handler>
	</application>
	<lifecycle>
		<phase-listener>com.liferay.faces.util.lifecycle.DebugPhaseListener</phase-listener>
	</lifecycle>
</faces-config>

I downloaded different versions of liferay-faces, but that didnt help. I have no idea what the problem could be. I need some help in solving this.
Namik Yaqubov, modificado 9 Anos atrás.

RE: Primefaces UI broken when defining custom Resource Handler in faces-con

New Member Postagens: 3 Data de Entrada: 23/02/15 Postagens Recentes
Didnt anyone face something like this?
thumbnail
Juan Gonzalez, modificado 9 Anos atrás.

RE: Primefaces UI broken when defining custom Resource Handler in faces-con

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Hi Namik,

seems a known issue in Liferay Faces: https://issues.liferay.com/browse/FACES-1891.

To solve it, please change your pom.xml to the 3.1.5-ga6-SNAPSHOT version of all Liferay Faces libraries you are using.

You can add this SNAPSHOT repository to your pom.xml too:

https://oss.sonatype.org/content/repositories/snapshots/com/liferay/faces/

Please confirm if this works...
Namik Yaqubov, modificado 9 Anos atrás.

RE: Primefaces UI broken when defining custom Resource Handler in faces-con

New Member Postagens: 3 Data de Entrada: 23/02/15 Postagens Recentes
Thanks! I solved the problem in another way. In the CustomerResourcehandler class, that was in the original portlet, just add an else block to the handleResourceRequest method.
} else {
	super.handleResourceRequest(facesContext);
}
thumbnail
Juan Gonzalez, modificado 9 Anos atrás.

RE: Primefaces UI broken when defining custom Resource Handler in faces-con

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Hi Namik,

yes, that solution was the final approach made into source code:

https://github.com/liferay/liferay-faces/commit/fa894e9d8d5532120467c19435c7d9275795e639

So you solution should be strong enough.

Said that, whenever GA release is out (Q1 2015) it would be much better to remove these "temporary" solutions and stay in final ones, just in case that can cause other issues in future (although this one seems it won't).

Thanks!
thumbnail
Juan Gonzalez, modificado 9 Anos atrás.

Moved to Liferay Faces category

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Moved to Liferay Faces category