chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r896128 - /incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
Date Tue, 05 Jan 2010 17:05:04 GMT
Author: fguillaume
Date: Tue Jan  5 17:05:03 2010
New Revision: 896128

URL: http://svn.apache.org/viewvc?rev=896128&view=rev
Log:
Fix children paging next link

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java?rev=896128&r1=896127&r2=896128&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
Tue Jan  5 17:05:03 2010
@@ -59,6 +59,9 @@
  */
 public class CMISChildrenCollection extends CMISObjectsCollection {
 
+    protected static Pattern PAT_PARAM_SKIP_COUNT = Pattern.compile("(.*[?&]"
+            + AtomPubCMIS.PARAM_SKIP_COUNT + "=)(-?[0-9]+)(.*)");
+
     public CMISChildrenCollection(String type, String id, Repository repository) {
         super(type, "children", id, repository);
     }
@@ -116,13 +119,13 @@
             skipCount += entries.size();
             // compute new URI
             String uri = request.getResolvedUri().toString();
-            Pattern pat = Pattern.compile("(.*[?&]"
-                    + AtomPubCMIS.PARAM_SKIP_COUNT + "=)(-?[0-9]+)(.*)");
-            Matcher m = pat.matcher(uri);
+            Matcher m = PAT_PARAM_SKIP_COUNT.matcher(uri);
             if (m.matches()) {
                 uri = m.group(1) + skipCount + m.group(3);
             } else {
-                // unexpected URI...
+                char sep = uri.contains("?") ? '&' : '?';
+                uri = uri + sep + AtomPubCMIS.PARAM_SKIP_COUNT + '='
+                        + skipCount;
             }
             feed.addLink(uri, AtomPub.LINK_NEXT, AtomPub.MEDIA_TYPE_ATOM_FEED,
                     null, null, -1);



Mime
View raw message