You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bridges-dev@portals.apache.org by "Ate Douma (JIRA)" <br...@portals.apache.org> on 2005/09/28 23:32:48 UTC

[jira] Resolved: (PB-9) Resources overewritten by portlet: need to be restored

     [ http://issues.apache.org/jira/browse/PB-9?page=all ]
     
Ate Douma resolved PB-9:
------------------------

    Resolution: Won't Fix
     Assign To: Ate Douma

> Resources overewritten by portlet: need to be restored
> ------------------------------------------------------
>
>          Key: PB-9
>          URL: http://issues.apache.org/jira/browse/PB-9
>      Project: Portals Bridges
>         Type: Bug
>   Components: struts
>     Versions: 0.4
>  Environment: JBoss 4.0.2 w/ Tomcat 5x; Liferay Portal 3.6.1; Struts 1.27; JDK 1.4.2_09; WinXP
>     Reporter: James Schopp
>     Assignee: Ate Douma

>
> Liferay uses Struts to layout the actual portal itself, and so has message resources stored in the request attributes under the Struts key Globals.MESSAGES_KEY. This gets overwritten by portlets using Struts Bridges, and causes problems later on (at leaast in Liferay) in portal rendering (since messages can longer be found).
> I have created a temporary fix in Liiferay by creating my own StrutsPortlet subclass that saves off the messages before processRequest runs, and restores them afterward. However, I believe this should actually be a part of the default StrutsPortlet provided with bridges, since it could/should really affect any portal framework (potentially).
> The code is VERY simple to implement. Here is the subclass that I created: it is obvious how to incorporate it into the base class:
> <code>
> package com.liferay.portal.apache.bridges;
> import java.io.IOException;
> import javax.portlet.PortletException;
> import javax.portlet.PortletRequest;
> import javax.portlet.PortletResponse;
> import javax.servlet.http.HttpServletRequest;
> import org.apache.portals.bridges.struts.StrutsPortlet;
> import org.apache.struts.Globals;
> /**
>  * LiferayStrutsPortlet this portlet adds the additional functionality (over StrutsPortlet) to restore overwritten resources.
>  * It works such that:
>  * <ul>
>  * <li>message resources that were in in the request BEFORE the call to processRequest are saved restored afterward such
>  *   as to avoid conflicts with resources used for the portal itself (and other struts portlets)</li>
>  * </ul> 
>  * 
>  * @author James Schopp
>  * 
>  */
> public class LiferayStrutsPortlet extends StrutsPortlet
> {
>     protected void processRequest(PortletRequest request, PortletResponse response,
>             String defaultPage, String requestType) throws PortletException,
>             IOException
>     {    	
>         HttpServletRequest req = getHttpServletRequest(this, request, response);
>         Object objMessages = req.getAttribute(Globals.MESSAGES_KEY);
>         
>         try {
>         	super.processRequest(request, response, defaultPage, requestType);
>         } finally {     
>         	req.setAttribute(Globals.MESSAGES_KEY, objMessages);
>         }
>     }
> }
> </code>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: bridges-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: bridges-dev-help@portals.apache.org