Workaround:

I subclassed MyFacesGenericPortlet and overrided two methods. The problem was, 
that the sessionTimeout(...) detector method did not work properly, because 
there is always as session in this context. I added the SESSION_LIVE_FLAG 
attribute to the session....


  | package com.msshop.admin.portal;
  | 
  | import javax.portlet.PortletException;
  | import javax.portlet.PortletRequest;
  | import javax.portlet.RenderRequest;
  | import javax.portlet.RenderResponse;
  | 
  | import org.apache.commons.logging.Log;
  | import org.apache.commons.logging.LogFactory;
  | import org.apache.myfaces.context.servlet.ServletFacesContextImpl;
  | import org.apache.myfaces.portlet.MyFacesGenericPortlet;
  | 
  | public class GenericAdminPortlet extends MyFacesGenericPortlet {
  |     private static final String SESSION_LIVE_ATTR = 
"msshop.SESSION_LIVE_ATTR";
  |     private static final Log log = 
LogFactory.getLog(MyFacesGenericPortlet.class);
  | 
  |     public GenericAdminPortlet() {
  |             super();
  |     }
  | 
  | /**
  |  * Render a JSF view.
  |  */
  | protected void facesRender(RenderRequest request, RenderResponse response) 
throws PortletException, java.io.IOException {
  |     if (log.isTraceEnabled())
  |             log.trace("called facesRender");
  | 
  |     setContentType(request, response);
  | 
  |     String viewId = request.getParameter(VIEW_ID);
  |     boolean nonFacesRequest = (viewId == null) || sessionTimedOut(request);
  |     request.getPortletSession(true).setAttribute(SESSION_LIVE_ATTR, 
Boolean.TRUE);
  |     if (nonFacesRequest) {
  | 
  |             setPortletRequestFlag(request);
  |             nonFacesRequest(request, response);
  |             return;
  |     }
  | 
  |     setPortletRequestFlag(request);
  | 
  |     try {
  |             ServletFacesContextImpl facesContext = 
(ServletFacesContextImpl) 
request.getPortletSession().getAttribute(CURRENT_FACES_CONTEXT);
  |             if (facesContext == null) {
  |                     facesContext = (ServletFacesContextImpl) 
facesContext(request, response);
  |                     
request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, facesContext);
  |             }
  | 
  |             // TODO: not sure if this can happen. Also double check this 
against
  |             // spec section 2.1.3
  |             if (facesContext.getResponseComplete())
  |                     return;
  | 
  |             facesContext.setExternalContext(makeExternalContext(request, 
response));
  |             lifecycle.render(facesContext);
  |     } catch (Throwable e) {
  |             handleExceptionFromLifecycle(e);
  |     }
  | }
  | 
  | protected boolean sessionTimedOut(PortletRequest request) {
  |     if (super.sessionTimedOut(request))
  |             return true;
  | 
  |     Object flag = 
request.getPortletSession(false).getAttribute(SESSION_LIVE_ATTR);
  |     return flag == null;
  | 
  | }
  | 
  | }
  | 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3925558#3925558

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3925558


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to