Author: arielch Date: Sun Mar 24 13:22:48 2013 New Revision: 1460362 URL: http://svn.apache.org/r1460362 Log: i121945 - WebDAV ucp: return StringPair instead of NamedValue
Make css::ucb::XWebDAVCommandEnvironment::getUserRequestHeaders() return a sequence of css::beans::StringPair; this avoids all the any overhead, and is much more simple and intuitive. Modified: openoffice/trunk/main/extensions/source/update/feed/updatefeed.cxx openoffice/trunk/main/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl openoffice/trunk/main/offapi/type_reference/typelibrary_history.txt openoffice/trunk/main/offapi/type_reference/types.rdb openoffice/trunk/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx Modified: openoffice/trunk/main/extensions/source/update/feed/updatefeed.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/extensions/source/update/feed/updatefeed.cxx?rev=1460362&r1=1460361&r2=1460362&view=diff ============================================================================== --- openoffice/trunk/main/extensions/source/update/feed/updatefeed.cxx (original) +++ openoffice/trunk/main/extensions/source/update/feed/updatefeed.cxx Sun Mar 24 13:22:48 2013 @@ -178,7 +178,7 @@ public: throw ( uno::RuntimeException ) { return uno::Reference< ucb::XProgressHandler >(); }; // XWebDAVCommandEnvironment - virtual uno::Sequence< beans::NamedValue > SAL_CALL getUserRequestHeaders( + virtual uno::Sequence< beans::StringPair > SAL_CALL getUserRequestHeaders( const rtl::OUString&, const rtl::OUString& ) throw ( uno::RuntimeException ) { return m_aRequestHeaderList; }; @@ -193,7 +193,7 @@ public: protected: virtual ~UpdateInformationProvider(); - static uno::Any getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, rtl::OUString const & node, rtl::OUString const & item); + static rtl::OUString getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, rtl::OUString const & node, rtl::OUString const & item); private: uno::Reference< io::XInputStream > load(const rtl::OUString& rURL); @@ -214,7 +214,7 @@ private: const uno::Reference< xml::dom::XDocumentBuilder > m_xDocumentBuilder; const uno::Reference< xml::xpath::XXPathAPI > m_xXPathAPI; - uno::Sequence< beans::NamedValue > m_aRequestHeaderList; + uno::Sequence< beans::StringPair > m_aRequestHeaderList; uno::Reference< ucb::XCommandProcessor > m_xCommandProcessor; uno::Reference< task::XInteractionHandler > m_xInteractionHandler; @@ -344,19 +344,17 @@ UpdateInformationProvider::UpdateInforma uno::UNO_QUERY_THROW); rtl::OUStringBuffer buf; - rtl::OUString name; - getConfigurationItem( - xConfigurationProvider, - UNISTRING("org.openoffice.Setup/Product"), - UNISTRING("ooName")) >>= name; - buf.append(name); + buf.append( + getConfigurationItem( + xConfigurationProvider, + UNISTRING("org.openoffice.Setup/Product"), + UNISTRING("ooName"))); buf.append(sal_Unicode(' ')); - rtl::OUString version; - getConfigurationItem( - xConfigurationProvider, - UNISTRING("org.openoffice.Setup/Product"), - UNISTRING("ooSetupVersion")) >>= version; - buf.append(version); + buf.append( + getConfigurationItem( + xConfigurationProvider, + UNISTRING("org.openoffice.Setup/Product"), + UNISTRING("ooSetupVersion"))); rtl::OUString edition( UNISTRING( "${${BRAND_BASE_DIR}/program/edition/edition.ini:" @@ -366,11 +364,11 @@ UpdateInformationProvider::UpdateInforma buf.append(sal_Unicode(' ')); buf.append(edition); } - rtl::OUString extension; - getConfigurationItem( - xConfigurationProvider, - UNISTRING("org.openoffice.Setup/Product"), - UNISTRING("ooSetupExtension")) >>= extension; + rtl::OUString extension( + getConfigurationItem( + xConfigurationProvider, + UNISTRING("org.openoffice.Setup/Product"), + UNISTRING("ooSetupExtension"))); if (extension.getLength() != 0) { buf.append(sal_Unicode(' ')); buf.append(extension); @@ -404,13 +402,13 @@ UpdateInformationProvider::UpdateInforma i += product.getLength(); } - m_aRequestHeaderList[0].Name = UNISTRING("Accept-Language"); - m_aRequestHeaderList[0].Value = getConfigurationItem( xConfigurationProvider, UNISTRING("org.openoffice.Setup/L10N"), UNISTRING("ooLocale") ); + m_aRequestHeaderList[0].First = UNISTRING("Accept-Language"); + m_aRequestHeaderList[0].Second = getConfigurationItem( xConfigurationProvider, UNISTRING("org.openoffice.Setup/L10N"), UNISTRING("ooLocale") ); if( aUserAgent.getLength() > 0 ) { m_aRequestHeaderList.realloc(2); - m_aRequestHeaderList[1].Name = UNISTRING("User-Agent"); - m_aRequestHeaderList[1].Value = uno::makeAny(aUserAgent); + m_aRequestHeaderList[1].First = UNISTRING("User-Agent"); + m_aRequestHeaderList[1].Second = aUserAgent; } } @@ -451,9 +449,10 @@ UpdateInformationProvider::~UpdateInform //------------------------------------------------------------------------------ -uno::Any +rtl::OUString UpdateInformationProvider::getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, rtl::OUString const & node, rtl::OUString const & item) { + rtl::OUString sRet; beans::PropertyValue aProperty; aProperty.Name = UNISTRING("nodepath"); aProperty.Value = uno::makeAny(node); @@ -467,7 +466,8 @@ UpdateInformationProvider::getConfigurat aArgumentList ), uno::UNO_QUERY_THROW); - return xNameAccess->getByName(item); + xNameAccess->getByName(item) >>= sRet; + return sRet; } //------------------------------------------------------------------------------ Modified: openoffice/trunk/main/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl URL: http://svn.apache.org/viewvc/openoffice/trunk/main/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl?rev=1460362&r1=1460361&r2=1460362&view=diff ============================================================================== --- openoffice/trunk/main/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl (original) +++ openoffice/trunk/main/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl Sun Mar 24 13:22:48 2013 @@ -23,7 +23,7 @@ #define __com_sun_star_ucb_XWebDAVCommandEnvironment_idl__ #include <com/sun/star/ucb/XCommandEnvironment.idl> -#include <com/sun/star/beans/NamedValue.idl> +#include <com/sun/star/beans/StringPair.idl> module com { module sun { module star { module ucb { @@ -45,9 +45,8 @@ published interface XWebDAVCommandEnviro @return A sequence of header name, header value pairs. The header names must be the plain names and contain no trailing ":". - The header value must be an Any containing a string. */ - sequence<com::sun::star::beans::NamedValue> getUserRequestHeaders( + sequence<com::sun::star::beans::StringPair> getUserRequestHeaders( [in] string aURI, [in] string aMethod); }; Modified: openoffice/trunk/main/offapi/type_reference/typelibrary_history.txt URL: http://svn.apache.org/viewvc/openoffice/trunk/main/offapi/type_reference/typelibrary_history.txt?rev=1460362&r1=1460361&r2=1460362&view=diff ============================================================================== --- openoffice/trunk/main/offapi/type_reference/typelibrary_history.txt (original) +++ openoffice/trunk/main/offapi/type_reference/typelibrary_history.txt Sun Mar 24 13:22:48 2013 @@ -202,3 +202,7 @@ 23/03/2013 (arielch): TaskID=121944 css::ucb::XWebDAVCommandEnvironment should be derived from css::ucb::XCommandEnvironment +23/03/2013 (arielch): TaskID=121945 + css::ucb::XWebDAVCommandEnvironment::getUserRequestHeaders() should return a + sequence of css::beans::StringPair + Modified: openoffice/trunk/main/offapi/type_reference/types.rdb URL: http://svn.apache.org/viewvc/openoffice/trunk/main/offapi/type_reference/types.rdb?rev=1460362&r1=1460361&r2=1460362&view=diff ============================================================================== Binary files - no diff available. Modified: openoffice/trunk/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx?rev=1460362&r1=1460361&r2=1460362&view=diff ============================================================================== --- openoffice/trunk/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx (original) +++ openoffice/trunk/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx Sun Mar 24 13:22:48 2013 @@ -1126,24 +1126,14 @@ void DAVResourceAccess::getUserRequestHe if ( !xDAVEnv.is() ) return; - uno::Sequence< beans::NamedValue > aRequestHeaders + uno::Sequence< beans::StringPair > aRequestHeaders = xDAVEnv->getUserRequestHeaders( rURI, rMethod ); for ( sal_Int32 n = 0; n < aRequestHeaders.getLength(); ++n ) { - rtl::OUString aValue; - sal_Bool isString = aRequestHeaders[ n ].Value >>= aValue; - - if ( !isString ) - { - OSL_ENSURE( isString, - "DAVResourceAccess::getUserRequestHeaders :" - "Value is not a string! Ignoring..." ); - continue; - } - rRequestHeaders.push_back( - DAVRequestHeader( aRequestHeaders[ n ].Name, aValue ) ); + DAVRequestHeader( aRequestHeaders[ n ].First, + aRequestHeaders[ n ].Second ) ); } }