Well, it didn't attach properly. I'll paste it below

=================================

/*
 * Copyright 1999-2004 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.
 * 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.slide.content;

import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.SlideToken;

/**
 * Performs some cleanup of content to help work around bugs in
Microsoft's
 * WebFolders.
 *
 * @author <a href="mailto:[EMAIL PROTECTED]">James Mason</a>
 */
public class WebFolderContentInterceptor extends
AbstractContentInterceptor {
        
        private static String DAV_NAMESPACE = "DAV:";
        
        private NamespaceAccessToken nat;

        public WebFolderContentInterceptor() {
        }
        
        /**
         * Sets the DAV:displayname property equal to the name of the
content being stored. 
         */
        public void preStoreContent(
                        SlideToken token,
                        NodeRevisionDescriptors revisionDescriptors,
                        NodeRevisionDescriptor revisionDescriptor,
                        NodeRevisionContent revisionContent ) {
                
                // Set displayname property equal to name of resource.
                String uriString = revisionDescriptors.getUri();
                String name = "";
                int index = uriString.lastIndexOf( "/" );
                if ( index > -1 && index < uriString.length() ) {
                        name = uriString.substring(
uriString.lastIndexOf( "/" ) + 1, uriString.length() );
                } else {
                        // FIXME handle this better
                        name = revisionDescriptor.getName();
                }
                String oldName = revisionDescriptor.getProperty(
                        "displayname", DAV_NAMESPACE
).getValue().toString();
                if ( !name.equals( oldName ) ) {
                        revisionDescriptor.setProperty( "displayname",
DAV_NAMESPACE, name );
                }
        }
        
        public void setNamespace(NamespaceAccessToken nat) {
                this.nat = nat;
        }

}


==================================

>>> [EMAIL PROTECTED] 7/8/2004 2:19:28 PM >>>
Andrey,
I've attached the file. Based on reading the post you linked to I
think
it might actually be better to *empty* the displayname property rather
than set it explicitly. That should be a simple change, though.

You'll need to add this line to the <configuration> node of your
Domain.xml file:
<content-interceptor
class="org.apache.slide.content.WebFolderContentInterceptor"/>

-James

>>> [EMAIL PROTECTED] 7/8/2004 1:48:41 PM >>>
Thanks a lot, James, I am positively interested.

Yours sincerely,
Andrey.

> -----Original Message-----
> From: Slide Users Mailing List [mailto:[EMAIL PROTECTED]


> Sent: Thursday, July 08, 2004 4:35 PM
> To: [EMAIL PROTECTED] 
> Subject: Re: "displayname" property usage in Slide 2.0 Release
> Importance: Low
> 
> I worked around this by using a ContentInterceptor that sets 
> the displayname property of a resource every time it is 
> added/moved/etc (the code implements preStoreContent()). It's 
> worked well so far, but basically makes the displayname 
> property useless as a separate property.
> 
> I can post the code if you're interested.
> 
> -James
> 
> >>> [EMAIL PROTECTED] 7/8/2004 1:29:11 PM >>>
> Hi there!
> 
> I'm migrating from Slide 2.0 Beta1 to Slide 2.0 Release and 
> I've come across the same problem Peder Nordvaller and Julian 
> Reschke described 3 months
> ago:
> "When creating a new folder IE creates a folder named "New 
> Folder". I then rename it and it works just fine. But when I 
> refresh the IE window the name "New Folder" reappears instead 
> of the new name."
> (See the full discussion here:
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg0 
> 5594.html)
> I have one more issue that probably have the same cause: when 
> I save a new file to the Slide store using MacOS's MS Word 
> and then view it using PC WebFolders, I see some strange 
> string instead of the name I entered.
> Actually, it's the value of the "displayname" property... 
> In Slide 2.0 Beta1 the value of "displayname" was always 
> equal to the last portion of the resource URI so this problem 
> never happened.
> I wonder if there's a patch or workaround here, any help 
> would be really appreciated.
> 
> Yours sincerely,
> Andrey Shulinsky.
> 
> PS: by the way, may I ask about people's opinion about Slide 
> 2.1 Milestone 1? I mean, Slide site officially recommends to 
> use Slide 2.0 
> (http://jakarta.apache.org/slide/download.html), but does MS1 
> introduce some new and risky stuff or is it just the improved 
> (bugs fixed, performance
> tuned)) version of the 2.0 Release? Thanks.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to