Struts2-Interceptors-Extension Library

June 19, 2012

A bundle of interceptors which extend the existing built-in interceptors of the Struts2 framework with some additional features helping development and support of Struts2 applications.

Check github out for source and info.


PropertyManager Utility on GitHub

June 7, 2012

A Java utility for managing property files:

  • simple
  • open source 🙂
  • Mavenized
  • Unit tested

Custom indexing (using Java threads) with Hibernate Search

April 28, 2011

The post is based on latest development on a project:  the requirement is to implement a custom incremental update of the Lucene index. The update takes place at pre-defined (configurable) intervals and indexes all entities created or modified since the last run (i.e. full text search index is aligned with the DB changes every 60 min while the users are accessing the application)

The technology stack is Hibernate 3.6, Hibernate Search 3.3, Lucene 3.0.1, Spring 2.5.6, Java 5.

Why and How

Read the rest of this entry »

Define another XWiki SuperAdmin account

June 20, 2010

Superadmin is the system administrator account provided by Xwiki and he has always full access to the system.

Check documentation: Superadmin is disabled by default and his password can be modified in the xwiki.cfg file.

Now my problem: superadmin has 1,2,3…9 characters while my existing repository of users (custom application built on top of Oracle Internet Directory – LDAP server) only allows username with 8 chars.

I didnt want to lose the possibility to use superadmin, so I amended my authentication handler (see SSOAuthServiceImpl from previous post) to set as superadmin a different account (xwiki).

Struts2 Static Content

November 6, 2009

In the Apache Struts2 Documentation Performance Tuning page one of the recommended tips for improving the performance of the framework is to avoid Struts serving the static content.

Struts tags and themes include a set of static resources – javascript libraries, CSS, Freemarker templates – which are included inside the Struts jar file. The framework, via a filter (org.apache.struts2.dispatcher.FilterDispatcher which then delegates to a “staticLoader” class), retrieves those resources from the jar files (unjar them on the fly) and serves them on request.

Although this works quite neatly – nice to have all classes and resources contained together – it adds an unnecessary overhead upon serving the http request.

Read the rest of this entry »

Customising Struts2 JSP tags

March 13, 2009

Here is a possible way to customise the JSP taglib provided by the Struts2 framework.

The topics covered in this post are:

  • add a custom attribute to a given tag (e.g. TextField)
  • customise the Freemarker template to modify the generated HTML code
  • define new themes and templates
  • generate the new TLD for the customised version of the taglib
  • deploy it in a web application (WAR file)

The sample I have created implements a read-only version of the Struts2 JSP taglib: if a given attribute (i.e. viewMode) is set to true then a simple label (plain text) is rendered, instead of the html code for the input type, making the information on the form not editable.

This, in principle, achieves the same purpose as the disabled attribute but it looks much nicer on the web form.

Read the rest of this entry »

XWiki – User Authentication with Oracle SSO

October 15, 2008

XWiki is a popular Java-based wiki software offering a good variety of features and plugins. It is pretty advanced, therefore ideal for any enterprise requiring a content management tool which is flexible, professional and free 🙂

Installation and configuration come in different flavors, starting with the standalone distribution (Jetty container on HSQLDB db), by far the easiest option. Alternatively the XWiki WAR file can be deployed on any servlet container and any database of your choice (Oracle 10.1.2 RDBMS and OC4J 10.1.3 in my case).

Read the rest of this entry »