diff options
author | Release Engineers <releng@openoffice.org> | 2008-12-01 12:44:06 +0000 |
---|---|---|
committer | Release Engineers <releng@openoffice.org> | 2008-12-01 12:44:06 +0000 |
commit | eb4f46db0aebd99a47d465e90f445b58bc46d7cc (patch) | |
tree | 2090838fb6843c4e9f8eb66fdd10a721d1d34e5f /ucb/source | |
parent | 7a5d79f2297a43d0a854e304b0792164272edfe0 (diff) |
CWS-TOOLING: integrate CWS httpperf_DEV300
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/webdav/ContentProperties.cxx | 275 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/ContentProperties.hxx | 15 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/DAVResourceAccess.cxx | 5 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/webdavcontent.cxx | 207 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/webdavcontent.hxx | 8 |
5 files changed, 289 insertions, 221 deletions
diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx index 3c5fb0fd4633..78cf25bc24ec 100644 --- a/ucb/source/ucp/webdav/ContentProperties.cxx +++ b/ucb/source/ucp/webdav/ContentProperties.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ContentProperties.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.18.1 $ * * This file is part of OpenOffice.org. * @@ -128,127 +128,7 @@ ContentProperties::ContentProperties( const DAVResource& rResource ) while ( it != end ) { - DAVPropertyValue aProp = (*it); - - if ( aProp.Name.equals( DAVProperties::CREATIONDATE ) ) - { - // Map DAV:creationdate to UCP:DateCreated - rtl::OUString aValue; - aProp.Value >>= aValue; - util::DateTime aDate; - DateTimeHelper::convert( aValue, aDate ); - - (*m_xProps)[ rtl::OUString::createFromAscii( "DateCreated" ) ] - = PropertyValue( uno::makeAny( aDate ), true ); - } -// else if ( aProp.Name.equals( DAVProperties::DISPLAYNAME ) ) -// { -// } -// else if ( aProp.Name.equals( DAVProperties::GETCONTENTLANGUAGE ) ) -// { -// } - else if ( aProp.Name.equals( DAVProperties::GETCONTENTLENGTH ) ) - { - // Map DAV:getcontentlength to UCP:Size - rtl::OUString aValue; - aProp.Value >>= aValue; - - (*m_xProps)[ rtl::OUString::createFromAscii( "Size" ) ] - = PropertyValue( uno::makeAny( aValue.toInt64() ), true ); - } - else if ( aProp.Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "Content-Length" ) ) ) - { - // Do NOT map Content-Lenght entity header to DAV:getcontentlength! - // Only DAV resources have this property. - - // Map Content-Length entity header to UCP:Size - rtl::OUString aValue; - aProp.Value >>= aValue; - - (*m_xProps)[ rtl::OUString::createFromAscii( "Size" ) ] - = PropertyValue( uno::makeAny( aValue.toInt64() ), true ); - } - else if ( aProp.Name.equals( DAVProperties::GETCONTENTTYPE ) ) - { - // Map DAV:getcontenttype to UCP:MediaType (1:1) - (*m_xProps)[ rtl::OUString::createFromAscii( "MediaType" ) ] - = PropertyValue( aProp.Value, true ); - } - else if ( aProp.Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "Content-Type" ) ) ) - { - // Do NOT map Content-Type entity header to DAV:getcontenttype! - // Only DAV resources have this property. - - // Map DAV:getcontenttype to UCP:MediaType (1:1) - (*m_xProps)[ rtl::OUString::createFromAscii( "MediaType" ) ] - = PropertyValue( aProp.Value, true ); - } -// else if ( aProp.Name.equals( DAVProperties::GETETAG ) ) -// { -// } - else if ( aProp.Name.equals( DAVProperties::GETLASTMODIFIED ) ) - { - // Map the DAV:getlastmodified entity header to UCP:DateModified - rtl::OUString aValue; - aProp.Value >>= aValue; - util::DateTime aDate; - DateTimeHelper::convert( aValue, aDate ); - - (*m_xProps)[ rtl::OUString::createFromAscii( "DateModified" ) ] - = PropertyValue( uno::makeAny( aDate ), true ); - } - else if ( aProp.Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "Last-Modified" ) ) ) - { - // Do not map Last-Modified entity header to DAV:getlastmodified! - // Only DAV resources have this property. - - // Map the Last-Modified entity header to UCP:DateModified - rtl::OUString aValue; - aProp.Value >>= aValue; - util::DateTime aDate; - DateTimeHelper::convert( aValue, aDate ); - - (*m_xProps)[ rtl::OUString::createFromAscii( "DateModified" ) ] - = PropertyValue( uno::makeAny( aDate ), true ); - } -// else if ( aProp.Name.equals( DAVProperties::LOCKDISCOVERY ) ) -// { -// } - else if ( aProp.Name.equals( DAVProperties::RESOURCETYPE ) ) - { - rtl::OUString aValue; - aProp.Value >>= aValue; - - // Map DAV:resourceype to UCP:IsFolder, UCP:IsDocument, UCP:ContentType - sal_Bool bFolder = - aValue.equalsIgnoreAsciiCaseAsciiL( - RTL_CONSTASCII_STRINGPARAM( "collection" ) ); - - (*m_xProps)[ rtl::OUString::createFromAscii( "IsFolder" ) ] - = PropertyValue( uno::makeAny( bFolder ), true ); - (*m_xProps)[ rtl::OUString::createFromAscii( "IsDocument" ) ] - = PropertyValue( uno::makeAny( sal_Bool( !bFolder ) ), true ); - (*m_xProps)[ rtl::OUString::createFromAscii( "ContentType" ) ] - = PropertyValue( uno::makeAny( bFolder - ? rtl::OUString::createFromAscii( - WEBDAV_COLLECTION_TYPE ) - : rtl::OUString::createFromAscii( - WEBDAV_CONTENT_TYPE ) ), true ); - } -// else if ( aProp.Name.equals( DAVProperties::SOURCE ) ) -// { -// } -// else if ( aProp.Name.equals( DAVProperties::SUPPORTEDLOCK ) ) -// { -// } - - // Save property. - (*m_xProps)[ aProp.Name ] - = PropertyValue( aProp.Value, aProp.IsCaseSensitive ); - + addProperty( (*it) ); ++it; } @@ -551,23 +431,168 @@ void ContentProperties::addProperties( if ( pProp ) { // Add it. - (*m_xProps)[ rName ] = PropertyValue( *pProp ); + addProperty( rName, pProp->value(), pProp->isCaseSensitive() ); } else { - (*m_xProps)[ rName ] = PropertyValue( uno::Any(), false ); + addProperty( rName, uno::Any(), false ); } - } + ++it; + } +} + +//========================================================================= +void ContentProperties::addProperties( const ContentProperties & rProps ) +{ + PropertyValueMap::const_iterator it = rProps.m_xProps->begin(); + const PropertyValueMap::const_iterator end = rProps.m_xProps->end(); + + while ( it != end ) + { + addProperty( + (*it).first, (*it).second.value(), (*it).second.isCaseSensitive() ); + ++it; + } +} +//========================================================================= +void ContentProperties::addProperties( + const std::vector< DAVPropertyValue > & rProps ) +{ + std::vector< DAVPropertyValue >::const_iterator it = rProps.begin(); + std::vector< DAVPropertyValue >::const_iterator end = rProps.end(); + + while ( it != end ) + { + addProperty( (*it) ); ++it; } } //========================================================================= +void ContentProperties::addProperty( const DAVPropertyValue & rProp ) +{ + addProperty( rProp.Name, rProp.Value, rProp.IsCaseSensitive ); +} + +//========================================================================= void ContentProperties::addProperty( const rtl::OUString & rName, const com::sun::star::uno::Any & rValue, bool bIsCaseSensitive ) { + if ( rName.equals( DAVProperties::CREATIONDATE ) ) + { + // Map DAV:creationdate to UCP:DateCreated + rtl::OUString aValue; + rValue >>= aValue; + util::DateTime aDate; + DateTimeHelper::convert( aValue, aDate ); + + (*m_xProps)[ rtl::OUString::createFromAscii( "DateCreated" ) ] + = PropertyValue( uno::makeAny( aDate ), true ); + } + // else if ( rName.equals( DAVProperties::DISPLAYNAME ) ) + // { + // } + // else if ( rName.equals( DAVProperties::GETCONTENTLANGUAGE ) ) + // { + // } + else if ( rName.equals( DAVProperties::GETCONTENTLENGTH ) ) + { + // Map DAV:getcontentlength to UCP:Size + rtl::OUString aValue; + rValue >>= aValue; + + (*m_xProps)[ rtl::OUString::createFromAscii( "Size" ) ] + = PropertyValue( uno::makeAny( aValue.toInt64() ), true ); + } + else if ( rName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "Content-Length" ) ) ) + { + // Do NOT map Content-Lenght entity header to DAV:getcontentlength! + // Only DAV resources have this property. + + // Map Content-Length entity header to UCP:Size + rtl::OUString aValue; + rValue >>= aValue; + + (*m_xProps)[ rtl::OUString::createFromAscii( "Size" ) ] + = PropertyValue( uno::makeAny( aValue.toInt64() ), true ); + } + else if ( rName.equals( DAVProperties::GETCONTENTTYPE ) ) + { + // Map DAV:getcontenttype to UCP:MediaType (1:1) + (*m_xProps)[ rtl::OUString::createFromAscii( "MediaType" ) ] + = PropertyValue( rValue, true ); + } + else if ( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Content-Type" ) ) ) + { + // Do NOT map Content-Type entity header to DAV:getcontenttype! + // Only DAV resources have this property. + + // Map DAV:getcontenttype to UCP:MediaType (1:1) + (*m_xProps)[ rtl::OUString::createFromAscii( "MediaType" ) ] + = PropertyValue( rValue, true ); + } + // else if ( rName.equals( DAVProperties::GETETAG ) ) + // { + // } + else if ( rName.equals( DAVProperties::GETLASTMODIFIED ) ) + { + // Map the DAV:getlastmodified entity header to UCP:DateModified + rtl::OUString aValue; + rValue >>= aValue; + util::DateTime aDate; + DateTimeHelper::convert( aValue, aDate ); + + (*m_xProps)[ rtl::OUString::createFromAscii( "DateModified" ) ] + = PropertyValue( uno::makeAny( aDate ), true ); + } + else if ( rName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "Last-Modified" ) ) ) + { + // Do not map Last-Modified entity header to DAV:getlastmodified! + // Only DAV resources have this property. + + // Map the Last-Modified entity header to UCP:DateModified + rtl::OUString aValue; + rValue >>= aValue; + util::DateTime aDate; + DateTimeHelper::convert( aValue, aDate ); + + (*m_xProps)[ rtl::OUString::createFromAscii( "DateModified" ) ] + = PropertyValue( uno::makeAny( aDate ), true ); + } + // else if ( rName.equals( DAVProperties::LOCKDISCOVERY ) ) + // { + // } + else if ( rName.equals( DAVProperties::RESOURCETYPE ) ) + { + rtl::OUString aValue; + rValue >>= aValue; + + // Map DAV:resourceype to UCP:IsFolder, UCP:IsDocument, UCP:ContentType + sal_Bool bFolder = + aValue.equalsIgnoreAsciiCaseAsciiL( + RTL_CONSTASCII_STRINGPARAM( "collection" ) ); + + (*m_xProps)[ rtl::OUString::createFromAscii( "IsFolder" ) ] + = PropertyValue( uno::makeAny( bFolder ), true ); + (*m_xProps)[ rtl::OUString::createFromAscii( "IsDocument" ) ] + = PropertyValue( uno::makeAny( sal_Bool( !bFolder ) ), true ); + (*m_xProps)[ rtl::OUString::createFromAscii( "ContentType" ) ] + = PropertyValue( uno::makeAny( bFolder + ? rtl::OUString::createFromAscii( WEBDAV_COLLECTION_TYPE ) + : rtl::OUString::createFromAscii( WEBDAV_CONTENT_TYPE ) ), true ); + } + // else if ( rName.equals( DAVProperties::SOURCE ) ) + // { + // } + // else if ( rName.equals( DAVProperties::SUPPORTEDLOCK ) ) + // { + // } + + // Save property. (*m_xProps)[ rName ] = PropertyValue( rValue, bIsCaseSensitive ); } diff --git a/ucb/source/ucp/webdav/ContentProperties.hxx b/ucb/source/ucp/webdav/ContentProperties.hxx index 2020394e1c27..758e035c0e05 100644 --- a/ucb/source/ucp/webdav/ContentProperties.hxx +++ b/ucb/source/ucp/webdav/ContentProperties.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ContentProperties.hxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.34.1 $ * * This file is part of OpenOffice.org. * @@ -165,10 +165,19 @@ public: void addProperties( const std::vector< rtl::OUString > & rProps, const ContentProperties & rContentProps ); + // overwrites probably existing entries. + void addProperties( const ContentProperties & rProps ); + + // overwrites probably existing entries. + void addProperties( const std::vector< DAVPropertyValue > & rProps ); + // overwrites probably existing entry. void addProperty( const rtl::OUString & rName, - const com::sun::star::uno::Any & rValue, - bool bIsCaseSensitive ); + const com::sun::star::uno::Any & rValue, + bool bIsCaseSensitive ); + + // overwrites probably existing entry. + void addProperty( const DAVPropertyValue & rProp ); bool isTrailingSlash() const { return m_bTrailingSlash; } diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx index f635a4d52855..fdd026f76963 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DAVResourceAccess.cxx,v $ - * $Revision: 1.29 $ + * $Revision: 1.29.16.1 $ * * This file is part of OpenOffice.org. * @@ -1065,7 +1065,8 @@ sal_Bool DAVResourceAccess::handleException( DAVException & e, int errorCount ) // --> tkr #67048# copy & paste images doesn't display. // if we have a bad connection try again. Up to three times. case DAVException::DAV_HTTP_ERROR: - if (errorCount < 3) + // retry up to three times, if not a client-side error. + if ( ( e.getStatus() < 400 || e.getStatus() > 499 ) && errorCount < 3) { return sal_True; } diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index 40d9d96a94d6..2ba94c78a8ac 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: webdavcontent.cxx,v $ - * $Revision: 1.65 $ + * $Revision: 1.65.12.1 $ * * This file is part of OpenOffice.org. * @@ -352,8 +352,9 @@ Content::Content( : ContentImplHelper( rxSMgr, pProvider, Identifier ), m_eResourceType( UNKNOWN ), m_pProvider( pProvider ), - m_bTransient( sal_False ), - m_bCollection( sal_False ) + m_bTransient( false ), + m_bCollection( false ), + m_bDidGetOrHead( false ) { try { @@ -383,8 +384,9 @@ Content::Content( : ContentImplHelper( rxSMgr, pProvider, Identifier ), m_eResourceType( UNKNOWN ), m_pProvider( pProvider ), - m_bTransient( sal_True ), - m_bCollection( isCollection ) + m_bTransient( true ), + m_bCollection( isCollection ), + m_bDidGetOrHead( false ) { try { @@ -884,8 +886,8 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name, // Check property type. if ( !UCBDeadPropertyValue::supportsType( DefaultValue.getValueType() ) ) { - OSL_ENSURE( sal_False, "Content::addProperty - " - "Unsupported property type!" ); + OSL_ENSURE( sal_False, "Content::addProperty - " + "Unsupported property type!" ); throw beans::IllegalTypeException(); } @@ -1343,7 +1345,6 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( uno::Reference< ucb::XContentIdentifier > xIdentifier; rtl::Reference< ::ucbhelper::ContentProviderImplHelper > xProvider; - const ResourceType & rType = getResourceType( xEnv ); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -1377,43 +1378,102 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( ///////////////////////////////////////////////////////////////////// // First, identify whether resource is DAV or not - //const ResourceType & rType = getResourceType( xEnv, xResAccess ); + const ResourceType & rType = getResourceType( xEnv, xResAccess ); bool bNetworkAccessAllowed = true; if ( DAV == rType ) { - // Only DAV resources support PROPFIND - std::vector< rtl::OUString > aPropNames; + // cache lookup... getResourceType may fill the props cache via PROPFIND! + if ( m_xCachedProps.get() ) + { + xCachedProps.reset( new ContentProperties( *m_xCachedProps.get() ) ); - ContentProperties::UCBNamesToDAVNames( - rProperties, aPropNames ); + std::vector< rtl::OUString > aMissingProps; + if ( xCachedProps->containsAllNames( rProperties, aMissingProps ) ) + { + // All properties are already in cache! No server access needed. + bHasAll = true; + } + + // use the cached ContentProperties instance + xProps.reset( new ContentProperties( *xCachedProps.get() ) ); + } - if ( aPropNames.size() > 0 ) + if ( !bHasAll ) { - std::vector< DAVResource > resources; - try - { - xResAccess->PROPFIND( - DAVZERO, aPropNames, resources, xEnv ); + // Only DAV resources support PROPFIND + std::vector< rtl::OUString > aPropNames; + + uno::Sequence< beans::Property > aProperties( rProperties.getLength() ); - if ( 1 == resources.size() ) + if ( m_aFailedPropNames.size() > 0 ) + { + sal_Int32 nProps = 0; + sal_Int32 nCount = rProperties.getLength(); + for ( sal_Int32 n = 0; n < nCount; ++n ) { - if ( xProps.get()) - xProps->addProperties( aPropNames, ContentProperties( resources[ 0 ] )); - else - xProps.reset( new ContentProperties( resources[ 0 ] ) ); + const rtl::OUString & rName = rProperties[ n ].Name; + + std::vector< rtl::OUString >::const_iterator it + = m_aFailedPropNames.begin(); + std::vector< rtl::OUString >::const_iterator end + = m_aFailedPropNames.end(); + + while ( it != end ) + { + if ( *it == rName ) + break; + + ++it; + } + + if ( it == end ) + { + aProperties[ nProps ] = rProperties[ n ]; + nProps++; + } } + + aProperties.realloc( nProps ); } - catch ( DAVException const & e ) + else { - bNetworkAccessAllowed - = shouldAccessNetworkAfterException( e ); + aProperties = rProperties; + } + + if ( aProperties.getLength() > 0 ) + ContentProperties::UCBNamesToDAVNames( + aProperties, aPropNames ); - if ( !bNetworkAccessAllowed ) + if ( aPropNames.size() > 0 ) + { + std::vector< DAVResource > resources; + try { - cancelCommandExecution( e, xEnv ); - // unreachable + xResAccess->PROPFIND( + DAVZERO, aPropNames, resources, xEnv ); + + if ( 1 == resources.size() ) + { + if ( xProps.get()) + xProps->addProperties( + aPropNames, ContentProperties( resources[ 0 ] )); + else + xProps.reset( + new ContentProperties( resources[ 0 ] ) ); + } + } + catch ( DAVException const & e ) + { + bNetworkAccessAllowed + = shouldAccessNetworkAfterException( e ); + + if ( !bNetworkAccessAllowed ) + { + cancelCommandExecution( e, xEnv ); + // unreachable + } } } } @@ -1425,7 +1485,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( std::vector< rtl::OUString > aMissingProps; if ( !( xProps.get() && xProps->containsAllNames( - rProperties, aMissingProps ) ) ) + rProperties, aMissingProps ) ) + && !m_bDidGetOrHead ) { // Possibly the missing props can be obtained using a HEAD // request. @@ -1442,6 +1503,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { DAVResource resource; xResAccess->HEAD( aHeaderNames, resource, xEnv ); + m_bDidGetOrHead = true; if ( xProps.get() ) xProps->addProperties( @@ -1513,12 +1575,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( uno::makeAny( true), true); } - - } else { - // No server access for just created (not yet committed) objects. // Only a minimal set of properties supported at this stage. if (m_bTransient) @@ -1537,6 +1596,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( getBaseURI( xResAccess ) ), true ); } + uno::Reference< sdbc::XRow > xResultRow = getPropertyValues( xSMgr, rProperties, @@ -1546,7 +1606,12 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { osl::Guard< osl::Mutex > aGuard( m_aMutex ); - m_xCachedProps.reset( new ContentProperties( *xProps.get() ) ); + + if ( !m_xCachedProps.get() ) + m_xCachedProps.reset( new ContentProperties( *xProps.get() ) ); + else + m_xCachedProps->addProperties( *xProps.get() ); + m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); m_aEscapedTitle = aEscapedTitle; } @@ -2054,9 +2119,6 @@ uno::Any Content::open( { osl::MutexGuard aGuard( m_aMutex ); - // throw away previously cached headers. -// m_xCachedProps.reset(); - xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); } @@ -2068,21 +2130,16 @@ uno::Any Content::open( // ContentProperties::getMappableHTTPHeaders( aHeaders ); xResAccess->GET( xOut, aHeaders, aResource, xEnv ); + m_bDidGetOrHead = true; { osl::MutexGuard aGuard( m_aMutex ); // cache headers. -// m_xCachedProps.reset( new ContentProperties( aResource ) ); - std::vector< DAVPropertyValue >::const_iterator it = aResource.properties.begin(); - std::vector< DAVPropertyValue >::const_iterator end = aResource.properties.end(); - while ( it != end ) - { - DAVPropertyValue aProp = (*it++); - m_xCachedProps->addProperty( aProp.Name, aProp.Value, true); - } - - + if ( !m_xCachedProps.get()) + m_xCachedProps.reset( new ContentProperties( aResource ) ); + else + m_xCachedProps->addProperties( aResource ); m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); @@ -2108,9 +2165,6 @@ uno::Any Content::open( { osl::MutexGuard aGuard( m_aMutex ); - // throw away previously cached headers. -// m_xCachedProps.reset(); - xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); } @@ -2124,15 +2178,19 @@ uno::Any Content::open( uno::Reference< io::XInputStream > xIn = xResAccess->GET( aHeaders, aResource, xEnv ); + m_bDidGetOrHead = true; { osl::MutexGuard aGuard( m_aMutex ); - // m_xCachedProps.reset( - // new ContentProperties( aResource ) ); + + // cache headers. + if ( !m_xCachedProps.get()) + m_xCachedProps.reset( new ContentProperties( aResource ) ); + else + m_xCachedProps->addProperties( aResource.properties ); m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); - } xDataSink->setInputStream( xIn ); @@ -3106,26 +3164,11 @@ const Content::ResourceType & Content::getResourceType( } else { - - /* - // collaps redirect - try - { - std::vector< rtl::OUString > aHeaderNames; - DAVResource resource; - rResAccess->HEAD( - aHeaderNames, resource, xEnv ); - } - catch ( DAVException const & e ) - { - cancelCommandExecution( e, xEnv ); - // Unreachable - } - */ - try { - + // Try to fetch some frequently used property value, e.g. those + // used when loading documents... along with identifying whether + // this is a DAV resource. std::vector< DAVResource > resources; std::vector< rtl::OUString > aPropNames; uno::Sequence< beans::Property > aProperties( 4 ); @@ -3140,23 +3183,11 @@ const Content::ResourceType & Content::getResourceType( rResAccess->PROPFIND( DAVZERO, aPropNames, resources, xEnv ); - std::vector< DAVResource >::const_iterator it - = resources.begin(); - std::vector< DAVResource >::const_iterator end - = resources.end(); - - while ( it != end ) - { - DAVResource aRes = (*it++); - m_xCachedProps.reset( new ContentProperties( aRes ) ); - //m_xCachedProps.addProperty( new ContentProperties( aRes ) ); + if ( resources.size() == 1 ) + { + m_xCachedProps.reset( new ContentProperties( resources[ 0 ] ) ); + m_xCachedProps->containsAllNames( aProperties, m_aFailedPropNames ); } -/* std::vector< rtl::OUString > aPropNames; - aPropNames.push_back( DAVProperties::RESOURCETYPE ); - std::vector< DAVResource > resources; - rResAccess->PROPFIND( - DAVZERO, aPropNames, resources, xEnv ); -*/ eResourceType = DAV; } catch ( DAVException const& ) diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx index da0629e3f844..02e6a106fe64 100644 --- a/ucb/source/ucp/webdav/webdavcontent.hxx +++ b/ucb/source/ucp/webdav/webdavcontent.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: webdavcontent.hxx,v $ - * $Revision: 1.23 $ + * $Revision: 1.23.32.1 $ * * This file is part of OpenOffice.org. * @@ -88,8 +88,10 @@ class Content : public ::ucbhelper::ContentImplHelper, rtl::OUString m_aEscapedTitle; ResourceType m_eResourceType; ContentProvider* m_pProvider; // No need for a ref, base class holds object - sal_Bool m_bTransient; - sal_Bool m_bCollection; + bool m_bTransient; + bool m_bCollection; + bool m_bDidGetOrHead; + std::vector< rtl::OUString > m_aFailedPropNames; private: virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property > |