Package Gadgets
1 Overview
The gadgets can be packaged in a war to be automatically deployed in the portal. They are described in a gadgets.xml file that is stored in the WEB-INF of the webapp. To have this file recognized by the portal, you need to add a listener to your webapp.
2 Examples
2.1 Folder hierarchy
2.2 gadget.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<gadgets>
<gadget name="Todo">
<path>/gadgets/Todo.xml</path>
</gadget>
<gadget name="Weather">
<url>http://www.labpixies.com/campaigns/weather/weather.xml</url>
</gadget>
</gadgets>
If the gadget is a local gadget (using the xml tag
path), the gadget is copied in the JCR. If a directory has the same name as the gadget, this one is copied as well. In our sample, it will copy the directory Todo and all the files in it to the JCR.
If the gadget is a remote gadget (using the tag
url), we store the url, and the gadget is not copied into the JCR. The server will only cache the gadget according to the information in the http header.
2.3 web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>my Gadgets</display-name>
<listener>
<listener-class>org.exoplatform.application.gadget.GadgetRegister</listener-class>
</listener>
</web-app>
3 Example of eXoGadgets