Im writing some portlets using vaadin for UI and deploying on Liferay - works perfect. But I have a situation where I want to publish the portlet as a facebook app (iframe) using liferays share option for portlets. It gives me a URL I can open that shows me the porlet in “maximized” windows state and this can then be used as the url for the facebook app. Works fine for non vaadin portlets, but if the portlet is a vaadin app porlet it fails and vaadin shows a 404 error in the top.
As Pablo Tatann said, it seems that Vaadin apps can’t be displayed in liferay widget mode when virtual hosting is activated (for example if you deleted /web/guest/ aliases).
I tried this both on a server running only one instance and a server running more instances.
it might be the issue of missing /web/guest - its in the URL I write in the browser, but its not in the JS when I look at the source. The posts you link to talk about using rewrite to correct this. I actually do have apache in front of tomcat to handle SSL traffic so I guess I could try this also, just … I guess I dont know how to write the rule - I cannot make it work
Do you have an example of this? Im using ProxyPass to connect apache/tomcat but I should still be able to use rewrite rule, no?
In Liferay administration
- In liferay control panel → custom fields → Page → Add custom field
- In the form name your custom field as you want : for example Key = “mainlayout” / Type =: “Selection of text values” ==> Save
- Fill “Default value” with as many lines you have main layouts : for example : “normal” / “facebook” / “iframe”…
In liferay theme velocity templates
- open protal-normal.vm
- edit the content of wrapper tag in order in inject your specific layout instead of the current layout :
<div id="wrapper">
#set($mainlayoutArray = $expandoBridge.getAttribute("mainlayout"))
#set($mainlayout= "normal")
#foreach($mainlayoutiterate in $mainlayoutArray)
#set($mainlayout = $mainlayoutiterate)
#break
#end
#parse ("$full_templates_path/mainlayout/${mainlayout}.vm")
</div>
- create a directory “layout” in theme “templates” directory
- inside “layout” directory, create a file “normal.vm” : put all the content you had in your “wrapper” tag
==> If you launch your Liferay, nothing should have change for now
- Inside “layout” directory, create a file “facebook.vm”, “iframe.vm”… according to keys you set in liferay control panel
- in facebook.vm, you can copy the same content as in normal.vm, then delete header (menu…) and footer… in order to have only your main div content
You should have something close to that :
<div>
#if ($selectable)
$theme.include($content_include)
#else
$portletDisplay.recycle()
$portletDisplay.setTitle($the_title)
$theme.wrapPortlet("portlet.vm", $content_include)
#end
</div>
Deploy your theme in Liferay
Add a new page for your facebook page that will includes your portlet
Add your portlet in your page
In page configuration, change the “mainlayout” custom field value. Set it to “facebook”
==> When you display your page once again, you only see your portlet without liferay header, footer…
You copy your page url and you paste it in your Facebook application configuration
thanks. I dont know to much about making templates and so on but a question. It seams your idea is to drop doing facebookshare of >any< normally placed portlet and instead make special pages that only have this ONE application/portlet on the page and then just make sure the page does not actually show any liferay elements and then in the end, when you want to “share” you dont actually do “liferay-sharing” instead, since the page is basicly empty except for the portlet/app content you simply use this URL directly correct?
question: could I not more easily just make a “empty” template? I could then set the page template to the “empty” template and get the same effect?
the difference beeing that I would not have to do anything special to the existing templates and would stay clear of all this special customfield handling and stick to the usual page templating - keeping it more simple - and reusable?
installed it and made a new page adding only one portlet - the porlet/vaadin app I wanted to share/show on facebook and before setting it up in facebook, I set the page template to the new plain-theme.
This works.
The downside of this solution is ofcause that you need to handle this specificly and you cannot use a portlet already on our pages where the facebookshare is just a special request of a normal page.
but for isolated pages/apps is ok and I gues the upside is that you can use liferay stuff, logins and so on.