You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "James Liao (JIRA)" <je...@portals.apache.org> on 2005/06/20 11:10:19 UTC
[jira] Updated: (JS2-266) The content search pathes of page omit portlet-decorator
[ http://issues.apache.org/jira/browse/JS2-266?page=all ]
James Liao updated JS2-266:
---------------------------
Attachment: patch3.txt
A patch.
> The content search pathes of page omit portlet-decorator
> --------------------------------------------------------
>
> Key: JS2-266
> URL: http://issues.apache.org/jira/browse/JS2-266
> Project: Jetspeed 2
> Type: Bug
> Components: Aggregation
> Versions: 2.0-M3
> Environment: WinXP SP2, JDK1.4.2_07
> Reporter: James Liao
> Assignee: David Sean Taylor
> Attachments: patch3.txt
>
> The following code is from class org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.build()
> List contentPathes = (List) context.getSessionAttribute(ContentFilter.SESSION_CONTENT_PATH_ATTR);
> if (contentPathes == null)
> {
> contentPathes = new ArrayList(2);
> context.setSessionAttribute(ContentFilter.SESSION_CONTENT_PATH_ATTR, contentPathes);
> }
> String mediaType = context.getCapabilityMap().getPreferredMediaType().getName();
> if (contentPathes.size() < 1)
> {
> // define the lookup order
> contentPathes.add(root.getType() + "/" + mediaType + "/" + layoutDecorator);
> contentPathes.add(ContentFragment.PORTLET + "/" + mediaType + "/" + defaultPortletDecorator);
> Iterator defaults = fallBackContentPathes.iterator();
> while (defaults.hasNext())
> {
> String path = (String) defaults.next();
> contentPathes.add(path.replaceAll("\\{mediaType\\}", mediaType));
> }
> }
> else
> {
> contentPathes.set(0, root.getType() + "/" + mediaType + "/" + layoutDecorator);
> }
> According to the above code, the contentPathes which is stored in session, contains the current layout decorator path, fallBack ContentPathes which are specified in the jetspeed-spring.xml.
> But content pathes does not include current page's portlet-decorator. All the portlet level entities are from the path "portlet/{mediaType}/jetspeed" which is specified in jetspeed-spring.xml(the default portlet-decorator?). That will cause some mistakes if I don't want to include jetspeed portlet-decorator style.
> So I suggest:
> 1. Remove the default portlet-decorator definition in jetspeed-spring.xml like the following:
> <!-- Aggregation: Page -->
> <bean id="org.apache.jetspeed.aggregator.PageAggregator"
> class="org.apache.jetspeed.aggregator.impl.PageAggregatorImpl" >
> <constructor-arg index="0" ><ref bean="org.apache.jetspeed.aggregator.PortletRenderer" /></constructor-arg>
> <!-- Aggregation Strategies:
> 0 = PageAggregatorImpl.STRATEGY_SEQUENTIAL
> 1 = PageAggregatorImpl.STRATEGY_PARALLEL
> -->
> <constructor-arg index="1"><value>0</value></constructor-arg>
> <constructor-arg index="2">
> <list>
> <!--<value>portlet/{mediaType}/jetspeed</value>-->
> <value>portlet/{mediaType}</value>
> <value>layout/{mediaType}</value>
> <value>generic/{mediaType}</value>
> <value>{mediaType}</value>
> </list>
> </constructor-arg>
> </bean>
> 2. Change the following code org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.build()
> public void build( RequestContext context ) throws JetspeedException, IOException
> {
> ContentPage page = context.getPage();
> if (null == page)
> {
> throw new JetspeedException("Failed to find PSML Pin ContentPageAggregator.build");
> }
> ContentFragment root = page.getRootContentFragment();
> if (root == null)
> {
> throw new JetspeedException("No root ContentFragment found in ContentPage");
> }
> String layoutDecorator = root.getDecorator();
> if (layoutDecorator == null)
> {
> layoutDecorator = page.getDefaultDecorator(root.getType());
> }
> String defaultPortletDecorator = page.getDefaultDecorator(ContentFragment.PORTLET);
> ///////////////////////////////////////////////////////////////////////////////////////////////
> //TODO: Remove hard coding of locations and use CM + TL
> // DST: Im going to encapsulate this into a class, which can be accessed
> // by
> // the PowerTool when aggregating content, and make sure to modify the
> // search path
> // according to the current decorator. Assigned issue to JiRa JS2-24
> List contentPathes = (List) context.getSessionAttribute(ContentFilter.SESSION_CONTENT_PATH_ATTR);
> if (contentPathes == null)
> {
> contentPathes = new ArrayList(2);
> context.setSessionAttribute(ContentFilter.SESSION_CONTENT_PATH_ATTR, contentPathes);
> }
> String mediaType = context.getCapabilityMap().getPreferredMediaType().getName();
> if (contentPathes.size() < 1)
> {
> // define the lookup order
> contentPathes.add(root.getType() + "/" + mediaType + "/" + layoutDecorator);
> // Start added by jamesliao, 27-05-2005
> contentPathes.add(ContentFragment.PORTLET + "/" + mediaType + "/" + defaultPortletDecorator);
> // End
>
> Iterator defaults = fallBackContentPathes.iterator();
> while (defaults.hasNext())
> {
> String path = (String) defaults.next();
> contentPathes.add(path.replaceAll("\\{mediaType\\}", mediaType));
> }
> }
> else
> {
> contentPathes.set(0, root.getType() + "/" + mediaType + "/" + layoutDecorator);
> // Start added by jamesliao, 27-05-2005, override the previous portlet-decorator
> contentPathes.set(1, ContentFragment.PORTLET + "/" + mediaType + "/" + defaultPortletDecorator);
> // End
> }
> if (layoutDecorator != null)
> {
> addStyle(context, layoutDecorator, ContentFragment.LAYOUT);
> }
> ///////////////////////////////////////////////////////////////////////////////////////////////
> ContentDispatcher dispatcher = renderer.getDispatcher(context, (strategy == STRATEGY_PARALLEL));
> // handle maximized state
> NavigationalState nav = context.getPortalURL().getNavigationalState();
> PortletWindow window = nav.getMaximizedWindow();
> if (null != window)
> {
> renderMaximizedWindow(context, page, root, window);
> }
> else
> {
> aggregateAndRender(root, context, page);
> }
>
> //dispatcher.include(root);
> context.getResponse().getWriter().write(root.getRenderedContent());
> if (null != window)
> {
> context.getRequest().removeAttribute(PortalReservedParameters.MAXIMIZED_FRAGMENT_ATTRIBUTE);
> context.getRequest().removeAttribute(PortalReservedParameters.MAXIMIZED_LAYOUT_ATTRIBUTE);
> }
> }
--
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: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org