Fórum

embed facebook portlet in custom portlet

Hebatu Allah Fahmy, modificado 11 Anos atrás.

embed facebook portlet in custom portlet

Junior Member Postagens: 41 Data de Entrada: 06/08/12 Postagens Recentes
Hello everyone ,

I develop custom icefaces portlet which allow comments via facebook and comments via user website account .
The portlet is done by icefaces tabs component .

In the first tab facebook comments should be embedded .
in the second tab comments via website should be done .

I embed facebook portlet inside my custom portlet through the following code :

FacesContext context = FacesContext.getCurrentInstance();
PortletRequest request = (PortletRequest)context.getExternalContext().getRequest();
HttpServletRequest servletRequest = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request));
PortletResponse response = (PortletResponse)context.getExternalContext().getResponse();
HttpServletResponse servletResponse = PortalUtil.getHttpServletResponse(response);

// final ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
String portletHtml = "";
// get the preferences
PortletPreferences prefs;
try {
prefs = PortletPreferencesFactoryUtil.getPortletPreferences(servletRequest, portletId);
prefs.setValue("href", "http://example.com");
// dont forget to store the preferences
prefs.store();

portletHtml = renderPortlet(request, response, portletId, "");
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ValidatorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PortalException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ReadOnlyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
};
// set a preference

// get the HTML from the portlet
try {
PrintWriter out = servletResponse.getWriter();
out.print(portletHtml);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


The problem is when trying to set preferences of Facebook portlet like
href
I have the following exception

The FacesServlet cannot have a url-pattern of /*. Please define a different url-pattern.

Stack Trace

javax.faces.FacesException: The FacesServlet cannot have a url-pattern of /*. Please define a different url-pattern.
at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:330)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at org.portletfaces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:422)
at org.portletfaces.bridge.GenericFacesPortlet.doEdit(GenericFacesPortlet.java:138)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:330)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64

what could be the problem ?

All your feedback is highly appreciated .

Thanks in advance .
thumbnail
Kyle Joseph Stiemann, modificado 11 Anos atrás.

RE: embed facebook portlet in custom portlet

Liferay Master Postagens: 760 Data de Entrada: 14/01/13 Postagens Recentes
Hi Hebatu,
I noticed "org.portletfaces.bridge" in the stacktrace. When you get a chance, I would recommend that you upgrade to Liferay Faces Bridge and see if the problem goes away.

Thanks,
Kyle
Hebatu Allah Fahmy, modificado 11 Anos atrás.

RE: embed facebook portlet in custom portlet

Junior Member Postagens: 41 Data de Entrada: 06/08/12 Postagens Recentes
Many thanks kyle

That is it emoticon .

In addition of this solution I need to edit some things in liferay-portlet.xml

Thanks again for your guidance emoticon , it worked now