Dev @ Work

A day in the life of a developer

Securing your Liferay Service using PermissionChecker

May 3rd, 2010 by Bert Willems

Welcome to 3rd article in this series of articles showing you how you can develop custom Liferay services. In the previous article I showed you how you can implement a custom Liferay service and expose it as a web service. In this article I will show you how you can secure your service using Liferay’s build-in permission model.

The permission system in Liferay is pretty powerful: you configure permissions on roles or teams. Next you apply roles to either groups (communities, organizations) or individual users. In this article we will define a new permission: the permission to access our “very exiting business logic” sayHello. After all, we have invested countless hours in developing it; we don’t want everybody to use it without us knowing ;) .

I hope this article is useful to you. Please let me know if you have any questions or comments; just drop me a message and I will get back to you as soon as I can.
Read the rest of this entry »

Posted in Java | No Comments »

Expose a Liferay Service as a Web Service

April 26th, 2010 by Bert Willems

In my previous article I showed you how you can implement a reusable Liferay Service without using Ext or  the Service Builder utility. In this article we will take it one step further and expose the service we have created as web service again without using Ext or the Service Builder.

Liferay exposes the services based on Axis using a separate web application called tunnel-web. We will hook into tunnel-web so our service will be exposed in exactly the same way Liferay services are externalized. Let’s get started.
Read the rest of this entry »

Posted in Java | No Comments »

Implementing a reusable Liferay Service Without Ext or Service Builder

April 19th, 2010 by Bert Willems

In Liferay you can split your application logic vertically exposing each component as a separate independent service. This service can be consumed by your portlet applications and any other applications. Liferay itself exposes several services to you: GroupService (for managing communities) and UserService (for managing users) for example. In this article I will show you how you can create a reusable service yourself and host it in Liferay.

In this article we will build a simple hello world service, nothing to fancy (I want to leave something for you to do yourself ;) ). We will code the service from scratch without using tools like service builder.

The project will contain 3 modules:

  1. A library containing the service contract
  2. A web application implementing the service contract
  3. A web application consuming the service

I hope you like this article, please let me know if you have any questions or comments. Lets get started. I assume you have read my previous article about using Maven to build Liferay applications. If not please read it first.
Read the rest of this entry »

Posted in Java | 5 Comments »

Setting up Maven for Liferay Development

April 17th, 2010 by Bert Willems

Welcome to the third article in these series about Liferay usage, maintenance and development. In this post I will show you how to set up your Liferay development enviroment using Apaches Maven2 build tool. We will develop a really simple JSR-168 portlet which can be deployed into Liferay. I assume you have read my previous articles and that you are using Liferay 5.2.3 on JBoss 5.1. I hope you like this post as much as the previous ones, if you have any feedback feel free to contact me or post a response.

The next version of Liferay, release date end Q1 begin Q2, will have complete support for maven including custom archetypes. Some of the steps described in this article will be obsolete then, but lets get started. Read the rest of this entry »

Posted in Java | 1 Comment »

SEO Friendly URLs for Liferay Portlets

April 4th, 2010 by Bert Willems

In my previous article I showed you how you can optimize SEO from within a portlet. Today we will take it one step further: I will show you how you can optimize portlet URLs. By default the URLs generate by Liferay are quite messy; it contains the portlet ID, the state and several other options. This doesn’t really look nice for Google.

However, Liferay has a nice method of controlling the URL the portal generates for a portlet, the ‘FriendlyURLMapper‘. You can implement this interface, registerd it in the liferay-portlet.xml and you will have nice URLs. In the following example I will show how to implement it and what each individual method does.

Read the rest of this entry »

Posted in Java | 2 Comments »

Liferay Training @ Frankfurt, part 4

March 31st, 2010 by Bert Willems

Today is the last day of the Liferay development training in Frankfurt, which is too bad because there is so much more to discover about Liferay.

A quick summary of what we have learned during this course:

  • Setting up Liferay, the plugin SDK and the Ext environment (allows you to customize the Liferay core)
  • Setting up MySQL for Liferay
  • Setting up a basic portlet
  • Setting up a Liferay entity & service, a portlet which consumes it and hook those two up including validation and localization
  • Creating a hook
  • Creating a theme
  • And a lot more…

I think this will be the last update regarding the Frankfurt training.

Posted in General | No Comments »

SEO optimize a Liferay portlet – Title, Description, Keywords

March 31st, 2010 by Bert Willems

In this post I will show you how you can SEO optimize your Liferay portlets. When you are building a portal which is (partially) available to the general public you want the search engines to rank your portal as high as possible in order to draw as much traffic to your portal as possible. Because of the nature of a portal (a ‘empty’ canvas filled with several unrelated portlets) it’s pages aren’t ideal for search engines because it hasn’t got a SEO description and keywords (or even a SEO friendly title).

In this post I will show you how you can in use build in features of Liferay to optimize SEO, First we will discus what you can do on a portal level and then I will show you how you can optimize SEO directly from a portlet itself.
Read the rest of this entry »

Posted in Java | 2 Comments »

Liferay Training @ Frankfurt, part 3

March 30th, 2010 by Bert Willems

Today is the second day of the Liferay development course in Frankfurt. Looking through the window gives me hope that the weather will be a bit better than yesterday. Yesterday we spend most of the day setting up Liferay for development and building a basic portlet.

Today we will cover how to use advanced portlet features like JSR-286 eventing, how to set up a portlet using struts and how to create a service using the service builder. I am particularly looking forward to that last part because it allows you to add additional services to Liferay.

Anyway, enough material to blog about so please stay tuned (while I get some breakfast ;) ).

Posted in Java | No Comments »

Liferay Training @ Frankfurt, part 2

March 29th, 2010 by Bert Willems

This morning was devoted to setting up a Liferay development environment. Not too much new stuff for me but I got the change to figure out some small things which will probably be useful in the future.

After a pleasant lunch we are ready to write some code!

The weather in Frankfurt is much like the weather in Holland: rainy.

Posted in Java | No Comments »

Liferay Training @ Frankfurt, part 1

March 29th, 2010 by Bert Willems

Today and the next 2 days I am going to increase my Liferay development skills in the city of Frankfurt. It is an official training by Liferay inc. I flew in Yesterday with my colleague Jeroen. I am writing this post from the class just like in the good old school days ;) . There are about 20 other developers in this 3 day training.

I am really looking forward to learn some new tricks. I will keep you posted!

Posted in Java | No Comments »