New book of WildFly orderable online

posted Jun 20, 2017, 7:04 AM by Luca Stancapiano   [ updated Jul 7, 2017, 3:11 AM ]

My latest Mastering Java EE Development book with WildFly is now order able online. Thanks to all those who have supported me in this work. Here is the link to order it. Here you can find the interactive demo online.

Rubia Forums 2.0.1 released

posted Aug 6, 2015, 3:52 AM by Luca Stancapiano

The new version of Rubia Forums adds:

- Wildfly 9.0.1 support
- Spanish translation (Thanks Gladys Carrizales for you contributions)
- Sources and Javadocs in the maven repositories

Rubia Forums can be taken in github or through Maven with the dependency code:


A demo is here:

Entry with:

root: gtn
john: gtn
mary: gtn

Rubia Forums 2.0.0 released

posted Jul 18, 2015, 9:42 AM by Luca Stancapiano   [ updated Jul 18, 2015, 9:48 AM ]

The new version of Rubia Forums was released on github and maven. This version is compliant with javaee 7 and it supports the following application server:

- Wildfly 8.0.0
- Wildfly 8.1.0
- Wildfly 8.2.0
- Wildfly 9.0.0

Apart bug fixing it introduces the new rest api to use Rubia Forums in other systems.

Mavenized bundle for Workdesk

posted May 23, 2015, 3:20 AM by Luca Stancapiano   [ updated May 24, 2015, 12:19 AM ]

In theese days I released a mavened version for Workdesk 4.2, a good and simple frontend to work with Alfresco as Share but simplier to configure.
The original bundle can be downloaded here.
The mavenized version is in the github and can be downloaded here.
Here you can find the current notification for the contribution to Alfresco.

Rubia Forums 1.0.0 released

posted Apr 12, 2015, 12:53 AM by Luca Stancapiano

The first release of Rubia Forums is published in github. You can find it here:
It is tested on the following platforms:
  • JBoss AS 7.1.1.Final
  • JBoss AS 7.1.2.Final
  • JBoss AS 7.1.3.Final
  • Gatein 3.6.0.Final
  • Gatein 3.7.0.Final
  • Gatein 3.7.1.Final
  • Gatein 3.8.1.Final
  • Gatein 3.8.2.Final
  • EAP 6.1.0.Final
  • EAP 6.1.1.Final
  • EAP 6.2.0.Final
  • EAP 6.3.0.Final
  • JBoss Portal 6.1.0.Final
  • JBoss Portal 6.1.1.Final

Soon I will start the 2.0.x branch for the wildfly platform and others

Rubia Forums is born!

posted Mar 9, 2014, 1:35 PM by Luca Stancapiano   [ updated Feb 16, 2015, 5:34 AM ]

I started the development of Rubia Forums. It's the old Jboss Forums project resumed and refactored with the new java enterprise technologies. Another feature respect the previous version is that it doesn't depend by the platform (JBoss Portal) but it can be installed in more environments (Actually in jboss 7 standalone and Gatein 3.6).

Here the sources.

Here a demo version installed in Gatein. You can log using the default accounts of Gatein:


Soon I will do a new homepage that it will substitute the old.

Calling a versioned call activity in Activiti

posted Feb 24, 2014, 2:20 AM by Luca Stancapiano   [ updated Feb 24, 2014, 2:21 AM ]

When you call a 'call activity' inside a versioned process you would call a versioned call activity too. By default activiti calls always the last deployed key of call activity perhaps if it is called by a versioned process. To call a versioned call activity you must customize the activiti framework extending the following classes:



Then configure the activiti.cfg.xml configuration file adding the new activity behavior factory in the process engine configuration:

<bean id="processEngineConfiguration" class=….

   <property name="activityBehaviorFactory" ref="activityBehaviorFactory" />


Add the new bean:

<bean id="activityBehaviorFactory"

class=“${my new DefaultActivityBehaviorFactory}”>


In this new class you must add the new call activity reference using the new extended class. In the CallActivityBehavior class, update the 'execute' method instead of:

ProcessDefinitionImpl processDefinition = Context





ProcessDefinitionImpl processDefinition = Context




JBoss Awards candidate

posted Jul 5, 2013, 2:54 AM by Luca Stancapiano

With very pleasure I advice that I received a candidate request to the JBoss Awards 2013 about my contributions in the jboss community. Here the announcement:

Luca participated to the first book about GateIn, the portal project. His efforts helped to enhance the overall documentation that users can find to help them design portal solutions. On top of that, Luca started to contribute a few fixes and has been helping the portal team for several years now.
Anyone can vote me here:

Thanks you to all!

A batch to upload files in Gatein

posted May 23, 2013, 1:05 AM by Luca Stancapiano   [ updated May 23, 2013, 7:35 AM ]

Gatein allows to access with webdav remotely. It is supported in all 3.x versions of Gatein, EPP 5 and EPP 6. You can write a simple batch using this protocol. Here a sample of a java main:





          import com.github.sardine.Sardine;

          import com.github.sardine.SardineFactory;


  String remote_path = "http://localhost:8080/rest/private/jcr/repository/portal-work";

  Sardine sardine = SardineFactory.begin("utente", "password");

  try {

  sardine.delete(remote_path + "/prova");

  } catch (IOException e1) {



  try {


  sardine.createDirectory(remote_path + "/prova");

  sardine.put(remote_path + "/prova/nuovo", new FileInputStream(FILE_PATH), "html/text");

  InputStream resource = sardine.get(remote_path);


  } catch (FileNotFoundException e) {


  } catch (IOException e) {



This code uses a webdav implementation library, called Sardine. Sardine 5.0, actually the last version, can be downloaded here: for the binary with maven and here: for the sources with github. The binary file is compiled with java 7, so care attention if you use java 6. For it you need to compile it from the sources. Here the runtime dependencies mandatory to execute the code: 

httpclient 4.2.3

httpcore 4.2.3

commons-codec 1.7


The client access to the workspace 'portal-work' of Gatein through the user 'utente'.  The user must be inserted in the User administration of Gatein as administrator. The permission settings of the 'portal-work' workspace are configured in the deploy/gatein.ear/02portal.war/WEB-INF/conf/jcr/repository-configuration.xml' file. Here the snippet code:

          <initializer class="">


              <property name="root-nodetype" value="nt:unstructured"/>

              <property name="root-permissions" value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove"/>


So, to access with that user, remember to add almost one of the configured roles or to add the desired role in this file.

Then the code delete, if it is, a directory 'prova' directly under the portal-work workspace, and then it recreate it.

After,  the  method sardine.put create the file from a n existent FILE_PATH directory.

In this case the uploaded file can be downloaded connecting with the browser, rest or webdav to this url: http://localhost:8080/rest/private/jcr/repository/portal-work/prova/nuovo

If you are inside a container (EJB, servlet, ecc) you don't need to use a remote protocol. An example can be found in the chapter 8 of Gatein Cookbook written by me. Here the url:

Download Service in Gatein

posted Apr 9, 2013, 8:13 AM by Luca Stancapiano   [ updated Apr 10, 2013, 12:56 AM ]

If you work with Gatein and you need to download a resource received by an external service, you must use the Download Service. It is declared in the exo.portal.component.web.server library. In your portlet action you can use the following code:

                import org.exoplatform.container.ExoContainer;

                import org.exoplatform.container.ExoContainerContext;





                public String download(MyBean bean) {


  ExoContainer container = ExoContainerContext.getCurrentContainer();

  DownloadService dservice = (DownloadService)   container.getComponentInstanceOfType(DownloadService.class);

  InputStream inpuStream = new ByteArrayInputStream(bytes);

  DownloadResource downloadResource = new InputStreamDownloadResource(nomeFile, inpuStream, getContentType(nomeFile));


  downloadId = dservice.addDownloadResource(downloadResource);

  return downloadId;


where bytes is the bytes array received by an external service and nomeFile is the name of the file that you would download. This code insert the bytes array in an internal buffer of the portal. The variable downloadId is the generated downloadId to call the resource from your page.

Below an example of a Richfaces command link in a page that allows to download the resource through the generated downloadId:

<a4j:commandLink id="idDownload"



ajaxSingle="true" reRender="idDownload"/>

The button calls the download action from the JSF component and then find the generated downloadId after the action.  The JSF component need also the following code:

                            private String downloadId;


                            public String getDownloadId() {

  return downloadId;


  public void setDownloadId(String downloadId) {

  this.downloadId = downloadId;


After the call to the action,  the resource is download through the oncomplete property connecting to the URL /portal/download of Gatein and passing the generated resourceId

1-10 of 17