You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2004/06/07 11:53:34 UTC
cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl PortalServiceImpl.java DefaultLinkService.java
cziegeler 2004/06/07 02:53:34
Modified: . status.xml
src/blocks/portal/java/org/apache/cocoon/portal
LinkService.java
src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl
ActionCounterEventAspect.java
src/blocks/portal/java/org/apache/cocoon/portal/impl
PortalServiceImpl.java DefaultLinkService.java
Log:
Fix problem with bookmarks and CachingURICoplet
Revision Changes Path
1.355 +7 -1 cocoon-2.1/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/status.xml,v
retrieving revision 1.354
retrieving revision 1.355
diff -u -r1.354 -r1.355
--- status.xml 7 Jun 2004 08:55:25 -0000 1.354
+++ status.xml 7 Jun 2004 09:53:33 -0000 1.355
@@ -205,6 +205,12 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="CZ" type="fix">
+ Portal: Fix transformation of non-external html links (HTMLEventLinkTransformer)
+ </action>
+ <action dev="CZ" type="fix" fixes-bug="28687">
+ Portal: Fix problem with bookmarks and CachingURICoplet
+ </action>
<action dev="SW" type="update">
A new build property, "build.archive-sources", allows to include java source files
in jar archives. Useful when using a non-released version to know what sources
1.6 +17 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/LinkService.java
Index: LinkService.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/LinkService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LinkService.java 5 Mar 2004 13:02:08 -0000 1.5
+++ LinkService.java 7 Jun 2004 09:53:34 -0000 1.6
@@ -54,12 +54,27 @@
void addEventToLink(Event event);
/**
- * Add this parameter to every link
+ * Add this parameter to every link.
+ * If the link already contains a parameter with this name,
+ * then the link will have both parameters with the same
+ * name, but different values.
* @param name The request parameter name
* @param value The value for the parameter
+ * @see #addUniqueParameterToLink(String, String)
*/
void addParameterToLink(String name, String value);
+ /**
+ * Add this parameter to every link.
+ * If the link already contains a parameter with this name,
+ * then this old parameter will be removed and replaced by
+ * the new one.
+ * @param name The request parameter name
+ * @param value The value for the parameter
+ * @see #addUniqueParameterToLink(String, String)
+ */
+ void addUniqueParameterToLink(String name, String value);
+
/**
* Get a link that simply refreshs the portal
* @return A URI
1.6 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java
Index: ActionCounterEventAspect.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ActionCounterEventAspect.java 7 Apr 2004 12:03:46 -0000 1.5
+++ ActionCounterEventAspect.java 7 Jun 2004 09:53:34 -0000 1.6
@@ -79,7 +79,7 @@
context.invokeNext( service );
}
}
- service.getComponentManager().getLinkService().addParameterToLink( requestParameterName, String.valueOf(actionCount));
+ service.getComponentManager().getLinkService().addUniqueParameterToLink( requestParameterName, String.valueOf(actionCount));
final Response response = ObjectModelHelper.getResponse( context.getObjectModel() );
response.setHeader("Cache-Control", "no-cache");
1.11 +3 -3 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
Index: PortalServiceImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PortalServiceImpl.java 5 Mar 2004 13:02:13 -0000 1.10
+++ PortalServiceImpl.java 7 Jun 2004 09:53:34 -0000 1.11
@@ -74,11 +74,11 @@
}
protected PortalServiceInfo getInfo() {
- PortalServiceInfo info = (PortalServiceInfo) this.dataStore.getRequestData(this.key);
+ PortalServiceInfo info = (PortalServiceInfo) this.dataStore.getGlobalRequestData(this.key);
if ( info == null ) {
info = new PortalServiceInfo();
info.setup(ContextHelper.getObjectModel(this.context), this.portalComponentManagers);
- this.dataStore.setRequestData(this.key, info);
+ this.dataStore.setGlobalRequestData(this.key, info);
}
return info;
}
1.14 +33 -1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java
Index: DefaultLinkService.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DefaultLinkService.java 28 Apr 2004 13:58:16 -0000 1.13
+++ DefaultLinkService.java 7 Jun 2004 09:53:34 -0000 1.14
@@ -16,6 +16,7 @@
package org.apache.cocoon.portal.impl;
import java.util.ArrayList;
+import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
@@ -30,6 +31,7 @@
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.components.ContextHelper;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.wrapper.RequestParameters;
import org.apache.cocoon.portal.LinkService;
import org.apache.cocoon.portal.event.ComparableEvent;
import org.apache.cocoon.portal.event.Event;
@@ -247,6 +249,36 @@
info.hasParameters = true;
}
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.portal.LinkService#addUniqueParameterToLink(java.lang.String, java.lang.String)
+ */
+ public void addUniqueParameterToLink(String name, String value) {
+ final Info info = this.getInfo();
+ if ( info.hasParameters ) {
+ final int pos = info.linkBase.indexOf("?");
+ final String queryString = info.linkBase.substring(pos + 1);
+ final RequestParameters params = new RequestParameters(queryString);
+ if ( params.getParameter(name) != null ) {
+ // the parameter is available, so remove it
+ info.linkBase.delete(pos, info.linkBase.length() + 1);
+ info.hasParameters = false;
+
+ Enumeration enum = params.getParameterNames();
+ while ( enum.hasMoreElements() ) {
+ final String paramName = (String)enum.nextElement();
+ if ( !paramName.equals(name) ) {
+ String[] values = params.getParameterValues(paramName);
+ for( int i = 0; i < values.length; i++ ) {
+ this.addParameterToLink(paramName, values[i]);
+ }
+ }
+ }
+ }
+ }
+ // the parameter is not available, so just add it
+ this.addParameterToLink(name, value);
+ }
+
/* (non-Javadoc)
* @see org.apache.cocoon.portal.LinkService#getRefreshLinkURI()
*/