Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Liferay portlet cache?

Tags:

liferay

I am developing a portlet for Liferay Portal.

I have disabled CSS and JavaScript caching by using these codes in portal-developer.properties file:

theme.css.fast.load=false
theme.images.fast.load=false
javascript.fast.load=false
javascript.log.enabled=true
layout.template.cache.enabled=false
last.modified.check=false
velocity.engine.resource.manager.cache.enabled=false
com.liferay.portal.servlet.filters.cache.CacheFilter=false
com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter=false

But I don't know how to disable portlet caching.

When I update view.jsp file in my portlet directory I have to restart Tomcat to see changes.

like image 591
rahim asgari Avatar asked Nov 05 '09 09:11

rahim asgari


3 Answers

With the latest version, Liferay 6.2 you can turn on Development Mode.

When using the Liferay IDE

  1. Go to the Servers view and double click on the server

enter image description here

  1. Select Development Mode, save the configuration, and restart the server

enter image description here

When not using the Liferay IDE

  1. Edit setenv.sh or setenv.bat (for Windows) in $LIFERAY_DIR/$TOMCAT_DIR/bin/
  2. Add -Dexternal-properties=portal-developer.properties to the CATALINA_OPTS

Reference: https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/using-developer-mode-with-themes-liferay-portal-6-2-dev-guide-09-en

like image 129
awilkinson Avatar answered Sep 21 '22 09:09

awilkinson


I've had such problems with some misaligned clocks: When you edit the jsp through a network mount and your computer believes it's 10:00 while the server believes, that it's already 10:05, this is what might happen:

  • You change the jsp at 10:01
  • The tomcat sees it and compiles - everything works as expected, but the compiled page has a timestamp of 10:06
  • You change the jsp again at 10:03
  • Tomcat sees the changed timestamp and compares it with the timestamp of the compiled page: The compiled page is newer (timestamp-wise), so no compilation is done and the page doesn't reflect your update
  • You get frustrated, restart tomcat, which takes 2 minutes
  • You correct another error in the page, now it's timestamped 10:07
  • Tomcat picks it up, compiles it...

Also, I believe to remember some "Context" configuration enabling to change jsp translation behaviour. Are you working on an unchanged liferay/tomcat bundle? Does the same happen when you're working on just one machine? Does the same thing happen when you take a new bundle, unzip and retry?

like image 38
Olaf Kock Avatar answered Sep 22 '22 09:09

Olaf Kock


I found the solution use MultiVMPoolUtil.clear();

like image 43
Hector Avatar answered Sep 21 '22 09:09

Hector