Liferay 6 : something they don't tell you




on April 26, 2012, at 07:21 PM

Today I just realized that Liferay 6 ships with a new filter and a new servlet ... the problem is that they both map to /documents/* ! The problem is that,if you have little fantasy like I do, you will add your document library portlet ( or document library display portlet ) in a page that maps to /documents ! If that worked up to the previous version (5.2.3) you will find that the new version breaks your installation ( if you have a layout like I did ).

Here's what's in web.xml :

the filter

    <filter-mapping>
        <filter-name>Auto Login Filter</filter-name>
        <url-pattern>/documents/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

and the servlet

    <servlet-mapping>
        <servlet-name>Web Server Servlet</servlet-name>
        <url-pattern>/documents/*</url-pattern>
    </servlet-mapping>

my page was ( I'll explain later why the past ) served at http://myserver/documents (obviously this is not the real url) and in that page there was the document library portlet.

When I tried to click on a document the url that was called was http://myhost/documents/-/document_library/view/21794

If we analyze what happens in the servlet container, the filter is fired and then the servlet is fired ( I didn't actually debug/test this but that's what I expected to happen ) then everything should have been sent to the document library portlet and the file should have been served... should

That was not the case and, up to this morning, I had no idea that the problem was the page name. To make a long story short, I tested, instead of using the friendly url 'documents', using the canonical liferay path : http://myhost/web/mycommunity/documents/-/document_library/view/21794 and magically the file was served ! What happened ? As far as I can tell : neither the filter nor the servlet was fired. This, to me, looks like a bug : I asked the liferay forum for a confirmation bofore opening a big report but haven't received any reply up to now.

I have, for the moment, resolved my issue by changing the 'friendly url' from documents to document_library so that now the url is http://myhost/documents_library/-/document_library/view/21794 and everything is back to normal .

If you are willing to test/replicate the issue, please update the liferay forum report so that the staff @liferay can actually be aware of the issue an maybe come up with a better solutio/update of the documentation !

Leave a comment

Name (required)
E-mail (required, will not be published)
Website
Comment

Enter value: Captcha