Thursday, August 5, 2010

Spring MVC Portlet minimize not working on Weblogic 10.3.0

Question :

We have written JSR 168 Portlets using spring MVC portlet framework. Everything works fine except for the minimize portlet functionality.

The title bar changes that is minimize becomes restore but the portlet body (content) is always visible.
Please let me know if any of you faced this issue and how to resolve it.
 
Answer :
 
From what I can see from the Spring DispatcherPortlet source (I used http://www.docjar.com/html/api/org/springframework/web/portlet/DispatcherPortlet.java.html ), it looks like this is a bug in the DispatcherPortlet. The JSR168 / JSR286 specification requires that portlets not render themselves during the render lifecycle if they are minimized, and I don't see any code in the DispatcherPortlet that checks for the portlet state. From the source in the URL above, it looks like if you added this code at line 701 inside of the doRenderService() method of DispatcherPortlet and re-compiled that code, it might work for you:


if(request.getWindowState().equals(javax.portlet.WindowState.MINIMIZED)) {

return;

}

Alternately, you can change your portlet.xml so instead of using the Java class org.springframework.web.portlet.DispatcherPortlet you point it at your own class:

package sample.package;

public class MinimizedAwareDispatcherPortlet extends org.springframework.web.portlet.DispatcherPortlet

{

@Override

protected void doRenderService(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws Exception {

if(request.getWindowState().equals(javax.portlet.WindowState.MINIMIZED)) {

return;

}

super.doRenderService(request, response);

}

}

Thanks,
Venkat Sarvabatla

1 comment:

  1. Sir, Thank you for your post... i had spent almost two days trying to resolve this issue.. and ur solution helped me to resolve the issue in no time.. cheers :)

    ReplyDelete