Foros de discusión

embedded portlet in theme

Daniel Wilmes, modificado hace 11 años.

embedded portlet in theme

Regular Member Mensajes: 164 Fecha de incorporación: 23/05/11 Mensajes recientes
Hi there,

we are embedding a portlet in a theme that makes an ajax call. We had it working fine in 6.0.6, but we are upgrading to 6.1.1 and we get this error:

LayoutAction:1019 Reject serveResource

We embed the portlet like this:

$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$theme.runtime("mydropdown_WAR_myportlet", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()


Is there something new in liferay 6.1.1 that prevents portlets from being embedded in a theme and make an ajax call?

Thanks,
Daniel
Daniel Wilmes, modificado hace 11 años.

RE: embedded portlet in theme

Regular Member Mensajes: 164 Fecha de incorporación: 23/05/11 Mensajes recientes
So I have run out of ideas on how to fix the ajax calls for embedded portlets. I have searched the internet, but I have not found any solutions.

I compared the querystring passed into the functions that do the ajax call between 6.1.1 and 6.0.6 and the urls are identical.

I tried using jquery ajax and I still get the same error:

[2012-09-20 09:45:05,081] ERROR [http-bio-8080-exec-106] [RARE] LayoutAction:1019 Reject serveResource for http://localhost:8080/web/guest/home on portlet_WAR_myPortlet


Javascript below:


//JQUERY
function myFunction(queryString){
    alert(queryString);
    jQuery.ajax({
    url: queryString,
    dataType: "POST",
    success: function(data){
             
    }
  });
}

//ALLOY UI
function myFunction2(queryString){
    var A = AUI();
    var io = A.io.request(queryString, {   
        dataType : 'json',
        on: {   
            success: function(id, obj) {   
                try{
                    location.href = this.get('responseData').myVariable;
                }catch(e){
                    alert(e);
                }
            },
            failure: function() {    
                alert('Error.....');   
            }
        } 
    });
}


I added the portlets to page as a normal portlet and the ajax calls worked as expected. I am not sure how to proceed.


Does anyone have suggestions or know of a LPS that deals with this issue? I am using liferay 6.1.1
Daniel Wilmes, modificado hace 11 años.

RE: embedded portlet in theme

Regular Member Mensajes: 164 Fecha de incorporación: 23/05/11 Mensajes recientes
Seems to be related to this in the javadoc:


                            if (!allowAddPortletDefaultResource) {
860                                    String url = null;
861    
862                                    LastPath lastPath = (LastPath)request.getAttribute(
863                                            WebKeys.LAST_PATH);
864    
865                                    if (lastPath != null) {
866                                            StringBundler sb = new StringBundler(3);
867    
868                                            sb.append(PortalUtil.getPortalURL(request));
869                                            sb.append(lastPath.getContextPath());
870                                            sb.append(lastPath.getPath());
871    
872                                            url = sb.toString();
873                                    }
874                                    else {
875                                            url = String.valueOf(request.getRequestURI());
876                                    }
877    
878                                    _log.error(
879                                            "Reject processAction for " + url + " on " +
880                                                    portlet.getPortletId());
881    
882                                    return null;
883                            }



http://docs.liferay.com/portal/6.1/javadocs-all/src-html/com/liferay/portal/action/LayoutAction.html
Daniel Wilmes, modificado hace 11 años.

RE: embedded portlet in theme

Regular Member Mensajes: 164 Fecha de incorporación: 23/05/11 Mensajes recientes
We fixed it by doing this:

1. Add <add-default-resource>true</add-default-resource> to each embedded portlet.
2. Add the portlet id to this property in the portal-ext.properties file like below:

portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,87,88,103,113,145,164,166,170,177,myportlet_WAR_portlet
thumbnail
Gabriel Landon, modificado hace 11 años.

RE: embedded portlet in theme

New Member Mensajes: 10 Fecha de incorporación: 30/09/10 Mensajes recientes
I did face the same problem.
Thank you very much, you save my day!
Julien POLLY, modificado hace 11 años.

RE: embedded portlet in theme

New Member Mensajes: 5 Fecha de incorporación: 7/06/11 Mensajes recientes
Daniel Wilmes:
We fixed it by doing this:

1. Add <add-default-resource>true</add-default-resource> to each embedded portlet.
2. Add the portlet id to this property in the portal-ext.properties file like below:

portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,87,88,103,113,145,164,166,170,177,myportlet_WAR_portlet


Thanks for this. It works!
Just to precise something however : don't forget to write in the whitelist the liferay portlets also, otherwise they won't work anymore...
(It was my case and I searched for two hours why!)
thumbnail
Jitendra Rajput, modificado hace 11 años.

RE: embedded portlet in theme

Liferay Master Mensajes: 875 Fecha de incorporación: 7/01/11 Mensajes recientes
Daniel Wilmes:
We fixed it by doing this:

1. Add <add-default-resource>true</add-default-resource> to each embedded portlet.
2. Add the portlet id to this property in the portal-ext.properties file like below:

portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,87,88,103,113,145,164,166,170,177,myportlet_WAR_portlet


To add portlet in layout do we need to make this entries in respective files ?
theertha rajeev, modificado hace 11 años.

RE: embedded portlet in theme

New Member Mensajes: 6 Fecha de incorporación: 19/03/13 Mensajes recientes
We fixed it by doing this:

1. Add <add-default-resource>true</add-default-resource> to each embedded portlet.
2. Add the portlet id to this property in the portal-ext.properties file like below:

portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,87,88,103,113,145,164,166,170,177,myportlet_WAR_portlet




thank u so much..its working in my case also...
thumbnail
Nicolas Tamayo, modificado hace 11 años.

RE: embedded portlet in theme

Junior Member Mensajes: 29 Fecha de incorporación: 3/10/12 Mensajes recientes
HI!!!!

i developed a portlet that make a custom Login

this portlet is embedded in a velocity template of theme. and i make all process and configurations that you did.

the issue is that when i trying execute the custom login that execute the PortalClassInvoker in order the execute a LoginUtil.login (class that belong to portal-impl.jar) and execute successfully the login. this call not is executed, not show some notice.

this issue only is present when the portlet is embedded in the velocity templeate.

hope you can help me!!
thumbnail
Gabriel Landon, modificado hace 11 años.

RE: embedded portlet in theme

New Member Mensajes: 10 Fecha de incorporación: 30/09/10 Mensajes recientes
Nicolas Tamayo:

i developed a portlet that make a custom Login
this portlet is embedded in a velocity template of theme. and i make all process and configurations that you did.
the issue is that when i trying execute the custom login that execute the PortalClassInvoker in order the execute a LoginUtil.login (class that belong to portal-impl.jar) and execute successfully the login. this call not is executed, not show some notice.


I also have a custom login porlet embedded in my theme and have no problem.
Did you follow : http://www.liferay.com/it/community/forums/-/message_boards/message/16008439

1-
MethodKey key = new MethodKey("com.liferay.portlet.login.util.LoginUtil", "login", HttpServletRequest.class, HttpServletResponse.class, String.class, String.class, boolean.class, String.class);
PortalClassInvoker.invoke(false, key, new Object[] { PortalUtil.getHttpServletRequest(portletRequest), PortalUtil.getHttpServletResponse(portletResponse), username, password, false, null});

2-
session.enable.phishing.protection=false

3-
<private-session-attributes>false</private-session-attributes>
thumbnail
Nicolas Tamayo, modificado hace 11 años.

RE: embedded portlet in theme

Junior Member Mensajes: 29 Fecha de incorporación: 3/10/12 Mensajes recientes
Thanks Gabriel.

I remembered that i had no specified the false value in the tag "<private-session-attributes>" in the liferay-portlet.xml file. this was the issue with the call LoginUtil.login through to PortalClassInvoker; take affect

Thanks a lot
Leena Ruhela, modificado hace 9 años.

RE: embedded portlet in theme

New Member Mensaje: 1 Fecha de incorporación: 7/11/13 Mensajes recientes
Daniel Wilmes:
We fixed it by doing this:

1. Add <add-default-resource>true</add-default-resource> to each embedded portlet.
2. Add the portlet id to this property in the portal-ext.properties file like below:

portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,87,88,103,113,145,164,166,170,177,myportlet_WAR_portlet




Thanks Daniel. I faced the same issue for Liferay 6.2. Your solution worked.
Anton Truong, modificado hace 6 años.

RE: embedded portlet in theme

New Member Mensajes: 5 Fecha de incorporación: 12/01/17 Mensajes recientes
Hi,

I am developing with Liferay 7 GA4.

I have trouble to embed a portlet into a theme.
The steps I have done:

1. Using blade cli with blade create -t portletprovider to create an embeddable portlet.
- The model.class.name=com.liferay.asset.kernel.model.AssetEntry
2. In the file portal_normal.ftl of the theme I have insert this:
<@liferay_portlet["runtime"]
portletProviderAction=portletProviderAction.VIEW
portletProviderClassName="com.liferay.asset.kernel.model.AssetEntry"
/>

3. Deploying the portlet and the theme.

At the end the portlet is not showing up. I also have written something around the @liferay_portlet-tag like "here is the embedded portlet <@liferay_portlet..../>here ends the portlet"

But it only shows "here is the embedded portlethere ends the portlet"
What I also tried was changing the portlet action from ADD to VIEW and also changed in the portlet the Interface and Service Class in the @Component annotation.