Skip to content

Latest commit

 

History

History

modules

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Modules


Custom modules samples

OSGi Modules Tips

Creating a module fragment that overrides another module

For example, if you need to change the UI of search container list on Search Portlet Page.

  • In Liferay Developer Studio File > New > Liferay Module Project.
  • Insert the name of module according to its purpose.
  • You can select the Project Template Name as activator, then Finish.
  • Open bnd.bnd file.
  • Remove the first line of bnd file.
  • To override another existing portlet you need to add this line:
Fragment-Host: com.liferay.portal.search.web;bundle-version="1.2.5"

where com.liferay.portal.search.web is the Bundle-SymbolicName of the portlet which I want to override and bundle-version is the Bundle Version of this portlet too. You can see this detailed information in portlet manifest.

For how to discover the portlet symbolic name, check the useful telnet and gogo shell commands section.

  • To override the JSP file you want, put a copy of the original JSP file inside src > main > resources > META-INF > resources.
  • Start to work in your custom file.

Good Practice Hint : When we're overriding Liferay code, it would be good to indicate that we are customizing it. We can add comments around our custom code formatted in the following ways:

JSP: <%-- CUSTOM BEGIN --%> <%--CUSTOM END --%>
JS: /* CUSTOM BEGIN */ /* CUSTOM END*/
Java: // CUSTOM BEGIN // CUSTOM END

Useful telnet and gogo shell commands

  • To connect telnet with your local bundle so you can use gogo shell.
telnet localhost 11311
  • To see the list of available modules with your current lifecycle status
lb
  • To see the modules manifesto file (where you can see the symbolic name, bundle vertion etc)
headers <modules id number>
  • To find modules with a specific keyword
lb <keyword> 
// ex: lb search

//or

lb | grep <keyword>
  • To stop some module
stop <modules id number>
  • To uninstall module
uninstall <modules id number>
  • To verify problems with some module
diag <modules id number>
  • Close telnet and shutdown tomcat
exit
  • Close only telnet
disconnet