You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2012/01/19 17:10:39 UTC

svn commit: r1233446 [4/7] - in /jackrabbit/trunk: examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/ jackrabb...

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java?rev=1233446&r1=1233445&r2=1233446&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java Thu Jan 19 16:10:30 2012
@@ -1,49 +1,49 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.commons.repository;
-
-import javax.jcr.Repository;
-
-/**
- * Repository factory that always returns the same configured repository.
- */
-public class SingletonRepositoryFactory implements RepositoryFactory {
-
-    /**
-     * Singleton repository instance.
-     */
-    private final Repository repository;
-
-    /**
-     * Creates a repository factory that always returns the given repository.
-     *
-     * @param repository singleton repository instance.
-     */
-    public SingletonRepositoryFactory(Repository repository) {
-        this.repository = repository;
-    }
-
-    /**
-     * Returns the configured repository instance.
-     *
-     * @return singleton repository instance
-     */
-    public Repository getRepository() {
-        return repository;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.commons.repository;
+
+import javax.jcr.Repository;
+
+/**
+ * Repository factory that always returns the same configured repository.
+ */
+public class SingletonRepositoryFactory implements RepositoryFactory {
+
+    /**
+     * Singleton repository instance.
+     */
+    private final Repository repository;
+
+    /**
+     * Creates a repository factory that always returns the given repository.
+     *
+     * @param repository singleton repository instance.
+     */
+    public SingletonRepositoryFactory(Repository repository) {
+        this.repository = repository;
+    }
+
+    /**
+     * Returns the configured repository instance.
+     *
+     * @return singleton repository instance
+     */
+    public Repository getRepository() {
+        return repository;
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/SingletonRepositoryFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/visitor/FilteringItemVisitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/visitor/FilteringItemVisitor.java?rev=1233446&r1=1233445&r2=1233446&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/visitor/FilteringItemVisitor.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/visitor/FilteringItemVisitor.java Thu Jan 19 16:10:30 2012
@@ -1,237 +1,237 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.commons.visitor;
-
-import java.util.LinkedList;
-
-import javax.jcr.Item;
-import javax.jcr.ItemVisitor;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.RepositoryException;
-
-import org.apache.jackrabbit.commons.predicate.Predicate;
-
-public abstract class FilteringItemVisitor implements ItemVisitor {
-
-    /**
-     * Predicate that defines which items are included.
-     */
-    protected Predicate includePredicate = Predicate.TRUE;
-
-    /**
-     * Predicate that defines which items are traversed.
-     */
-    protected Predicate traversalPredicate = Predicate.TRUE;
-
-    /**
-     * Do we want to walk all properties of nodes?
-     * The default is false.
-     */
-    protected boolean walkProperties = false;
-
-    /**
-     * indicates if traversal should be done in a breadth-first
-     * manner rather than depth-first (which is the default)
-     */
-    protected boolean breadthFirst = false;
-
-    /**
-     * the 0-based level up to which the hierarchy should be traversed
-     * (if it's -1, the hierarchy will be traversed until there are no
-     * more children of the current item)
-     */
-    protected int maxLevel = -1;
-
-    /**
-     * queues used to implement breadth-first traversal
-     */
-    protected LinkedList currentQueue;
-    protected LinkedList nextQueue;
-
-    /**
-     * used to track hierarchy level of item currently being processed
-     */
-    protected int currentLevel;
-
-    public void setMaxLevel(final int ml) {
-        this.maxLevel = ml;
-    }
-
-    public void setBreadthFirst(final boolean flag) {
-        if ( this.breadthFirst != flag ) {
-            this.breadthFirst = flag;
-            if (breadthFirst) {
-                this.currentQueue = new LinkedList();
-                this.nextQueue = new LinkedList();
-            } else {
-                this.currentQueue = null;
-                this.nextQueue = null;
-            }
-
-        }
-    }
-    public void setWalkProperties(final boolean flag) {
-        this.walkProperties = flag;
-    }
-
-    public void setIncludePredicate(final Predicate ip) {
-        this.includePredicate = ip;
-    }
-
-    public void setTraversalPredicate(final Predicate tp) {
-        this.traversalPredicate = tp;
-    }
-
-    /**
-     * Implement this method to add behaviour performed before a
-     * <code>Property</code> is visited.
-     *
-     * @param property the <code>Property</code> that is accepting this visitor.
-     * @param level    hierarchy level of this property (the root node starts at level 0)
-     * @throws RepositoryException if an error occurrs
-     */
-    protected abstract void entering(Property property, int level)
-        throws RepositoryException;
-
-    /**
-     * Implement this method to add behaviour performed before a
-     * <code>Node</code> is visited.
-     *
-     * @param node  the <code>Node</code> that is accepting this visitor.
-     * @param level hierarchy level of this node (the root node starts at level 0)
-     * @throws RepositoryException if an error occurrs
-     */
-    protected abstract void entering(Node node, int level)
-        throws RepositoryException;
-
-    /**
-     * Implement this method to add behaviour performed after a
-     * <code>Property</code> is visited.
-     *
-     * @param property the <code>Property</code> that is accepting this visitor.
-     * @param level    hierarchy level of this property (the root node starts at level 0)
-     * @throws RepositoryException if an error occurrs
-     */
-    protected abstract void leaving(Property property, int level)
-        throws RepositoryException;
-
-    /**
-     * Implement this method to add behaviour performed after a
-     * <code>Node</code> is visited.
-     *
-     * @param node  the <code>Node</code> that is accepting this visitor.
-     * @param level hierarchy level of this node (the root node starts at level 0)
-     * @throws RepositoryException if an error occurrs
-     */
-    protected abstract void leaving(Node node, int level)
-        throws RepositoryException;
-
-    /**
-     * Called when the Visitor is passed to a <code>Property</code>.
-     * <p/>
-     * It calls <code>TraversingItemVisitor.entering(Property, int)</code> followed by
-     * <code>TraversingItemVisitor.leaving(Property, int)</code>. Implement these abstract methods to
-     * specify behaviour on 'arrival at' and 'after leaving' the <code>Property</code>.
-     * <p/>
-     * <p/>
-     * If this method throws, the visiting process is aborted.
-     *
-     * @param property the <code>Property</code> that is accepting this visitor.
-     * @throws RepositoryException if an error occurrs
-     */
-    public void visit(Property property) throws RepositoryException {
-        if ( this.walkProperties && this.includePredicate.evaluate(property) ) {
-            entering(property, currentLevel);
-            leaving(property, currentLevel);
-        }
-    }
-
-    /**
-     * Called when the Visitor is passed to a <code>Node</code>.
-     * <p/>
-     * It calls <code>TraversingItemVisitor.entering(Node, int)</code> followed by
-     * <code>TraversingItemVisitor.leaving(Node, int)</code>. Implement these abstract methods to
-     * specify behaviour on 'arrival at' and 'after leaving' the <code>Node</code>.
-     * <p/>
-     * If this method throws, the visiting process is aborted.
-     *
-     * @param node the <code>Node</code> that is accepting this visitor.
-     * @throws RepositoryException if an error occurrs
-     */
-    public void visit(Node node)
-    throws RepositoryException {
-        if ( this.traversalPredicate.evaluate(node) ) {
-            if ( this.includePredicate == this.traversalPredicate || this.includePredicate.evaluate(node) )  {
-                try {
-                    if (!breadthFirst) {
-                        // depth-first traversal
-                        entering(node, currentLevel);
-                        if (maxLevel == -1 || currentLevel < maxLevel) {
-                            currentLevel++;
-                            if ( this.walkProperties ) {
-                                PropertyIterator propIter = node.getProperties();
-                                while (propIter.hasNext()) {
-                                    propIter.nextProperty().accept(this);
-                                }
-                            }
-                            NodeIterator nodeIter = node.getNodes();
-                            while (nodeIter.hasNext()) {
-                                nodeIter.nextNode().accept(this);
-                            }
-                            currentLevel--;
-                        }
-                        leaving(node, currentLevel);
-                    } else {
-                        // breadth-first traversal
-                        entering(node, currentLevel);
-                        leaving(node, currentLevel);
-
-                        if (maxLevel == -1 || currentLevel < maxLevel) {
-                            if ( this.walkProperties ) {
-                                PropertyIterator propIter = node.getProperties();
-                                while (propIter.hasNext()) {
-                                    nextQueue.addLast(propIter.nextProperty());
-                                }
-                            }
-                            NodeIterator nodeIter = node.getNodes();
-                            while (nodeIter.hasNext()) {
-                                nextQueue.addLast(nodeIter.nextNode());
-                            }
-                        }
-
-                        while (!currentQueue.isEmpty() || !nextQueue.isEmpty()) {
-                            if (currentQueue.isEmpty()) {
-                                currentLevel++;
-                                currentQueue = nextQueue;
-                                nextQueue = new LinkedList();
-                            }
-                            Item e = (Item) currentQueue.removeFirst();
-                            e.accept(this);
-                        }
-                        currentLevel = 0;
-                    }
-                } catch (RepositoryException re) {
-                    currentLevel = 0;
-                    throw re;
-                }
-            }
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.commons.visitor;
+
+import java.util.LinkedList;
+
+import javax.jcr.Item;
+import javax.jcr.ItemVisitor;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.commons.predicate.Predicate;
+
+public abstract class FilteringItemVisitor implements ItemVisitor {
+
+    /**
+     * Predicate that defines which items are included.
+     */
+    protected Predicate includePredicate = Predicate.TRUE;
+
+    /**
+     * Predicate that defines which items are traversed.
+     */
+    protected Predicate traversalPredicate = Predicate.TRUE;
+
+    /**
+     * Do we want to walk all properties of nodes?
+     * The default is false.
+     */
+    protected boolean walkProperties = false;
+
+    /**
+     * indicates if traversal should be done in a breadth-first
+     * manner rather than depth-first (which is the default)
+     */
+    protected boolean breadthFirst = false;
+
+    /**
+     * the 0-based level up to which the hierarchy should be traversed
+     * (if it's -1, the hierarchy will be traversed until there are no
+     * more children of the current item)
+     */
+    protected int maxLevel = -1;
+
+    /**
+     * queues used to implement breadth-first traversal
+     */
+    protected LinkedList currentQueue;
+    protected LinkedList nextQueue;
+
+    /**
+     * used to track hierarchy level of item currently being processed
+     */
+    protected int currentLevel;
+
+    public void setMaxLevel(final int ml) {
+        this.maxLevel = ml;
+    }
+
+    public void setBreadthFirst(final boolean flag) {
+        if ( this.breadthFirst != flag ) {
+            this.breadthFirst = flag;
+            if (breadthFirst) {
+                this.currentQueue = new LinkedList();
+                this.nextQueue = new LinkedList();
+            } else {
+                this.currentQueue = null;
+                this.nextQueue = null;
+            }
+
+        }
+    }
+    public void setWalkProperties(final boolean flag) {
+        this.walkProperties = flag;
+    }
+
+    public void setIncludePredicate(final Predicate ip) {
+        this.includePredicate = ip;
+    }
+
+    public void setTraversalPredicate(final Predicate tp) {
+        this.traversalPredicate = tp;
+    }
+
+    /**
+     * Implement this method to add behaviour performed before a
+     * <code>Property</code> is visited.
+     *
+     * @param property the <code>Property</code> that is accepting this visitor.
+     * @param level    hierarchy level of this property (the root node starts at level 0)
+     * @throws RepositoryException if an error occurrs
+     */
+    protected abstract void entering(Property property, int level)
+        throws RepositoryException;
+
+    /**
+     * Implement this method to add behaviour performed before a
+     * <code>Node</code> is visited.
+     *
+     * @param node  the <code>Node</code> that is accepting this visitor.
+     * @param level hierarchy level of this node (the root node starts at level 0)
+     * @throws RepositoryException if an error occurrs
+     */
+    protected abstract void entering(Node node, int level)
+        throws RepositoryException;
+
+    /**
+     * Implement this method to add behaviour performed after a
+     * <code>Property</code> is visited.
+     *
+     * @param property the <code>Property</code> that is accepting this visitor.
+     * @param level    hierarchy level of this property (the root node starts at level 0)
+     * @throws RepositoryException if an error occurrs
+     */
+    protected abstract void leaving(Property property, int level)
+        throws RepositoryException;
+
+    /**
+     * Implement this method to add behaviour performed after a
+     * <code>Node</code> is visited.
+     *
+     * @param node  the <code>Node</code> that is accepting this visitor.
+     * @param level hierarchy level of this node (the root node starts at level 0)
+     * @throws RepositoryException if an error occurrs
+     */
+    protected abstract void leaving(Node node, int level)
+        throws RepositoryException;
+
+    /**
+     * Called when the Visitor is passed to a <code>Property</code>.
+     * <p/>
+     * It calls <code>TraversingItemVisitor.entering(Property, int)</code> followed by
+     * <code>TraversingItemVisitor.leaving(Property, int)</code>. Implement these abstract methods to
+     * specify behaviour on 'arrival at' and 'after leaving' the <code>Property</code>.
+     * <p/>
+     * <p/>
+     * If this method throws, the visiting process is aborted.
+     *
+     * @param property the <code>Property</code> that is accepting this visitor.
+     * @throws RepositoryException if an error occurrs
+     */
+    public void visit(Property property) throws RepositoryException {
+        if ( this.walkProperties && this.includePredicate.evaluate(property) ) {
+            entering(property, currentLevel);
+            leaving(property, currentLevel);
+        }
+    }
+
+    /**
+     * Called when the Visitor is passed to a <code>Node</code>.
+     * <p/>
+     * It calls <code>TraversingItemVisitor.entering(Node, int)</code> followed by
+     * <code>TraversingItemVisitor.leaving(Node, int)</code>. Implement these abstract methods to
+     * specify behaviour on 'arrival at' and 'after leaving' the <code>Node</code>.
+     * <p/>
+     * If this method throws, the visiting process is aborted.
+     *
+     * @param node the <code>Node</code> that is accepting this visitor.
+     * @throws RepositoryException if an error occurrs
+     */
+    public void visit(Node node)
+    throws RepositoryException {
+        if ( this.traversalPredicate.evaluate(node) ) {
+            if ( this.includePredicate == this.traversalPredicate || this.includePredicate.evaluate(node) )  {
+                try {
+                    if (!breadthFirst) {
+                        // depth-first traversal
+                        entering(node, currentLevel);
+                        if (maxLevel == -1 || currentLevel < maxLevel) {
+                            currentLevel++;
+                            if ( this.walkProperties ) {
+                                PropertyIterator propIter = node.getProperties();
+                                while (propIter.hasNext()) {
+                                    propIter.nextProperty().accept(this);
+                                }
+                            }
+                            NodeIterator nodeIter = node.getNodes();
+                            while (nodeIter.hasNext()) {
+                                nodeIter.nextNode().accept(this);
+                            }
+                            currentLevel--;
+                        }
+                        leaving(node, currentLevel);
+                    } else {
+                        // breadth-first traversal
+                        entering(node, currentLevel);
+                        leaving(node, currentLevel);
+
+                        if (maxLevel == -1 || currentLevel < maxLevel) {
+                            if ( this.walkProperties ) {
+                                PropertyIterator propIter = node.getProperties();
+                                while (propIter.hasNext()) {
+                                    nextQueue.addLast(propIter.nextProperty());
+                                }
+                            }
+                            NodeIterator nodeIter = node.getNodes();
+                            while (nodeIter.hasNext()) {
+                                nextQueue.addLast(nodeIter.nextNode());
+                            }
+                        }
+
+                        while (!currentQueue.isEmpty() || !nextQueue.isEmpty()) {
+                            if (currentQueue.isEmpty()) {
+                                currentLevel++;
+                                currentQueue = nextQueue;
+                                nextQueue = new LinkedList();
+                            }
+                            Item e = (Item) currentQueue.removeFirst();
+                            e.accept(this);
+                        }
+                        currentLevel = 0;
+                    }
+                } catch (RepositoryException re) {
+                    currentLevel = 0;
+                    throw re;
+                }
+            }
+        }
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/visitor/FilteringItemVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/visitor/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/webdav/AtomFeedConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/webdav/AtomFeedConstants.java?rev=1233446&r1=1233445&r2=1233446&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/webdav/AtomFeedConstants.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/webdav/AtomFeedConstants.java Thu Jan 19 16:10:30 2012
@@ -1,53 +1,53 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.commons.webdav;
-
-import javax.xml.namespace.QName;
-
-/**
- * <code>AtomFeedConstants</code> provides string constants for Atom feed 
- * (RFC 4287) resources.
- */
-public interface AtomFeedConstants {
-
-    /**
-     * Namespace URI for RFC 4287 elements.
-     */
-    public static final String NS_URI = "http://www.w3.org/2005/Atom";
-    
-    public static final String MEDIATYPE = "application/atom+xml";
-
-    public static final String XML_AUTHOR = "author";
-    public static final String XML_CONTENT = "content";
-    public static final String XML_ENTRY = "entry";
-    public static final String XML_FEED = "feed";
-    public static final String XML_ID = "id";
-    public static final String XML_LINK = "link";
-    public static final String XML_NAME = "name";
-    public static final String XML_TITLE = "title";
-    public static final String XML_UPDATED = "updated";
-
-    public static final QName N_AUTHOR = new QName(NS_URI, XML_AUTHOR);
-    public static final QName N_CONTENT = new QName(NS_URI, XML_CONTENT);
-    public static final QName N_ENTRY = new QName(NS_URI, XML_ENTRY);
-    public static final QName N_FEED = new QName(NS_URI, XML_FEED);
-    public static final QName N_ID = new QName(NS_URI, XML_ID);
-    public static final QName N_LINK = new QName(NS_URI, XML_LINK);
-    public static final QName N_NAME = new QName(NS_URI, XML_NAME);
-    public static final QName N_TITLE = new QName(NS_URI, XML_TITLE);
-    public static final QName N_UPDATED = new QName(NS_URI, XML_UPDATED);
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.commons.webdav;
+
+import javax.xml.namespace.QName;
+
+/**
+ * <code>AtomFeedConstants</code> provides string constants for Atom feed 
+ * (RFC 4287) resources.
+ */
+public interface AtomFeedConstants {
+
+    /**
+     * Namespace URI for RFC 4287 elements.
+     */
+    public static final String NS_URI = "http://www.w3.org/2005/Atom";
+    
+    public static final String MEDIATYPE = "application/atom+xml";
+
+    public static final String XML_AUTHOR = "author";
+    public static final String XML_CONTENT = "content";
+    public static final String XML_ENTRY = "entry";
+    public static final String XML_FEED = "feed";
+    public static final String XML_ID = "id";
+    public static final String XML_LINK = "link";
+    public static final String XML_NAME = "name";
+    public static final String XML_TITLE = "title";
+    public static final String XML_UPDATED = "updated";
+
+    public static final QName N_AUTHOR = new QName(NS_URI, XML_AUTHOR);
+    public static final QName N_CONTENT = new QName(NS_URI, XML_CONTENT);
+    public static final QName N_ENTRY = new QName(NS_URI, XML_ENTRY);
+    public static final QName N_FEED = new QName(NS_URI, XML_FEED);
+    public static final QName N_ID = new QName(NS_URI, XML_ID);
+    public static final QName N_LINK = new QName(NS_URI, XML_LINK);
+    public static final QName N_NAME = new QName(NS_URI, XML_NAME);
+    public static final QName N_TITLE = new QName(NS_URI, XML_TITLE);
+    public static final QName N_UPDATED = new QName(NS_URI, XML_UPDATED);
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/webdav/AtomFeedConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/webdav/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DocumentViewExporter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/Exporter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/ProxyContentHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/SystemViewExporter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/ToXmlContentHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/XmlnsContentHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/LockedWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/SimpleValueFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/flat/RankTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/xml/ToXmlContentHandlerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/xml/XmlnsContentHandlerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/Base64Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/JcrUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/SerializableXid.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/SerializableXid.java?rev=1233446&r1=1233445&r2=1233446&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/SerializableXid.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/SerializableXid.java Thu Jan 19 16:10:30 2012
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import javax.transaction.xa.Xid;
-
-/**
- * Serializable {@link Xid}.
- *
- * @since Jackrabbit JCR-RMI 1.5
- */
-public class SerializableXid implements Serializable, Xid {
-
-    private final int formatId;
-
-    private final byte[] globalTransactionId;
-
-    private final byte[] branchQualifier;
-
-    private final int hashCode;
-
-    public SerializableXid(Xid xid) {
-        formatId = xid.getFormatId();
-        globalTransactionId = xid.getGlobalTransactionId();
-        branchQualifier = xid.getBranchQualifier();
-        hashCode = xid.hashCode();
-    }
-
-    public int getFormatId() {
-        return formatId;
-    }
-
-    public byte[] getGlobalTransactionId() {
-        return globalTransactionId;
-    }
-
-    public byte[] getBranchQualifier() {
-        return branchQualifier;
-    }
-
-    public int hashCode() {
-        return hashCode;
-    }
-
-    public boolean equals(Object xid) {
-        return (xid instanceof Xid)
-            && formatId == ((Xid) xid).getFormatId()
-            && Arrays.equals(
-                    globalTransactionId, ((Xid) xid).getGlobalTransactionId())
-            && Arrays.equals(
-                    branchQualifier, ((Xid) xid).getBranchQualifier());
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+import javax.transaction.xa.Xid;
+
+/**
+ * Serializable {@link Xid}.
+ *
+ * @since Jackrabbit JCR-RMI 1.5
+ */
+public class SerializableXid implements Serializable, Xid {
+
+    private final int formatId;
+
+    private final byte[] globalTransactionId;
+
+    private final byte[] branchQualifier;
+
+    private final int hashCode;
+
+    public SerializableXid(Xid xid) {
+        formatId = xid.getFormatId();
+        globalTransactionId = xid.getGlobalTransactionId();
+        branchQualifier = xid.getBranchQualifier();
+        hashCode = xid.hashCode();
+    }
+
+    public int getFormatId() {
+        return formatId;
+    }
+
+    public byte[] getGlobalTransactionId() {
+        return globalTransactionId;
+    }
+
+    public byte[] getBranchQualifier() {
+        return branchQualifier;
+    }
+
+    public int hashCode() {
+        return hashCode;
+    }
+
+    public boolean equals(Object xid) {
+        return (xid instanceof Xid)
+            && formatId == ((Xid) xid).getFormatId()
+            && Arrays.equals(
+                    globalTransactionId, ((Xid) xid).getGlobalTransactionId())
+            && Arrays.equals(
+                    branchQualifier, ((Xid) xid).getBranchQualifier());
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/SerializableXid.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/remoting/davex/DavexServletService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/EventJournalResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/EventJournalResourceImpl.java?rev=1233446&r1=1233445&r2=1233446&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/EventJournalResourceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/EventJournalResourceImpl.java Thu Jan 19 16:10:30 2012
@@ -1,473 +1,473 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.webdav.jcr;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventJournal;
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.jackrabbit.commons.webdav.AtomFeedConstants;
-import org.apache.jackrabbit.commons.webdav.EventUtil;
-import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.commons.AdditionalEventInfo;
-import org.apache.jackrabbit.util.ISO8601;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.DavResourceFactory;
-import org.apache.jackrabbit.webdav.DavResourceIterator;
-import org.apache.jackrabbit.webdav.DavResourceIteratorImpl;
-import org.apache.jackrabbit.webdav.DavResourceLocator;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-import org.apache.jackrabbit.webdav.io.InputContext;
-import org.apache.jackrabbit.webdav.io.OutputContext;
-import org.apache.jackrabbit.webdav.observation.ObservationConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * Implements a JCR {@link EventJournal} in terms of an RFC 4287 Atom feed.
- * <p>
- * Each feed entry represents either a single event, or, if the repository
- * supports the {@link Event#PERSIST} event, an event bundle. The actual event
- * data is sent in the Atom &lt;content&gt; element and uses the same XML
- * serialization as the one used for subscriptions.
- * <p>
- * Skipping is implemented by specifying the desired time offset (represented
- * as hexadecimal long in ms since the epoch) disguised as ETag in the HTTP "If-None-Match" 
- * header field.
- * <p>
- * The generated feed may not be complete; the total number of events is limited in
- * order not to overload the client.
- * <p>
- * Furthermore, the number of events is limited by going up to 2000 ms into the future
- * (based on the request time). This is supposed to limit the wait time for the client).
- */
-public class EventJournalResourceImpl extends AbstractResource {
-
-    public static final String RELURIFROMWORKSPACE = "?type=journal";
-    
-    public static final String EVENTMEDIATYPE = "application/vnd.apache.jackrabbit.event+xml";
-
-    private static Logger log = LoggerFactory.getLogger(EventJournalResourceImpl.class);
-
-    private final HttpServletRequest request;
-    private final EventJournal journal;
-    private final DavResourceLocator locator;
-
-    EventJournalResourceImpl(EventJournal journal, DavResourceLocator locator, JcrDavSession session,
-            HttpServletRequest request, DavResourceFactory factory) {
-        super(locator, session, factory);
-        this.journal = journal;
-        this.locator = locator;
-        this.request = request;
-    }
-
-    public String getSupportedMethods() {
-        return "GET, HEAD";
-    }
-
-    public boolean exists() {
-        try {
-            List<String> available = Arrays.asList(getRepositorySession().getWorkspace().getAccessibleWorkspaceNames());
-            return available.contains(getLocator().getWorkspaceName());
-        } catch (RepositoryException e) {
-            log.warn(e.getMessage());
-            return false;
-        }
-    }
-
-    public boolean isCollection() {
-        return false;
-    }
-
-    public String getDisplayName() {
-        return "event journal for " + getLocator().getWorkspaceName();
-    }
-
-    public long getModificationTime() {
-        return System.currentTimeMillis();
-    }
-
-    private static final String ATOMNS = AtomFeedConstants.NS_URI;
-    private static final String EVNS = ObservationConstants.NAMESPACE.getURI();
-
-    private static final String AUTHOR = AtomFeedConstants.XML_AUTHOR;
-    private static final String CONTENT = AtomFeedConstants.XML_CONTENT;
-    private static final String ENTRY = AtomFeedConstants.XML_ENTRY;
-    private static final String FEED = AtomFeedConstants.XML_FEED;
-    private static final String ID = AtomFeedConstants.XML_ID;
-    private static final String LINK = AtomFeedConstants.XML_LINK;
-    private static final String NAME = AtomFeedConstants.XML_NAME;
-    private static final String TITLE = AtomFeedConstants.XML_TITLE;
-    private static final String UPDATED = AtomFeedConstants.XML_UPDATED;
-
-    private static final String E_EVENT = ObservationConstants.XML_EVENT;
-    private static final String E_EVENTDATE = ObservationConstants.XML_EVENTDATE;
-    private static final String E_EVENTIDENTIFIER = ObservationConstants.XML_EVENTIDENTIFIER;
-    private static final String E_EVENTINFO = ObservationConstants.XML_EVENTINFO;
-    private static final String E_EVENTTYPE = ObservationConstants.XML_EVENTTYPE;
-    private static final String E_EVENTMIXINNODETYPE = ObservationConstants.XML_EVENTMIXINNODETYPE;
-    private static final String E_EVENTPRIMARNODETYPE = ObservationConstants.XML_EVENTPRIMARNODETYPE;
-    private static final String E_EVENTUSERDATA = ObservationConstants.XML_EVENTUSERDATA;
-
-    private static final int MAXWAIT = 2000; // maximal wait time
-    private static final int MAXEV = 10000; // maximal event number
-
-    private static final Attributes NOATTRS = new AttributesImpl();
-
-    public void spool(OutputContext outputContext) throws IOException {
-
-        Calendar cal = Calendar.getInstance(Locale.ENGLISH);
-
-        try {
-            outputContext.setContentType("application/atom+xml; charset=UTF-8");
-            outputContext.setProperty("Vary", "If-None-Match");
-            // TODO: Content-Encoding: gzip
-
-            // find out where to start
-            long prevts = -1;
-            String inm = request.getHeader("If-None-Match");
-            if (inm != null) {
-                // TODO: proper parsing when comma-delimited
-                inm = inm.trim();
-                if (inm.startsWith("\"") && inm.endsWith("\"")) {
-                    String tmp = inm.substring(1, inm.length() - 1);
-                    try {
-                        prevts = Long.parseLong(tmp, 16);
-                        journal.skipTo(prevts);
-                    } catch (NumberFormatException ex) {
-                        // broken etag
-                    }
-                }
-            }
-
-            boolean hasPersistEvents = false;
-
-            if (outputContext.hasStream()) {
-
-                long lastts = -1;
-                long now = System.currentTimeMillis();
-                boolean done = false;
-
-                // collect events
-                List<Event> events = new ArrayList<Event>(MAXEV);
-
-                while (!done && journal.hasNext()) {
-                    Event e = journal.nextEvent();
-
-                    hasPersistEvents |= e.getType() == Event.PERSIST;
-
-                    if (e.getDate() != lastts) {
-                        // consider stopping
-                        if (events.size() > MAXEV) {
-                            done = true;
-                        }
-                        if (e.getDate() > now + MAXWAIT) {
-                            done = true;
-                        }
-                    }
-
-                    if (!done && (prevts == -1 || e.getDate() >= prevts)) {
-                        events.add(e);
-                    }
-
-                    lastts = e.getDate();
-                }
-
-                if (lastts >= 0) {
-                    // construct ETag from newest event
-                    outputContext.setETag("\"" + Long.toHexString(lastts) + "\"");
-                }
-
-                OutputStream os = outputContext.getOutputStream();
-                StreamResult streamResult = new StreamResult(os);
-                SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance();
-                TransformerHandler th = tf.newTransformerHandler();
-                Transformer s = th.getTransformer();
-                s.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
-                s.setOutputProperty(OutputKeys.INDENT, "yes");
-                s.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
-
-                th.setResult(streamResult);
-
-                th.startDocument();
-
-                th.startElement(ATOMNS, FEED, FEED, NOATTRS);
-
-                writeAtomElement(th, TITLE, "EventJournal for " + getLocator().getWorkspaceName());
-
-                th.startElement(ATOMNS, AUTHOR, AUTHOR, NOATTRS);
-                writeAtomElement(th, NAME, "Jackrabbit Event Journal Feed Generator");
-                th.endElement(ATOMNS, AUTHOR, AUTHOR);
-
-                String id = getFullUri(request);
-                writeAtomElement(th, ID, id);
-
-                AttributesImpl linkattrs = new AttributesImpl();
-                linkattrs.addAttribute(null, "self", "self", "CDATA", id);
-                writeAtomElement(th, LINK, linkattrs, null);
-
-                cal.setTimeInMillis(lastts >= 0 ? lastts : now);
-                String upd = ISO8601.format(cal);
-                writeAtomElement(th, UPDATED, upd);
-
-                String lastDateString = "";
-                long lastTimeStamp = 0;
-                long index = 0;
-
-                AttributesImpl contentatt = new AttributesImpl();
-                contentatt.addAttribute(null, "type", "type", "CDATA", EVENTMEDIATYPE);
-
-                while (!events.isEmpty()) {
-
-                    List<Event> bundle = null;
-                    String path = null;
-                    String op;
-
-                    if (hasPersistEvents) {
-                        bundle = new ArrayList<Event>();
-                        Event e = null;
-                        op = "operations";
-
-                        do {
-                            e = events.remove(0);
-                            bundle.add(e);
-
-                            // compute common path
-                            if (path == null) {
-                                path = e.getPath();
-                            } else {
-                                if (e.getPath() != null && e.getPath().length() < path.length()) {
-                                    path = e.getPath();
-                                }
-                            }
-                        } while (e.getType() != Event.PERSIST && !events.isEmpty());
-                    } else {
-                        // no persist events
-                        Event e = events.remove(0);
-                        bundle = Collections.singletonList(e);
-                        path = e.getPath();
-                        op = EventUtil.getEventName(e.getType());
-                    }
-
-                    Event firstEvent = bundle.get(0);
-
-                    String entryupd = lastDateString;
-                    if (lastTimeStamp != firstEvent.getDate()) {
-                        cal.setTimeInMillis(firstEvent.getDate());
-                        entryupd = ISO8601.format(cal);
-                        index = 0;
-                    } else {
-                        index += 1;
-                    }
-
-                    th.startElement(ATOMNS, ENTRY, ENTRY, NOATTRS);
-
-                    String entrytitle = op + (path != null ? (": " + path) : "");
-                    writeAtomElement(th, TITLE, entrytitle);
-
-                    String entryid = id + "?type=journal&ts=" + Long.toHexString(firstEvent.getDate()) + "-" + index;
-                    writeAtomElement(th, ID, entryid);
-
-                    String author = firstEvent.getUserID() == null || firstEvent.getUserID().length() == 0 ? null
-                            : firstEvent.getUserID();
-                    if (author != null) {
-                        th.startElement(ATOMNS, AUTHOR, AUTHOR, NOATTRS);
-                        writeAtomElement(th, NAME, author);
-                        th.endElement(ATOMNS, AUTHOR, AUTHOR);
-                    }
-
-                    writeAtomElement(th, UPDATED, entryupd);
-
-                    th.startElement(ATOMNS, CONTENT, CONTENT, contentatt);
-
-                    for (Event e : bundle) {
-
-                        // serialize the event
-                        th.startElement(EVNS, E_EVENT, E_EVENT, NOATTRS);
-
-                        // DAV:href
-                        if (e.getPath() != null) {
-                            boolean isCollection = (e.getType() == Event.NODE_ADDED || e.getType() == Event.NODE_REMOVED);
-                            String href = locator
-                                    .getFactory()
-                                    .createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(),
-                                            e.getPath(), false).getHref(isCollection);
-                            th.startElement(DavConstants.NAMESPACE.getURI(), DavConstants.XML_HREF,
-                                    DavConstants.XML_HREF, NOATTRS);
-                            th.characters(href.toCharArray(), 0, href.length());
-                            th.endElement(DavConstants.NAMESPACE.getURI(), DavConstants.XML_HREF, DavConstants.XML_HREF);
-                        }
-
-                        // event type
-                        String evname = EventUtil.getEventName(e.getType());
-                        th.startElement(EVNS, E_EVENTTYPE, E_EVENTTYPE, NOATTRS);
-                        th.startElement(EVNS, evname, evname, NOATTRS);
-                        th.endElement(EVNS, evname, evname);
-                        th.endElement(EVNS, E_EVENTTYPE, E_EVENTTYPE);
-
-                        // date
-                        writeObsElement(th, E_EVENTDATE, Long.toString(e.getDate()));
-
-                        // user data
-                        if (e.getUserData() != null && e.getUserData().length() > 0) {
-                            writeObsElement(th, E_EVENTUSERDATA, firstEvent.getUserData());
-                        }
-
-                        // user id: already sent as Atom author/name
-
-                        // try to compute nodetype information
-                        if (e instanceof AdditionalEventInfo) {
-                            try {
-                                Name pnt = ((AdditionalEventInfo) e).getPrimaryNodeTypeName();
-                                if (pnt != null) {
-                                    writeObsElement(th, E_EVENTPRIMARNODETYPE, pnt.toString());
-                                }
-
-                                Set<Name> mixins = ((AdditionalEventInfo) e).getMixinTypeNames();
-                                if (mixins != null) {
-                                    for (Name mixin : mixins) {
-                                        writeObsElement(th, E_EVENTMIXINNODETYPE, mixin.toString());
-                                    }
-                                }
-
-                            } catch (UnsupportedRepositoryOperationException ex) {
-                                // optional
-                            }
-                        }
-
-                        // identifier
-                        if (e.getIdentifier() != null) {
-                            writeObsElement(th, E_EVENTIDENTIFIER, e.getIdentifier());
-                        }
-
-                        // info
-                        if (!e.getInfo().isEmpty()) {
-                            th.startElement(EVNS, E_EVENTINFO, E_EVENTINFO, NOATTRS);
-                            Map<?, ?> m = e.getInfo();
-                            for (Map.Entry<?, ?> entry : m.entrySet()) {
-                                String key = entry.getKey().toString();
-                                Object value = entry.getValue();
-                                String t = value != null ? value.toString() : null;
-                                writeElement(th, null, key, NOATTRS, t);
-                            }
-                            th.endElement(EVNS, E_EVENTINFO, E_EVENTINFO);
-                        }
-
-                        th.endElement(EVNS, E_EVENT, E_EVENT);
-
-                        lastTimeStamp = e.getDate();
-                        lastDateString = entryupd;
-                    }
-
-                    th.endElement(ATOMNS, CONTENT, CONTENT);
-                    th.endElement(ATOMNS, ENTRY, ENTRY);
-                }
-
-                th.endElement(ATOMNS, FEED, FEED);
-
-                th.endDocument();
-
-                os.flush();
-            }
-        } catch (Exception ex) {
-            throw new IOException("error generating feed: " + ex.getMessage());
-        }
-    }
-
-    public DavResource getCollection() {
-        return null;
-    }
-
-    public void addMember(DavResource resource, InputContext inputContext) throws DavException {
-        throw new DavException(DavServletResponse.SC_FORBIDDEN);
-    }
-
-    public DavResourceIterator getMembers() {
-        return DavResourceIteratorImpl.EMPTY;
-    }
-
-    public void removeMember(DavResource member) throws DavException {
-        throw new DavException(DavServletResponse.SC_FORBIDDEN);
-    }
-
-    @Override
-    protected void initLockSupport() {
-        // lock not allowed
-    }
-
-    @Override
-    protected String getWorkspaceHref() {
-        return getHref();
-    }
-
-    private void writeElement(TransformerHandler th, String ns, String name, Attributes attrs, String textContent)
-            throws SAXException {
-        th.startElement(ns, name, name, attrs);
-        if (textContent != null) {
-            th.characters(textContent.toCharArray(), 0, textContent.length());
-        }
-        th.endElement(ns, name, name);
-    }
-
-    private void writeAtomElement(TransformerHandler th, String name, Attributes attrs, String textContent)
-            throws SAXException {
-        writeElement(th, ATOMNS, name, attrs, textContent);
-    }
-
-    private void writeAtomElement(TransformerHandler th, String name, String textContent) throws SAXException {
-        writeAtomElement(th, name, NOATTRS, textContent);
-    }
-
-    private void writeObsElement(TransformerHandler th, String name, String textContent) throws SAXException {
-        writeElement(th, EVNS, name, NOATTRS, textContent);
-    }
-
-    private String getFullUri(HttpServletRequest req) {
-
-        String scheme = req.getScheme();
-        int port = req.getServerPort();
-        boolean isDefaultPort = (scheme.equals("http") && port == 80) || (scheme.equals("http") && port == 443);
-        String query = request.getQueryString() != null ? "?" + request.getQueryString() : "";
-
-        return String.format("%s://%s%s%s%s%s", scheme, req.getServerName(), isDefaultPort ? ":" : "",
-                isDefaultPort ? Integer.toString(port) : "", req.getRequestURI(), query);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.webdav.jcr;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.observation.Event;
+import javax.jcr.observation.EventJournal;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.jackrabbit.commons.webdav.AtomFeedConstants;
+import org.apache.jackrabbit.commons.webdav.EventUtil;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.commons.AdditionalEventInfo;
+import org.apache.jackrabbit.util.ISO8601;
+import org.apache.jackrabbit.webdav.DavConstants;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.DavResource;
+import org.apache.jackrabbit.webdav.DavResourceFactory;
+import org.apache.jackrabbit.webdav.DavResourceIterator;
+import org.apache.jackrabbit.webdav.DavResourceIteratorImpl;
+import org.apache.jackrabbit.webdav.DavResourceLocator;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.io.InputContext;
+import org.apache.jackrabbit.webdav.io.OutputContext;
+import org.apache.jackrabbit.webdav.observation.ObservationConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * Implements a JCR {@link EventJournal} in terms of an RFC 4287 Atom feed.
+ * <p>
+ * Each feed entry represents either a single event, or, if the repository
+ * supports the {@link Event#PERSIST} event, an event bundle. The actual event
+ * data is sent in the Atom &lt;content&gt; element and uses the same XML
+ * serialization as the one used for subscriptions.
+ * <p>
+ * Skipping is implemented by specifying the desired time offset (represented
+ * as hexadecimal long in ms since the epoch) disguised as ETag in the HTTP "If-None-Match" 
+ * header field.
+ * <p>
+ * The generated feed may not be complete; the total number of events is limited in
+ * order not to overload the client.
+ * <p>
+ * Furthermore, the number of events is limited by going up to 2000 ms into the future
+ * (based on the request time). This is supposed to limit the wait time for the client).
+ */
+public class EventJournalResourceImpl extends AbstractResource {
+
+    public static final String RELURIFROMWORKSPACE = "?type=journal";
+    
+    public static final String EVENTMEDIATYPE = "application/vnd.apache.jackrabbit.event+xml";
+
+    private static Logger log = LoggerFactory.getLogger(EventJournalResourceImpl.class);
+
+    private final HttpServletRequest request;
+    private final EventJournal journal;
+    private final DavResourceLocator locator;
+
+    EventJournalResourceImpl(EventJournal journal, DavResourceLocator locator, JcrDavSession session,
+            HttpServletRequest request, DavResourceFactory factory) {
+        super(locator, session, factory);
+        this.journal = journal;
+        this.locator = locator;
+        this.request = request;
+    }
+
+    public String getSupportedMethods() {
+        return "GET, HEAD";
+    }
+
+    public boolean exists() {
+        try {
+            List<String> available = Arrays.asList(getRepositorySession().getWorkspace().getAccessibleWorkspaceNames());
+            return available.contains(getLocator().getWorkspaceName());
+        } catch (RepositoryException e) {
+            log.warn(e.getMessage());
+            return false;
+        }
+    }
+
+    public boolean isCollection() {
+        return false;
+    }
+
+    public String getDisplayName() {
+        return "event journal for " + getLocator().getWorkspaceName();
+    }
+
+    public long getModificationTime() {
+        return System.currentTimeMillis();
+    }
+
+    private static final String ATOMNS = AtomFeedConstants.NS_URI;
+    private static final String EVNS = ObservationConstants.NAMESPACE.getURI();
+
+    private static final String AUTHOR = AtomFeedConstants.XML_AUTHOR;
+    private static final String CONTENT = AtomFeedConstants.XML_CONTENT;
+    private static final String ENTRY = AtomFeedConstants.XML_ENTRY;
+    private static final String FEED = AtomFeedConstants.XML_FEED;
+    private static final String ID = AtomFeedConstants.XML_ID;
+    private static final String LINK = AtomFeedConstants.XML_LINK;
+    private static final String NAME = AtomFeedConstants.XML_NAME;
+    private static final String TITLE = AtomFeedConstants.XML_TITLE;
+    private static final String UPDATED = AtomFeedConstants.XML_UPDATED;
+
+    private static final String E_EVENT = ObservationConstants.XML_EVENT;
+    private static final String E_EVENTDATE = ObservationConstants.XML_EVENTDATE;
+    private static final String E_EVENTIDENTIFIER = ObservationConstants.XML_EVENTIDENTIFIER;
+    private static final String E_EVENTINFO = ObservationConstants.XML_EVENTINFO;
+    private static final String E_EVENTTYPE = ObservationConstants.XML_EVENTTYPE;
+    private static final String E_EVENTMIXINNODETYPE = ObservationConstants.XML_EVENTMIXINNODETYPE;
+    private static final String E_EVENTPRIMARNODETYPE = ObservationConstants.XML_EVENTPRIMARNODETYPE;
+    private static final String E_EVENTUSERDATA = ObservationConstants.XML_EVENTUSERDATA;
+
+    private static final int MAXWAIT = 2000; // maximal wait time
+    private static final int MAXEV = 10000; // maximal event number
+
+    private static final Attributes NOATTRS = new AttributesImpl();
+
+    public void spool(OutputContext outputContext) throws IOException {
+
+        Calendar cal = Calendar.getInstance(Locale.ENGLISH);
+
+        try {
+            outputContext.setContentType("application/atom+xml; charset=UTF-8");
+            outputContext.setProperty("Vary", "If-None-Match");
+            // TODO: Content-Encoding: gzip
+
+            // find out where to start
+            long prevts = -1;
+            String inm = request.getHeader("If-None-Match");
+            if (inm != null) {
+                // TODO: proper parsing when comma-delimited
+                inm = inm.trim();
+                if (inm.startsWith("\"") && inm.endsWith("\"")) {
+                    String tmp = inm.substring(1, inm.length() - 1);
+                    try {
+                        prevts = Long.parseLong(tmp, 16);
+                        journal.skipTo(prevts);
+                    } catch (NumberFormatException ex) {
+                        // broken etag
+                    }
+                }
+            }
+
+            boolean hasPersistEvents = false;
+
+            if (outputContext.hasStream()) {
+
+                long lastts = -1;
+                long now = System.currentTimeMillis();
+                boolean done = false;
+
+                // collect events
+                List<Event> events = new ArrayList<Event>(MAXEV);
+
+                while (!done && journal.hasNext()) {
+                    Event e = journal.nextEvent();
+
+                    hasPersistEvents |= e.getType() == Event.PERSIST;
+
+                    if (e.getDate() != lastts) {
+                        // consider stopping
+                        if (events.size() > MAXEV) {
+                            done = true;
+                        }
+                        if (e.getDate() > now + MAXWAIT) {
+                            done = true;
+                        }
+                    }
+
+                    if (!done && (prevts == -1 || e.getDate() >= prevts)) {
+                        events.add(e);
+                    }
+
+                    lastts = e.getDate();
+                }
+
+                if (lastts >= 0) {
+                    // construct ETag from newest event
+                    outputContext.setETag("\"" + Long.toHexString(lastts) + "\"");
+                }
+
+                OutputStream os = outputContext.getOutputStream();
+                StreamResult streamResult = new StreamResult(os);
+                SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance();
+                TransformerHandler th = tf.newTransformerHandler();
+                Transformer s = th.getTransformer();
+                s.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+                s.setOutputProperty(OutputKeys.INDENT, "yes");
+                s.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+
+                th.setResult(streamResult);
+
+                th.startDocument();
+
+                th.startElement(ATOMNS, FEED, FEED, NOATTRS);
+
+                writeAtomElement(th, TITLE, "EventJournal for " + getLocator().getWorkspaceName());
+
+                th.startElement(ATOMNS, AUTHOR, AUTHOR, NOATTRS);
+                writeAtomElement(th, NAME, "Jackrabbit Event Journal Feed Generator");
+                th.endElement(ATOMNS, AUTHOR, AUTHOR);
+
+                String id = getFullUri(request);
+                writeAtomElement(th, ID, id);
+
+                AttributesImpl linkattrs = new AttributesImpl();
+                linkattrs.addAttribute(null, "self", "self", "CDATA", id);
+                writeAtomElement(th, LINK, linkattrs, null);
+
+                cal.setTimeInMillis(lastts >= 0 ? lastts : now);
+                String upd = ISO8601.format(cal);
+                writeAtomElement(th, UPDATED, upd);
+
+                String lastDateString = "";
+                long lastTimeStamp = 0;
+                long index = 0;
+
+                AttributesImpl contentatt = new AttributesImpl();
+                contentatt.addAttribute(null, "type", "type", "CDATA", EVENTMEDIATYPE);
+
+                while (!events.isEmpty()) {
+
+                    List<Event> bundle = null;
+                    String path = null;
+                    String op;
+
+                    if (hasPersistEvents) {
+                        bundle = new ArrayList<Event>();
+                        Event e = null;
+                        op = "operations";
+
+                        do {
+                            e = events.remove(0);
+                            bundle.add(e);
+
+                            // compute common path
+                            if (path == null) {
+                                path = e.getPath();
+                            } else {
+                                if (e.getPath() != null && e.getPath().length() < path.length()) {
+                                    path = e.getPath();
+                                }
+                            }
+                        } while (e.getType() != Event.PERSIST && !events.isEmpty());
+                    } else {
+                        // no persist events
+                        Event e = events.remove(0);
+                        bundle = Collections.singletonList(e);
+                        path = e.getPath();
+                        op = EventUtil.getEventName(e.getType());
+                    }
+
+                    Event firstEvent = bundle.get(0);
+
+                    String entryupd = lastDateString;
+                    if (lastTimeStamp != firstEvent.getDate()) {
+                        cal.setTimeInMillis(firstEvent.getDate());
+                        entryupd = ISO8601.format(cal);
+                        index = 0;
+                    } else {
+                        index += 1;
+                    }
+
+                    th.startElement(ATOMNS, ENTRY, ENTRY, NOATTRS);
+
+                    String entrytitle = op + (path != null ? (": " + path) : "");
+                    writeAtomElement(th, TITLE, entrytitle);
+
+                    String entryid = id + "?type=journal&ts=" + Long.toHexString(firstEvent.getDate()) + "-" + index;
+                    writeAtomElement(th, ID, entryid);
+
+                    String author = firstEvent.getUserID() == null || firstEvent.getUserID().length() == 0 ? null
+                            : firstEvent.getUserID();
+                    if (author != null) {
+                        th.startElement(ATOMNS, AUTHOR, AUTHOR, NOATTRS);
+                        writeAtomElement(th, NAME, author);
+                        th.endElement(ATOMNS, AUTHOR, AUTHOR);
+                    }
+
+                    writeAtomElement(th, UPDATED, entryupd);
+
+                    th.startElement(ATOMNS, CONTENT, CONTENT, contentatt);
+
+                    for (Event e : bundle) {
+
+                        // serialize the event
+                        th.startElement(EVNS, E_EVENT, E_EVENT, NOATTRS);
+
+                        // DAV:href
+                        if (e.getPath() != null) {
+                            boolean isCollection = (e.getType() == Event.NODE_ADDED || e.getType() == Event.NODE_REMOVED);
+                            String href = locator
+                                    .getFactory()
+                                    .createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(),
+                                            e.getPath(), false).getHref(isCollection);
+                            th.startElement(DavConstants.NAMESPACE.getURI(), DavConstants.XML_HREF,
+                                    DavConstants.XML_HREF, NOATTRS);
+                            th.characters(href.toCharArray(), 0, href.length());
+                            th.endElement(DavConstants.NAMESPACE.getURI(), DavConstants.XML_HREF, DavConstants.XML_HREF);
+                        }
+
+                        // event type
+                        String evname = EventUtil.getEventName(e.getType());
+                        th.startElement(EVNS, E_EVENTTYPE, E_EVENTTYPE, NOATTRS);
+                        th.startElement(EVNS, evname, evname, NOATTRS);
+                        th.endElement(EVNS, evname, evname);
+                        th.endElement(EVNS, E_EVENTTYPE, E_EVENTTYPE);
+
+                        // date
+                        writeObsElement(th, E_EVENTDATE, Long.toString(e.getDate()));
+
+                        // user data
+                        if (e.getUserData() != null && e.getUserData().length() > 0) {
+                            writeObsElement(th, E_EVENTUSERDATA, firstEvent.getUserData());
+                        }
+
+                        // user id: already sent as Atom author/name
+
+                        // try to compute nodetype information
+                        if (e instanceof AdditionalEventInfo) {
+                            try {
+                                Name pnt = ((AdditionalEventInfo) e).getPrimaryNodeTypeName();
+                                if (pnt != null) {
+                                    writeObsElement(th, E_EVENTPRIMARNODETYPE, pnt.toString());
+                                }
+
+                                Set<Name> mixins = ((AdditionalEventInfo) e).getMixinTypeNames();
+                                if (mixins != null) {
+                                    for (Name mixin : mixins) {
+                                        writeObsElement(th, E_EVENTMIXINNODETYPE, mixin.toString());
+                                    }
+                                }
+
+                            } catch (UnsupportedRepositoryOperationException ex) {
+                                // optional
+                            }
+                        }
+
+                        // identifier
+                        if (e.getIdentifier() != null) {
+                            writeObsElement(th, E_EVENTIDENTIFIER, e.getIdentifier());
+                        }
+
+                        // info
+                        if (!e.getInfo().isEmpty()) {
+                            th.startElement(EVNS, E_EVENTINFO, E_EVENTINFO, NOATTRS);
+                            Map<?, ?> m = e.getInfo();
+                            for (Map.Entry<?, ?> entry : m.entrySet()) {
+                                String key = entry.getKey().toString();
+                                Object value = entry.getValue();
+                                String t = value != null ? value.toString() : null;
+                                writeElement(th, null, key, NOATTRS, t);
+                            }
+                            th.endElement(EVNS, E_EVENTINFO, E_EVENTINFO);
+                        }
+
+                        th.endElement(EVNS, E_EVENT, E_EVENT);
+
+                        lastTimeStamp = e.getDate();
+                        lastDateString = entryupd;
+                    }
+
+                    th.endElement(ATOMNS, CONTENT, CONTENT);
+                    th.endElement(ATOMNS, ENTRY, ENTRY);
+                }
+
+                th.endElement(ATOMNS, FEED, FEED);
+
+                th.endDocument();
+
+                os.flush();
+            }
+        } catch (Exception ex) {
+            throw new IOException("error generating feed: " + ex.getMessage());
+        }
+    }
+
+    public DavResource getCollection() {
+        return null;
+    }
+
+    public void addMember(DavResource resource, InputContext inputContext) throws DavException {
+        throw new DavException(DavServletResponse.SC_FORBIDDEN);
+    }
+
+    public DavResourceIterator getMembers() {
+        return DavResourceIteratorImpl.EMPTY;
+    }
+
+    public void removeMember(DavResource member) throws DavException {
+        throw new DavException(DavServletResponse.SC_FORBIDDEN);
+    }
+
+    @Override
+    protected void initLockSupport() {
+        // lock not allowed
+    }
+
+    @Override
+    protected String getWorkspaceHref() {
+        return getHref();
+    }
+
+    private void writeElement(TransformerHandler th, String ns, String name, Attributes attrs, String textContent)
+            throws SAXException {
+        th.startElement(ns, name, name, attrs);
+        if (textContent != null) {
+            th.characters(textContent.toCharArray(), 0, textContent.length());
+        }
+        th.endElement(ns, name, name);
+    }
+
+    private void writeAtomElement(TransformerHandler th, String name, Attributes attrs, String textContent)
+            throws SAXException {
+        writeElement(th, ATOMNS, name, attrs, textContent);
+    }
+
+    private void writeAtomElement(TransformerHandler th, String name, String textContent) throws SAXException {
+        writeAtomElement(th, name, NOATTRS, textContent);
+    }
+
+    private void writeObsElement(TransformerHandler th, String name, String textContent) throws SAXException {
+        writeElement(th, EVNS, name, NOATTRS, textContent);
+    }
+
+    private String getFullUri(HttpServletRequest req) {
+
+        String scheme = req.getScheme();
+        int port = req.getServerPort();
+        boolean isDefaultPort = (scheme.equals("http") && port == 80) || (scheme.equals("http") && port == 443);
+        String query = request.getQueryString() != null ? "?" + request.getQueryString() : "";
+
+        return String.format("%s://%s%s%s%s%s", scheme, req.getServerName(), isDefaultPort ? ":" : "",
+                isDefaultPort ? Integer.toString(port) : "", req.getRequestURI(), query);
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/EventJournalResourceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native