Filesharing in Liferay

General Blogs February 27, 2015 By David Kubitza

Liferay's Document Library is great, you can do so many things! You can upload files, manage them in folders and even share links. But there is a downside: when sharing links the recipient needs either an account or you have to make the file accessible for all guest users. We can't share a file with just a password...oh wait! Now we can!


Ancud FileShare Portlet


This portlet allows you to share files for a given time span and with a password (or without). It will generate a friendly URL, which you can then share with your friends. Within the span, they can download the file using the password (or without if no password was specified).

Moreover, you can share whole folders. Similar to files, you can define a time span and a password, but also the number of possible file uploads for the folder and whether or not the folder's content is visible.

It's easy to use and free! Try it and leave a comment. :)

URL shortener for Liferay

General Blogs December 14, 2014 By David Kubitza

At this year's Liferay DevCon, Suraj Bihari had an interesting session about short URLs. As I was about to do something like this anyway, I decided to make it public from the beginning.


And now everyone can have a look at the result: Ancud ShortURL Portlet


Technically, it's a really simple Liferay MVC Service Builder portlet built with Ant and extended by a Servlet Filter Hook, which will do the redirection. It has some permission settings to define who may add and manage links and a basic front end, that's it.

When creating new URLs, the portlet will generate an identifier made of 10 alphanumeric characters. You can use this or override it by your own custom identifier. Then, just add the URL to be redirected to and you're ready to share! Whenever someone tries to invoke your portal with the identifier, the Servlet Filter will redirect to the destination URL. So you can build your own


The whole project is free of charge and totally open source, so check out how easy it works. :)

Global Plugin Dependencies

General Blogs November 17, 2014 By David Kubitza

For all interested people which participated this years Unconference, here you have the information of my session:


Sometimes one have the requirement to load a certain plugin before another. It's a typical use case, which Liferay covers with the required-deployment-contexts setting in the "" file. So if you have a plugin, which is mandantory for other plugins, you have to add it to all of these other plugins as required deployment context. If it's just your own plugins, sure, it's possible. But having also third party plugins may lead to a problem of updating the files.

Another related issue is the deploy order of all plugins. Of course one can use required-deployment-contexts again to get an order for some plugins, but maybe you need to have your portlet to deploy first. What can we do here?


Unknown feature

Since Liferay 6.1 we have the marketplace-portlet and since Liferay 6.2 you may have noticed, that it always deploys first, because every other plugin is "€šmagically" waiting for it to deploy. It's not in the required-deployment-contexts of all other plugins, so there must be a hidden mechanism to do this. And guess what, there is a mechanism!

Since Liferay 6.2 there is a plugins1 folder in a certain package of the portal-impl. In this folder we have the marketplace-portlet WAR file and a "wars.txt" file with just the name of the WAR file in it. This is all they have and all you need. So let's do it.


Adding global plugin dependencies

First step is to create an EXT, then create a new package in "ext-impl/src" called "com.liferay.portal.deploy.dependencies.plugins2" with an empty "wars.txt" file in it. Now add your plugin WAR file into the package, for example solr4-web-, and add the name of the file, again solr4-web-, into the "wars.txt". After deploying the EXT, your plugin is mandantory for all other plugins. It's also possible to add more than just one WAR file. Just add another into the package and add the name to the "wars.txt". Note, that the list of names have to be a comma separated list without whitespaces.


Adding an order

Adding plugins into the package will make sure, that these will load before other plugins, but the order within the package cannot be assured.

For this purpose have a look at the package name. Why is it "plugins2"? Because here we have the answer! "plugins1" is the package containing the marketplace-portlet. Besides, you can use "plugins2" to "plugins8" (it's hardcoded in Liferay) for ordering your plugins. So in my example the marketplace-portlet will deploy always first and afterwards solr4-web, then everything else.



When the EXT is deployed, you don't have to deploy the contained WAR files by hand, it will happen automatically. But to prevent errors on first startup, I recommend to deploy them with the EXT together.

If you make changes to your plugin, just deploy it the normal way, you don't have to redeploy the whole EXT, as long as the name stays the same. The version that is deployed inside the EXT won'€™t overwrite the later version.

When a plugin, that is deployed inside the EXT in plugins1-8, is undeployed, the plugin will be redeployed by the EXT within one minute.


Liferay 7.0

As OSGi is coming, this method will be unsupported as OSGi modules will automatically deploy only if all dependencies are given. Until then (like until Q4 2015) you can use the abovementioned.


This information was originally posted at Ancud Blog so check it out for this and other topics. :)

Showing 3 results.