Liferay 7 Development, Part 1


So I've been doing some LR7 development recently.  It's an exciting and challenging platform to get your head around and I thought I would just work up an example portlet, spread it across a number of blog entries, and hopefully deliver something useful in the process.

And that's what I'm going to do here.  Not only is the blog going to cover all of the step by step sort of stuff, but the project itself is going to be available on GitHub for you to pull and review at your leisure.

Let's dive in...

The Project

First off, I cannot take credit for the project idea, I'm saying that up front so there's no confusion.

I was recently working in an environment where developers had no direct access to the development server - no way to view or edit files, no way to download log files to review what was going on, no way to tweak property files, ...  It wasn't so much that we couldn't actually do these kinds of things (the sys admin would let us look at their terminal viewing files, the SA would make whatever changes we asked, the SA would give us the logs as is, ...), the developers were just not allowed to have command line access on the server.

So this planted a seed that started with the question, has anyone exposed access to the filesystem in the portal before?

Actually they have.  I found Jan Eerdekens' blog about a portlet he created:

So cool, there was precedent, but Jan's portlet is for Liferay 6.2, and that wasn't going to work for me with 7.

So the seed has grown into the blog project: Create a filesystem access portlet.

So now I have a plant (the project), but it needs some nurturing to get it to bear fruit.

The Specifications

Our portlet has a basic set of specifications that it must have:

  • Must be able to list files/folders from the filesystem.
  • Must be able to view file contents within the browser, preferably with syntax highlighting.
  • Must be able to edit file contents within the browser, preferably with syntax highlighting.
  • Must be able to add new files and folders.
  • Must be able to delete files and folders.
  • Must be able to 'touch' files and folders, updating the last modified dates for the files and folders.
  • Must be able to download files and directories (as zip files) from the server.
  • Must be able to upload files to the server.
  • Must be configurable so these features can be disabled, allowing an admin to choose a subset of these features which are allowed.

That's a pretty sweet set of specifications.  The good news is that they are all pretty easy to knock out.

The Requirements

There are some additional requirements for our project:

  • Must run on Liferay 7 CE GA2 (or newer).
  • Must use Gradle for the build tool.
  • Must be full-on OSGi modules, no legacy stuff.
  • Must leverage Lexicon.
  • Must leverage the new Configuration facilities.
  • Must leverage the new Liferay MVC portlet framework.
  • Must provide new Panel Application (side bar) support.

So these are the real fun parts of the project.  We're going to be using the new Liferay build tools.  We're going to use OSGi.  We're going to leverage the new Liferay MVC framework and all of the other goodies.  We're going to see what role Lexicon plays in our app.

One additional requirement - the project must be available on GitHub.  This is going to be our tool for learing LR7 development, so we're going to share.


Well, that's it for part 1.  The project has been introduced, so we all know where we're going and whether the outcome is successful.

Look forward to seeing you in the next installment...


Hi David, this blog series a good for developers. I want to request a small thing. Can you edit your blogs and add next blog links in end of the blog content? I will be very helpful to users to read complete series continuously emoticon