I agree with Frank here... This was a major stumbling block in our application development and because we were not using a portal where we could change the source (i.e: Sun One Portal), we had to imbed terrible work around logic in every portlet to cause it to ignore render parameterers... This should definitely be standardized in the next spec.. In the meantime it would definitely be helpful to include this proposed patch as an optional non-spec behaviour (enabled in jetspeed config file. Is there one yet? i.e: WEB-INF/jetspeed-portal.xml)
Garry -----Original Message----- From: Frank Villarreal [mailto:[EMAIL PROTECTED] Sent: Friday, January 27, 2006 4:25 PM To: Jetspeed Users List Subject: RE: How to clear RenderParameters set in action ? > From: Archana Turaga [mailto:[EMAIL PROTECTED] > Sent: Friday, January 27, 2006 03:04 PM > To: Jetspeed Users List > Subject: RE: How to clear RenderParameters set in action ? > > > Hello Frank, > I have a similar issue. Could you tell us where you applied the patch > and what the content of the patch is? Basically my question how did > you fix this issue? It would be really great help!! Hi Archana: The following is the code I modified in the org.apache.jetspeed.engine.servlet.ServletRequestImpl class. Notice that I check for a parameter named "pgreq". I add that parameter to every menu item in my Velocity templates in order to indicate that a direct PAGE request is occurring. At that point, with the following code, I effectively ignore ALL render parameters. public String getParameter( String name ) { if (this.portletParameters.containsKey("pgreq")) { return null; } Object value = this.getParameterMap().get(name); if (value == null) { return (null); } else if (value instanceof String[]) { return (((String[]) value)[0]); } else if (value instanceof String) { return ((String) value); } else { return (value.toString()); } } public Map getParameterMap() { if (currentRequest == null || currentRequest != getRequest() ) { // Cache the parameters for as long as the wrapped request stays the same. // According to Servlet 2.3 SRV.6.2.2 the passed on ServletRequest object // to an dispatched Servlet must remain the same (this one). // Tomcat solves this by injecting a new ServletRequest of its own above // this one (the getRequest() object). // So, when that one has changed since the last time the parameters have // been accessed, flush the cache and rebuild the map. currentRequest = getRequest(); portletParameters = new HashMap(); // get portlet params JetspeedRequestContext context = (JetspeedRequestContext) getAttribute("org.apache.jetspeed.request.RequestContext"); if (context != null) { PortalURL url = context.getPortalURL(); Iterator iter = url.getNavigationalState().getParameterNames(portletWindow); while (iter.hasNext()) { String name = (String) iter.next(); String[] values = url.getNavigationalState().getParameterValues(portletWindow, name); portletParameters.put(name, values); } } //get servlet params for (Enumeration parameters = getRequest().getParameterNames(); parameters.hasMoreElements();) { String paramName = (String) parameters.nextElement(); String[] paramValues = (String[]) getRequest().getParameterValues(paramName); String[] values = (String[]) portletParameters.get(paramName); if (getCharacterEncoding() != null) { for (int i = 0; i < paramValues.length; i++) { try { paramValues[i] = new String(paramValues[i].getBytes("ISO-8859-1"), getCharacterEncoding()); } catch (UnsupportedEncodingException e) { ; } } } if (values != null) { String[] temp = new String[paramValues.length + values.length]; System.arraycopy(paramValues, 0, temp, 0, paramValues.length); System.arraycopy(values, 0, temp, paramValues.length, values.length); paramValues = temp; } portletParameters.put(paramName, paramValues); } } if (this.portletParameters.containsKey("pgreq")) { return Collections.unmodifiableMap(new HashMap()); } return Collections.unmodifiableMap(portletParameters); } public Enumeration getParameterNames() { if (this.portletParameters.containsKey("pgreq")) { return Collections.enumeration(new HashMap().keySet()); } return Collections.enumeration(this.getParameterMap().keySet()); } public String[] getParameterValues( String name ) { if (this.portletParameters.containsKey("pgreq")) { return null; } return (String[]) this.getParameterMap().get(name); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message is a PRIVATE communication. If you are not the intended recipient, please do not read, copy, or use it, and do not disclose it to others. Please notify the sender of the delivery error by replying to this message, and then delete it from your system. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
