summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2008-12-01 12:44:06 +0000
committerRelease Engineers <releng@openoffice.org>2008-12-01 12:44:06 +0000
commit03bb99b0634c16583b2ed65914c9092f14cdd698 (patch)
treef6576d81916a65c396492e2bded6380203a0bea6 /ucb
parenta6f52ce1a54abd7e8a135eaddf9baea1c5fdad9c (diff)
CWS-TOOLING: integrate CWS httpperf_DEV300
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav/ContentProperties.cxx275
-rw-r--r--ucb/source/ucp/webdav/ContentProperties.hxx17
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.cxx5
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.cxx225
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.hxx8
5 files changed, 299 insertions, 231 deletions
diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx
index 5b4e197343..13c6be69c8 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 75d2504033..0f43dc1389 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,11 +165,20 @@ 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; }
const rtl::OUString & getEscapedTitle() const { return m_aEscapedTitle; }
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index 8dfe957035..9c977e09e8 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 b15da6287a..1dc402b173 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;
-
- ContentProperties::UCBNamesToDAVNames(
- rProperties, aPropNames );
-
- if ( aPropNames.size() > 0 )
+ // cache lookup... getResourceType may fill the props cache via PROPFIND!
+ if ( m_xCachedProps.get() )
{
- std::vector< DAVResource > resources;
- try
+ xCachedProps.reset( new ContentProperties( *m_xCachedProps.get() ) );
+
+ std::vector< rtl::OUString > aMissingProps;
+ if ( xCachedProps->containsAllNames( rProperties, aMissingProps ) )
{
- xResAccess->PROPFIND(
- DAVZERO, aPropNames, resources, xEnv );
-
- if ( 1 == resources.size() )
+ // All properties are already in cache! No server access needed.
+ bHasAll = true;
+ }
+
+ // use the cached ContentProperties instance
+ xProps.reset( new ContentProperties( *xCachedProps.get() ) );
+ }
+
+ if ( !bHasAll )
+ {
+ // Only DAV resources support PROPFIND
+ std::vector< rtl::OUString > aPropNames;
+
+ uno::Sequence< beans::Property > aProperties( rProperties.getLength() );
+
+ 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 );
-
- if ( !bNetworkAccessAllowed )
+ aProperties = rProperties;
+ }
+
+ if ( aProperties.getLength() > 0 )
+ ContentProperties::UCBNamesToDAVNames(
+ aProperties, aPropNames );
+
+ 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,7 +1503,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
{
DAVResource resource;
xResAccess->HEAD( aHeaderNames, resource, xEnv );
-
+ m_bDidGetOrHead = true;
+
if ( xProps.get() )
xProps->addProperties(
aMissingProps,
@@ -1512,13 +1574,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
"IsDocument" )),
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 );
@@ -3139,24 +3182,12 @@ 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 30c2041cc1..cd520792be 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 >