You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by pn...@apache.org on 2004/05/12 14:38:03 UTC

cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/util PropertyRetrieverImpl.java PropertyHelper.java

pnever      2004/05/12 05:38:03

  Modified:    src/webdav/server/org/apache/slide/webdav/util Tag:
                        SLIDE_2_0_RELEASE_BRANCH PropertyRetrieverImpl.java
                        PropertyHelper.java
  Log:
  Partly reverted changes made in revisions 1.31.2.2 and 1.31.2.3 of
  PropertyRetrieverImpl and made a fix in both PropertyRetrieverImpl and
  PropertyHelper. *** All is about context and servlet paths ***
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.31.2.4  +31 -34    jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyRetrieverImpl.java
  
  Index: PropertyRetrieverImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyRetrieverImpl.java,v
  retrieving revision 1.31.2.3
  retrieving revision 1.31.2.4
  diff -u -r1.31.2.3 -r1.31.2.4
  --- PropertyRetrieverImpl.java	1 Apr 2004 13:46:39 -0000	1.31.2.3
  +++ PropertyRetrieverImpl.java	12 May 2004 12:38:02 -0000	1.31.2.4
  @@ -5,7 +5,7 @@
    *
    * ====================================================================
    *
  - * Copyright 1999-2002 The Apache Software Foundation 
  + * Copyright 1999-2002 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -125,15 +125,15 @@
       }
       
       /** deprecated */
  -//    public PropertyRetrieverImpl(NamespaceAccessToken token, SlideToken slideToken) {
  -//        super(slideToken, token);
  -//        this.structure = token.getStructureHelper();
  -//        this.content = token.getContentHelper();
  -//        this.security = token.getSecurityHelper();
  -//        this.lock = token.getLockHelper();
  +    //    public PropertyRetrieverImpl(NamespaceAccessToken token, SlideToken slideToken) {
  +    //        super(slideToken, token);
  +    //        this.structure = token.getStructureHelper();
  +    //        this.content = token.getContentHelper();
  +    //        this.security = token.getSecurityHelper();
  +    //        this.lock = token.getLockHelper();
   //
  -//        propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token, null);
  -//    }
  +    //        propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token, null);
  +    //    }
       
       /**
        * Returns the PropertyHelper used to access the (computed) properties.
  @@ -153,7 +153,7 @@
        * @param      requestedProperties  the requested properties.
        * @param      uri                  the URI of the resource.
        * @param      contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath          a String, the result of HttpRequest.getServletPath()        
  +     * @param      servletPath          a String, the result of HttpRequest.getServletPath()
        * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
  @@ -216,7 +216,7 @@
        * @param      uri                  the URI of the resource.
        * @param      revisionNumber       the revision number of the requested resource.
        * @param      contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath          a String, the result of HttpRequest.getServletPath()            
  +     * @param      servletPath          a String, the result of HttpRequest.getServletPath()
        * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
  @@ -245,7 +245,7 @@
        * @param      revisionDescriptors    the NodeRevisionDescriptors of the resource.
        * @param      revisionDescriptor     the NodeRevisionDescriptor of the resource.
        * @param      contextPath           a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath           a String, the result of HttpRequest.getServletPath()     
  +     * @param      servletPath           a String, the result of HttpRequest.getServletPath()
        * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
  @@ -280,7 +280,7 @@
        * @param      requestedProperties  the requested properties.
        * @param      requestedResource    the resource for which to return the properties.
        * @param      contextPath           a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath           a String, the result of HttpRequest.getServletPath()    
  +     * @param      servletPath           a String, the result of HttpRequest.getServletPath()
        * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
  @@ -315,7 +315,7 @@
        * @param      requestedProperties  the requested properties.
        * @param      requestedResource    the resource for which to return the properties.
        * @param      contextPath           a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath           a String, the result of HttpRequest.getServletPath()    
  +     * @param      servletPath           a String, the result of HttpRequest.getServletPath()
        *
        * @return     the requested properties as list of <code>&lt;propstat&gt;</code>
        *             JDOM Element.
  @@ -393,7 +393,7 @@
        *
        * @param      requestedResource    the resource for which to return the properties.
        * @param      contextPath           a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath           a String, the result of HttpRequest.getServletPath()       
  +     * @param      servletPath           a String, the result of HttpRequest.getServletPath()
        * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
  @@ -482,7 +482,7 @@
        *                                     when retrieving the property) to the List of
        *                                     PropertyName that caused that error.
        * @param      contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath          a String, the result of HttpRequest.getServletPath()    
  +     * @param      servletPath          a String, the result of HttpRequest.getServletPath()
        *
        * @return     A List of <code>&lt;propstat&gt;</code> JDOM Elements for the erroneous properties.
        */
  @@ -530,7 +530,7 @@
        *
        * @param      property             the property for which to return the Element.
        * @param      contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath          a String, the result of HttpRequest.getServletPath()    
  +     * @param      servletPath          a String, the result of HttpRequest.getServletPath()
        *
        * @return     the JDOM Element for the given <code>property</code>.
        */
  @@ -552,7 +552,7 @@
        * @param      propertyName         the property Name.
        * @param      propertyValue        the property Value.
        * @param      contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath          a String, the result of HttpRequest.getServletPath()    
  +     * @param      servletPath          a String, the result of HttpRequest.getServletPath()
        *
        * @return     the JDOM Element for the given <code>property</code>.
        */
  @@ -578,9 +578,9 @@
               if( propertyValue.toString().indexOf('<') >= 0 ) {
                   try {
                       XMLValue xmlValue = new XMLValue(propertyValue.toString(), valueDefaultNamespace);
  -//                    if (AbstractResourceKind.isLiveProperty(propertyName)) {
  -//                        convertHrefValueToAbsoluteURL (xmlValue, contextPath, servletPath, config);
  -//                    }
  +                    if (AbstractResourceKind.isLiveProperty(propertyName)) {
  +                        convertHrefValueToAbsoluteURL (xmlValue, contextPath, servletPath, config);
  +                    }
                       Iterator iterator = xmlValue.iterator();
                       while (iterator.hasNext()) {
                           Object o = iterator.next();
  @@ -619,13 +619,12 @@
        * @param      xmlValue             the XMLValue that might contain <code>&lt;href&gt;</code>
        *                                  values to convert.
        * @param      contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param      servletPath          a String, the result of HttpRequest.getServletPath()    
  +     * @param      servletPath          a String, the result of HttpRequest.getServletPath()
        */
       protected static void convertHrefValueToAbsoluteURL (XMLValue xmlValue,
                                                            String contextPath,
                                                            String servletPath,
  -                                                         WebdavServletConfig config)
  -    {
  +                                                         WebdavServletConfig config) {
           if (xmlValue != null) {
               Iterator iterator = xmlValue.iterator();
               Element element = null;
  @@ -642,8 +641,7 @@
       private static void convertHrefValueToAbsoluteURL (Element element,
                                                          String servletPath,
                                                          String contextPath,
  -                                                       WebdavServletConfig config)
  -    {
  +                                                       WebdavServletConfig config) {
           if (element.getChildren().size() > 0) {
               Iterator i = element.getChildren().iterator();
               while (i.hasNext()) {
  @@ -652,13 +650,12 @@
               }
           }
           if ( E_HREF.equals(element.getName()) && (element.getText() != null) ) {
  -           // FIXME Is a check for absolute URL necessary??? How is it doable?
  -           // if ( !PropertyHelper.isAbsoluteURL(serverURL, contextPath, element.getText()) ) {
  -            //    
  +            if ( !PropertyHelper.isAbsoluteURL(contextPath, element.getText()) ) {
  +                
                   element.setText(WebdavUtils.getAbsolutePath (element.getText(),
                                                                contextPath,
                                                                servletPath, config));
  -           // }
  +            }
           }
       }
       
  
  
  
  1.63.2.5  +19 -20    jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyHelper.java
  
  Index: PropertyHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyHelper.java,v
  retrieving revision 1.63.2.4
  retrieving revision 1.63.2.5
  diff -u -r1.63.2.4 -r1.63.2.5
  --- PropertyHelper.java	15 Mar 2004 07:58:55 -0000	1.63.2.4
  +++ PropertyHelper.java	12 May 2004 12:38:03 -0000	1.63.2.5
  @@ -5,7 +5,7 @@
    *
    * ====================================================================
    *
  - * Copyright 1999-2002 The Apache Software Foundation 
  + * Copyright 1999-2002 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -643,7 +643,7 @@
        * describing the successors of the resource.
        *
        * The concatenation of <code>contextPath</code>,<code>servletPath</code> and
  -     * <code>revisionDescriptor.getUri()</code> gives the absolute URL of the resource 
  +     * <code>revisionDescriptor.getUri()</code> gives the absolute URL of the resource
        * on this server.
        *
        * @param    revisionDescriptors  the NodeRevisionDescriptors of the resource.
  @@ -991,7 +991,7 @@
               
               String grammarNamespace = basicSearch.getNamespaceURI();
               Search searchHelper = nsaToken.getSearchHelper();
  -	    // @FIXME Why is servletPath not required? 
  +        // @FIXME Why is servletPath not required?
               SearchQuery searchQuery = searchHelper.createSearchQuery(grammarNamespace,
                                                                        basicSearch,
                                                                        sTokenNoEnlist,
  @@ -1142,7 +1142,7 @@
        * @param    revisionDescriptors  the NodeRevisionDescriptors of the Workspace.
        * @param    revisionDescriptor   the NodeRevisionDescriptor of the Workspace.
        * @param    contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param    servletPath          a String, the result of HttpRequest.getServletPath()    
  +     * @param    servletPath          a String, the result of HttpRequest.getServletPath()
        *
        * @return   the value of the <code>&lt;workspace-checkout-set&gt;</code> property.
        *
  @@ -1342,7 +1342,7 @@
        *
        * @param    objectLockToken     the NodeLock for which to compute the value
        * @param    servletPath         a String, the result of HttpRequest.getServletPath()
  -     * @param    contextPath         a  String , the result of HttpRequest.getContextPath()     
  +     * @param    contextPath         a  String , the result of HttpRequest.getContextPath()
        *
        * @return   the value of the <code>&lt;lockdiscovery&gt;</code> property.
        *
  @@ -1514,7 +1514,7 @@
        * @param    revisionDescriptors  the NodeRevisionDescriptors of the resource.
        * @param    revisionDescriptor   the NodeRevisionDescriptor of the resource.
        * @param    contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param    servletPath          a String, the result of HttpRequest.getServletPath()    
  +     * @param    servletPath          a String, the result of HttpRequest.getServletPath()
        *
        * @return   the value of the <code>&lt;supported-privilege-set&gt;</code> property.
        *
  @@ -1615,7 +1615,7 @@
        * @param    revisionDescriptors  the NodeRevisionDescriptors of the resource.
        * @param    revisionDescriptor   the NodeRevisionDescriptor of the resource.
        * @param    contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param    servletPath          a String, the result of HttpRequest.getServletPath()    
  +     * @param    servletPath          a String, the result of HttpRequest.getServletPath()
        *
        * @return   the value of the <code>&lt;current-user-privilege-set&gt;</code> property.
        *
  @@ -1666,7 +1666,7 @@
        * @param    revisionDescriptors  the NodeRevisionDescriptors of the resource.
        * @param    revisionDescriptor   the NodeRevisionDescriptor of the resource.
        * @param    contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param    servletPath          a String, the result of HttpRequest.getServletPath()        
  +     * @param    servletPath          a String, the result of HttpRequest.getServletPath()
        *
        * @return   the value of the <code>&lt;acl&gt;</code> property.
        *
  @@ -1851,7 +1851,7 @@
        * @param    revisionDescriptors  the NodeRevisionDescriptors of the resource.
        * @param    revisionDescriptor   the NodeRevisionDescriptor of the resource.
        * @param    contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param    servletPath          a String, the result of HttpRequest.getServletPath()    
  +     * @param    servletPath          a String, the result of HttpRequest.getServletPath()
        *
        * @return   the value of the <code>&lt;principal-collection-set&gt;</code> property.
        *
  @@ -1904,7 +1904,7 @@
        * @param    revisionDescriptors  the NodeRevisionDescriptors of the resource.
        * @param    revisionDescriptor   the NodeRevisionDescriptor of the resource.
        * @param    contextPath          a  String , the result of HttpRequest.getContextPath()
  -     * @param    servletPath          a String, the result of HttpRequest.getServletPath()    
  +     * @param    servletPath          a String, the result of HttpRequest.getServletPath()
        *
        * @return   the value of the <code>&lt;owner&gt;</code> property.
        *
  @@ -1921,7 +1921,7 @@
           NodeProperty ownerProperty = revisionDescriptor.getProperty(P_OWNER,
                                                                       NodeProperty.DEFAULT_NAMESPACE);
           
  -	// FIXME wihtout servletPath??
  +    // FIXME wihtout servletPath??
           XMLValue xmlValue = createUserPath(ownerProperty, contextPath);
           
           return xmlValue;
  @@ -1931,7 +1931,7 @@
           
           NodeProperty creationUserProperty = revisionDescriptor.getProperty(P_CREATIONUSER,
                                                                              NodeProperty.DEFAULT_NAMESPACE);
  -	// FIXME wihtout servletPath??
  +    // FIXME wihtout servletPath??
           XMLValue xmlValue = createUserPath(creationUserProperty, contextPath);
           
           return xmlValue;
  @@ -1942,7 +1942,7 @@
           NodeProperty modificationUserProperty = revisionDescriptor.getProperty(P_MODIFICATIONUSER,
                                                                                  NodeProperty.DEFAULT_NAMESPACE);
           
  -	// FIXME wihtout servletPath??
  +    // FIXME wihtout servletPath??
           XMLValue xmlValue = createUserPath(modificationUserProperty, contextPath);
           
           return xmlValue;
  @@ -1985,10 +1985,10 @@
               XMLValue xmlValue = new XMLValue();
               Uri principalUri = nsaToken.getUri(sToken, revisionDescriptors.getUri());
               SubjectNode principalNode = (SubjectNode)principalUri.getStore().retrieveObject(principalUri);
  -            Enumeration roles = ((ACLSecurityImpl)nsaToken.getSecurityHelper()).getGroupMembership(sToken, principalNode);	    
  +            Enumeration roles = ((ACLSecurityImpl)nsaToken.getSecurityHelper()).getGroupMembership(sToken, principalNode);
               while (roles.hasMoreElements()) {
                   String rolePath = (String)roles.nextElement();
  -		// FIXME wihtout servletPath??
  +        // FIXME wihtout servletPath??
                   String roleHref = contextPath+rolePath;
                   xmlValue.addHref(roleHref);
               }
  @@ -2057,13 +2057,12 @@
       /**
        * Returns <code>true</code> if the given <code>uri</code> is an absolute URL.
        *
  -     * @param      serverURL    the URL of the server
        * @param      contextPath  the context path.
        * @param      uri          the (slide-) URI of the resource.
        *
        * @return     <code>true</code> if the given <code>uri</code> is an absolute URL.
        */
  -    public static boolean isAbsoluteURL(String serverURL, String contextPath, String uri) {
  +    public static boolean isAbsoluteURL(String contextPath, String uri) {
           if (uri.startsWith(S_RESOURCE_ID)) {
               return true;
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org