掲示板

content/Language.properties problem in hook

7年前 に Fernando Cabrera によって更新されました。

content/Language.properties problem in hook

Junior Member 投稿: 47 参加年月日: 14/08/01 最新の投稿
Hello,

I have a Liferay plugin project of type hook. In liferay-hook.xml file I declared this:
<language-properties>content/Language_es.properties</language-properties>

Also I created the Language_es.properties file in the directory docroot/WEB-INF/src with this content:
warning-your-session-has-expired=¡Atención! Debido a la inactividad, su sesión ha expirado.

Basically my requirement is to change that message that appears after the session has expired. I deployed the hook in my local server (Glassfish in case it matters) and at the beginning I didn't see that my change taken effect, I wasted a lot of time to verify that I hadn't made a mistake with file name, property name, directory, etc. Finally I read in some thread of this forum that maybe the problem could be the browser cache, so I tried in a private tab in Chrome and it worked perfect.

The problem was when I deployed in QA environment, I tested it in the same way, with Chrome private navigation, but for some testers with IE (version 11) even after delete temporary files (I saw it!) the portal still showing the original message.

I prepared a new Liferay portal in a different local server (just because the other one has many applications and takes more time for start it) and for my surprise even with a private tab in Chrome it shows the original message. At this point I no longer understand anything but following the idea that the cache is the problem I tried to resolve it from the server side putting this options in the portal-ext.properties file:
  • browser.cache.disabled=true
  • browser.cache.signed.in.disabled=true
  • minifier.inline.content.cache.size=0
  • com.liferay.portal.servlet.filters.language.LanguageFilter=false
  • theme.css.fast.load=false
  • theme.images.fast.load=false
  • minifier.enabled=false
First I tried them one by one, then combining some of them but nothing worked until I tried with this one:
  • javascript.fast.load=false
I was happy to obtain my custom message even in normal navigation with Chrome and IE, it wasn't even necessary a hard refresh of the page. I removed all the properties that I tried, thinking that after restarting the server the browser will remain with the cache of the version that works but it wasn't, it shows the original Liferay message in both browsers, that made me think that the javascript file that the browser receives is created on the server starting process and if javascript.fast.load=true it is created before to read the property of my hook, and in case of false it creates it after already "know" the overridden property, but I try it in Firefox for the first time and the message was OK.

I can use javascript.fast.load=false for now but it is not going to be the ideal for performance in the production environment, I don't know if it is browsers issues or there is something buggy with the Language_xx.properties mechanism when it is on a hook, I refuse to make an ext project for that, I even would prefer to put directly the language properties file in some directory of the server.

Is there a way to get the solution with portal-ext.properties that do not compromise too much the performance? Maybe with a property or a combination that I didn't try.

Thank you.
thumbnail
7年前 に Olaf Kock によって更新されました。

RE: content/Language.properties problem in hook

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
Fernando Cabrera:
First I tried them one by one, then combining some of them but nothing worked until I tried with this one:
  • javascript.fast.load=false


Based on your description it's a good guess that Liferay cached the message in the minified javascript. This is probably cached in a temp (worst case: work) folder of tomcat - you could find it there and delete it so that it's regenerated. Or just delete everything from this folder - careful: This will cause all JSPs to be recompiled, which might cause an initial page load impact.
7年前 に Fernando Cabrera によって更新されました。

RE: content/Language.properties problem in hook

Junior Member 投稿: 47 参加年月日: 14/08/01 最新の投稿
Thank you Olaf.

In my case that I'm working with Glassfish I deleted domains/domain1/generated folder but sadly it is not the solution.

The steps from the beginning are:

  • Log in and let the session to expire, you will see the original message. Now the browser puts on cache the barebone packaged files.
  • Deploy hook project with the overriden message.
  • Log in again and wait for the message to appear, you will see the original one because of the browser cache.
  • Stop server, add javascript.fast.load=false to portal-ext.properties, optionally delete temporary files, start server.
  • When the session expired you will see your custom messege. Now the browser puts on cache all independent files that are part of the barebone list.

The issue is going to happen with the following scenarios:

  • Redeploy the hook to change again the message, with current portal configuration (javascript.fast.load=false) shows the previous custom message. If you revert the property to false, shows Liferay original message. This is because the packaged and the independent files are in cache.
  • Revert the property to false for performance reasons, after the server restart you will see the Liferay original message.

Now that I'm more sure that the problem is the cache I tried this properties:

browser.cache.disabled=true
browser.cache.signed.in.disabled=true

But documentation says "It will not have an impact on static content or other resources" like the javascript files. Also tried with no success:

combo.check.timestamp=true
com.liferay.portal.servlet.filters.cache.CacheFilter=false

How can I force to the browser to download a new version? I am missing some configuration? is it a known bug? Please let me know if you have any solution or ideas for a workaround. Ask to users to delete cache is unacceptable.

Thank you.