Application Adapters

Definition #

Application Adapters are Hook Plugins that unlike our standard hooks which affect the entire portal, will allow us to scope the changes to a Site.

They were introduced in Liferay 6.1 and for the moment they only support jsp overwriting.

Examples #

A Sample Application Adapter can be found in the Liferay Plugins Repository.

How to create an application adapter #

To create a Application Adapter, all you need is a Hook with custom JSPs and "custom-jsp-global" set to false.

Like so:

<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
<custom-jsp-global>false</custom-jsp-global>

This will install an Application Adapter to your instance under the name of the hook. For Social Office, for example, you will see it says, "Social Office Hook".

Including the original JSP #

If you are overwriting a JSP from the portal, it is recommended to include the original one (when possible). In the global hooks, the mechanism to include the original jsp was including the same file ended with .portal.jsp However, when you are using application adapters the mechanism is different, in order to include the original file you should use the tag <liferay-util:include> with the attribute useCustomPage to false.

For example, if you are overwriting the view.jsp in the navigation portlet, but still want to include the original JSP from your you would to the following:

<%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %>

<liferay-util:include page="/html/portlet/navigation/view.jsp" useCustomPage="false"  />

How to install and use an application adapter #

Just deploy the hook with custom-jsp-global set to false and it will be authomatically available. 

Using Application Adapters is easy once they are installed. They will be available when creating a Site Templates or Site (under the page tab).

Conclusion #

This way other custom solutions that need custom JSPs without modifying the entire portal can do so with this method.

Developers can also package their solutions with Site Templates to make it seamless to the user.

For example, if I made an ERP solution and part of it creates sites for departments. Say it changes the bundled Wiki Portlet to extend its functionality but it only makes sense within the ERP context. I can, as the developer of the ERP solution, use Application Adapters to customize each department site for my ERP solution but still allow the front facing site to use the standard Liferay Wiki.

So programmatically, I create the ERP Site Template for users of my Application. Then from the users perspective, all they need to do is go to Control Panel > Sites click "Add" then "ERP Site" and a site designed for my webapp (including the Wiki extension) will automatically be created.

Promedio (7 Votos)
La valoración media es de 3.85714285714286 estrellas de 5.
Comentarios
Respuestas anidadas Autor Fecha
Great, just what we needed! Does anyone know... Mehrad Heidar 23 de diciembre de 2011 3:01
Nice feature! Ondřej Životský 13 de marzo de 2012 8:34
I can't get this to work with dockbar JSPs.... Harri Paalanen 29 de marzo de 2012 22:07
It seems I can use only ONE Application Adapter... Mykola M 17 de abril de 2012 5:54
I am not able to understand meaning of... Jignesh Vachhani 28 de mayo de 2012 4:55
Very nice... It helped a lot... :-) Raja Seth 1 de enero de 2013 23:11

Great, just what we needed!

Does anyone know if this will be available in Enterprise 6.0?
Publicado el día 23/12/11 3:01.
Publicado el día 13/03/12 8:34.
I can't get this to work with dockbar JSPs. With the global setting true it works fine but nothing happens if it is set to false and the hook is selected for site.
Publicado el día 29/03/12 22:07.
It seems I can use only ONE Application Adapter per Site.
So if I have two hooks and want to convert them to Application Adapters - I won't be able to use both together for one site, unless I combine them together?
Publicado el día 17/04/12 5:54.
I am not able to understand meaning of "Application Adapters are Hook Plugins that unlike our standard hooks which affect the entire portal, will allow us to scope the changes to a Site. "

Can anyone elaborate in more descriptive form?
Publicado el día 28/05/12 4:55.
Very nice... It helped a lot... :-)
Publicado el día 1/01/13 23:11 en respuesta a Jignesh Vachhani.