¡Liferay es Líder en el Cuadrante Mágico de Gartner por Sexto Año consecutivo! Sepa por qué aquí

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.

0 archivos adjuntos
34482 Accesos
Promedio (9 Votos)
La valoración media es de 3.6666666666666665 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
This is an excellent feature. It makes... Prasanta Bhuyan 28 de octubre de 2013 15:31
Can I overwrite the files under portal folder... Srikanth Reddy Sanivarapu 4 de mayo de 2014 3:40
Using 6.2 CE I have found you have to have your... Dave Weitzel 5 de noviembre de 2014 8:45

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.
This is an excellent feature. It makes customization for multiple tenants on same portal instance super easy without ending up with tons of if elses. But I am wondering if this is applicable to the customization of JSPs alone or, if this can be extended to other customizations within hook.
Publicado el día 28/10/13 15:31.
Can I overwrite the files under portal folder (liferay-portal-6.1.20-ee-ga2\tomcat-7.0.27\webapps\ROOT\html\portal\update_pass­word.jsp). I think I would make sense to document all the cases in the wiki. Please let us know. Thanks.
Publicado el día 4/05/14 3:40.
Using 6.2 CE I have found you have to have your own version of any file that includes any customized jsps.
so if you say changed an jspf file you need to reference that as <filename>.<hook name>.jspf in the page including it.

This is when using the <%@ include file="/html/portlet/etcetc/subfile.jspf" %> statement

This gets complicated with include init.jsp as if you follow the rules you should use init-ext.jsp as your customization but in fact that needs to be included as init..<hook name>.jsp which means you have to change the init.jsp file you were avoiding to include it...

LPS-51360 created.
Publicado el día 5/11/14 8:45.