JBoss.orgCommunity Documentation

Chapter 4. Gadget development

4.1. Gadgets
4.1.1. Existing Gadgets
4.1.2. Create a new Gadget
4.1.3. Remote Gadget
4.1.4. Gadget Importing
4.1.5. Gadget Web Editing
4.1.6. Gadget IDE Editing
4.1.7. Dashboard Viewing
4.1.8. Standard WebApp for Gadget importer
4.2. Set up a Gadget Server
4.2.1. Virtual servers for gadget rendering
4.2.2. Configuration

Abstract

This chapter provides you all the basic knowledge about gadget developments through two following topics:

With the knowledge you have gained, you will know how to deploy a gadget in GateIn 3.2.

A gadget is a mini web application, embedded in a web page and running on an application server platform. These small applications help users perform various tasks.

GateIn 3.2 supports gadgets, such as Todo, Calendar, Calculator, Weather Forecasts and RSS Reader.

Important

The following sections require more textual information.

In GateIn 3.2, you can create a WebApp folder to contain the configuration of the list of gadgets which are automatically added to the Application Registry.

This section shows you how to create a WebApp which has a standard structure processed by the Gadget importer.

The WebApp structure consists of two necessary files, including web.xml, and gadget.xml.

In the web.xml file, there are 2 requirements:

<web-app>
  <display-name>eXoGadgets</display-name>
  <filter>
    <filter-name>ResourceRequestFilter</filter-name>
    <filter-class>org.exoplatform.portal.application.ResourceRequestFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>ResourceRequestFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <servlet>
    <servlet-name>GateInServlet</servlet-name>
    <servlet-class>org.gatein.wci.api.GateInServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>GateInServlet</servlet-name>
    <url-pattern>/gateinservlet</url-pattern>
  </servlet-mapping>

</web-app>
    

The gadget.xml file is used to locate the configuration of gadgets that you want to add to the Application Registry.

 <gadgets
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gadgets_1_0"
    xmlns="http://www.gatein.org/xml/ns/gadgets_1_0">

	<gadget name="To-do">
		<path>/gadgets/Todo/Todo.xml</path>
	</gadget>

	<gadget name="Calendar">
		<path>/gadgets/Calendar/Calendar.xml</path>
	</gadget>

	<gadget name="Calculator">
		<path>/gadgets/Calculator/Calculator.xml</path>
	</gadget>

	<gadget name="rssAggregator">
		<path>/gadgets/rssAggregator/rssAggregator.xml</path>
	</gadget>

  <gadget name="Currency">
    <url>http://www.donalobrien.net/apps/google/currency.xml</url>
  </gadget>

  <gadget name="ServicesManagement">
    <path>/gadgets/ServicesManagement/ServicesManagement.xml</path>
  </gadget>
</gadgets>

    

This file has 3 important tags: