Foros de discusión

PortletDisplayTemplateUtil with resourceRequest

Abid Mehmood, modificado hace 6 años.

PortletDisplayTemplateUtil with resourceRequest

Junior Member Mensajes: 66 Fecha de incorporación: 8/09/11 Mensajes recientes
Hi,
I have been using PortletDisplayTemplateUtil pretty successfully to intergrate ADTs in my custom portlets. ADTs get integrated pretty nicely with my custom porlets. But today when I tried to integrate ADT in contents that i server using serveresource method problem occur.

I get the following exception.

java.lang.ClassCastException: com.liferay.portlet.ResourceRequestImpl cannot be cast to javax.portlet.RenderRequest.

So it works with renderRequest but not with ResourceRequest .

Any help in this regard would be appreciated.
thumbnail
Olaf Kock, modificado hace 6 años.

RE: PortletDisplayTemplateUtil with resourceRequest

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
Abid Mehmood:
So it works with renderRequest but not with ResourceRequest .


Which method from that class are you using? It looks like it will work only with HttpServletRequest
Abid Mehmood, modificado hace 6 años.

RE: PortletDisplayTemplateUtil with resourceRequest

Junior Member Mensajes: 66 Fecha de incorporación: 8/09/11 Mensajes recientes
Thank you for reply Olaf, I am using renderDDMTemplate(pageContext, portletDisplayDDMTemplateId, result).
Exception occur at below line in PortletDisplayTemplateImpl

RenderRequest renderRequest = (RenderRequest)request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);

I am not sure, why is it being casted here specific to RenderRequest.
thumbnail
Olaf Kock, modificado hace 6 años.

RE: PortletDisplayTemplateUtil with resourceRequest

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
Oh, ok, it's the implementation. Well, I'm blank on this, just though I'd quickly clarify this interface question. You could try to override this code and provide your own implementation that just utilizes PortletRequest. That should show if there's anything specific that's used from RenderRequest. Your own implementation could even use either of these, in case there's something that's not present in PortletRequest
Abid Mehmood, modificado hace 6 años.

RE: PortletDisplayTemplateUtil with resourceRequest

Junior Member Mensajes: 66 Fecha de incorporación: 8/09/11 Mensajes recientes
Thank you and another question. What would be your approach when overriding this renderDDMTemplate method?

Thank your for your help.