Archive for April, 2012

REST Services in GateIn / eXoPlatform : add your own !

Mulitple REST services are available out of the box in GateIn / eXoPlatform. They allow to easily interact with the platform’s features and data.

Here we will see how to quickly add your own REST services (valid for eXoPlatform 3.0 or 3.5).

Java REST class

Firstly, we create the Java class which will expose the REST service :




public class MyRESTService implements ResourceContainer {

    public Response getName(@PathParam("name") String name) throws Exception {
        return Response.ok("Hello " + name + " !").build();


As you can see, this class uses standard JAX-RS annotations to expose its services (*). The only thing to add is the interface. This interface is a marker to define this class as a REST services class.

If you use Maven, the class is available with the following dependency :


Adjust the dependency version according to your Gatein / eXoPlatform version.

Declare your REST service

The second and last thing to do is to declare the REST service. To achieve this, declare your class in the GateIn / eXoPlatform configuration :


This configuration can be put either in the jar containing the java class (in conf/portal/configuration.xml), or in an extension, or even in the external configuration.

Now you just have to deploy your class and your configuration (for example, put the jar containing the class and the configuration in the tomcat’s libs), and restart the server.
Your service is now available at http://<host&gt;:<port>/portal/rest/user/name/<yourname> :

Up to you now to implement your custom REST service !



Remove the Categories’ items from the menu in WordPress

By default, WordPress displays the categories in the menu bar. If you don’t want them, you can’t just remove all the categories. At least one category should be present. And a post has to be categorized.

The solution is to hide the categories’ items of the menu bar with the following steps :

  • go to your WordPress dashboard
  • in the left menu, go to Appearance> Theme Options
  • expand the Navigation panel
  • check Hide all categories
  • save changes

Now your categories does not appear anymore in the menu.

Leave a comment

Request parameters from a portlet in eXo/GateIn

Portlet specs does not provide a standard way to read a parameter from the request within a portlet, for example to get the myparameter parameter in http://localhost/portal?myparameter=myvalue.

request.getParameter() within a portlet does not help since the request object is a PortletRequest, not the HttpRequest.

An easy solution in eXo/GateIn is to use the getRealRequest method of the concrete implementation of PortletRequest of GateIn. So, in order to retrieve the myparameter param from the request in the render phase, you can do :

((org.gatein.pc.portlet.impl.jsr168.api.RenderRequestImpl) request).getRealRequest().getParameter("myparameter")

, ,