summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorKai Sommerfeld <kso@openoffice.org>2001-10-25 12:47:41 +0000
committerKai Sommerfeld <kso@openoffice.org>2001-10-25 12:47:41 +0000
commitd479a2d67f1242a557b8d8288c7cf544afdd18f4 (patch)
tree32daea4a85270c5a41c7a1e5d2f701178a9d10c5 /ucb
parent8dea1b9e0e01ce78a5c761559608b196616237d0 (diff)
#92937# - Improved redirection support.
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav/ContentProperties.cxx16
-rw-r--r--ucb/source/ucp/webdav/ContentProperties.hxx6
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.cxx16
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.hxx18
-rw-r--r--ucb/source/ucp/webdav/DAVSession.hxx10
-rw-r--r--ucb/source/ucp/webdav/NeonSession.cxx29
-rw-r--r--ucb/source/ucp/webdav/NeonSession.hxx28
-rw-r--r--ucb/source/ucp/webdav/webdavdatasupplier.cxx13
8 files changed, 101 insertions, 35 deletions
diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx
index b1aed6b778e5..5b63d75fcce1 100644
--- a/ucb/source/ucp/webdav/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav/ContentProperties.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ContentProperties.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: kso $ $Date: 2001-09-06 10:37:56 $
+ * last change: $Author: kso $ $Date: 2001-10-25 13:47:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,7 +98,8 @@ using namespace webdav_ucp;
//=========================================================================
ContentProperties::ContentProperties( const DAVResource& rResource )
-: pIsDocument( 0 ),
+: bTrailingSlash( sal_False ),
+ pIsDocument( 0 ),
pIsFolder( 0 ),
pSize( 0 ),
pDateCreated( 0 ),
@@ -223,12 +224,20 @@ ContentProperties::ContentProperties( const DAVResource& rResource )
}
++it;
}
+
+ if ( rResource.uri.getStr()[ rResource.uri.getLength() - 1 ]
+ == sal_Unicode( '/' ) )
+ {
+// if ( pIsFolder && *pIsFolder )
+ bTrailingSlash = sal_True;
+ }
}
//=========================================================================
ContentProperties::ContentProperties(
const rtl::OUString & rTitle, sal_Bool bFolder )
: aTitle( rTitle ),
+ bTrailingSlash( sal_False ),
pIsDocument( new sal_Bool( !bFolder ) ),
pIsFolder( new sal_Bool( bFolder ) ),
pSize( 0 ),
@@ -252,6 +261,7 @@ ContentProperties::ContentProperties(
//=========================================================================
ContentProperties::ContentProperties( const rtl::OUString & rTitle )
: aTitle( rTitle ),
+ bTrailingSlash( sal_False ),
pIsDocument( 0 ),
pIsFolder( 0 ),
pSize( 0 ),
diff --git a/ucb/source/ucp/webdav/ContentProperties.hxx b/ucb/source/ucp/webdav/ContentProperties.hxx
index 098103f61937..7a035f609d63 100644
--- a/ucb/source/ucp/webdav/ContentProperties.hxx
+++ b/ucb/source/ucp/webdav/ContentProperties.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ContentProperties.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: kso $ $Date: 2001-09-06 10:37:56 $
+ * last change: $Author: kso $ $Date: 2001-10-25 13:47:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -126,6 +126,8 @@ public:
// Mandatory UCB props.
::rtl::OUString aTitle; // Title
::rtl::OUString aEscapedTitle; // escaped Title
+ sal_Bool bTrailingSlash;
+
sal_Bool * pIsFolder;
sal_Bool * pIsDocument;
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index f3d0084fb7db..575aefec223d 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVResourceAccess.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: kso $ $Date: 2001-07-03 10:10:05 $
+ * last change: $Author: kso $ $Date: 2001-10-25 13:47:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -188,6 +188,7 @@ DAVResourceAccess::DAVResourceAccess(
const rtl::OUString & rURL )
throw( DAVException )
: m_aURL( rURL ),
+ m_bRedirected( sal_False ),
m_xSMgr( rSMgr ),
m_pSessionFactory( pSessionFactory )
{
@@ -198,6 +199,7 @@ void DAVResourceAccess::setURL( const rtl::OUString & rNewURL )
throw( DAVException )
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ m_bRedirected = sal_True;
m_aURL = rNewURL;
m_aPath = rtl::OUString(); // Next initialize() will create new session.
}
@@ -580,6 +582,15 @@ void DAVResourceAccess::UNLOCK ( const ucb::Lock & rLock,
}
//=========================================================================
+// DAVRedirectionListener method
+// virtual
+void DAVResourceAccess::redirectNotify( const rtl::OUString & rFromURI,
+ const rtl::OUString & rToURI )
+{
+ setURL( rToURI );
+}
+
+//=========================================================================
// init dav session and path
void DAVResourceAccess::initialize()
throw ( DAVException )
@@ -600,6 +611,7 @@ void DAVResourceAccess::initialize()
m_xSession
= m_pSessionFactory->createDAVSession( m_aURL, m_xSMgr );
m_xSession->setServerAuthListener( &webdavAuthListener );
+ m_xSession->setRedirectionListener( this );
}
catch ( DAVException const & )
{
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.hxx b/ucb/source/ucp/webdav/DAVResourceAccess.hxx
index 3f81c736749c..bd4d14e37f03 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.hxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVResourceAccess.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: kso $ $Date: 2001-07-03 10:10:06 $
+ * last change: $Author: kso $ $Date: 2001-10-25 13:47:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,6 +91,9 @@
#ifndef _DAVAUTHLISTENER_HXX_
#include "DAVAuthListener.hxx"
#endif
+#ifndef _DAVREDIRECTIONLISTENER_HXX_
+#include "DAVRedirectionListener.hxx"
+#endif
#ifndef _DAVEXCEPTION_HXX_
#include "DAVException.hxx"
#endif
@@ -109,18 +112,19 @@ namespace webdav_ucp
class DAVSessionFactory;
-class DAVResourceAccess
+class DAVResourceAccess : public DAVRedirectionListener
{
osl::Mutex m_aMutex;
rtl::OUString m_aURL;
rtl::OUString m_aPath;
rtl::Reference< DAVSession > m_xSession;
+ sal_Bool m_bRedirected;
DAVSessionFactory* m_pSessionFactory;
com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
public:
- DAVResourceAccess() : m_pSessionFactory( 0 ) {}
+ DAVResourceAccess() : m_pSessionFactory( 0 ), m_bRedirected( sal_False ) {}
DAVResourceAccess( const com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory > & rSMgr,
DAVSessionFactory* pSessionFactory,
@@ -130,6 +134,8 @@ public:
void setURL( const rtl::OUString & rNewURL )
throw( DAVException );
+ const rtl::OUString & getURL() const { return m_aURL; }
+
DAVSessionFactory * getSessionFactory() const { return m_pSessionFactory; }
// DAV methods
@@ -241,6 +247,10 @@ public:
com::sun::star::ucb::XCommandEnvironment > & xEnv )
throw( DAVException );
+ // DAVRedirectionListener methods
+ virtual void redirectNotify( const rtl::OUString & rFromURI,
+ const rtl::OUString & rToURI );
+
private:
sal_Bool handleException( DAVException & e );
void initialize()
diff --git a/ucb/source/ucp/webdav/DAVSession.hxx b/ucb/source/ucp/webdav/DAVSession.hxx
index c395add24207..f9242eae1c41 100644
--- a/ucb/source/ucp/webdav/DAVSession.hxx
+++ b/ucb/source/ucp/webdav/DAVSession.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVSession.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: kso $ $Date: 2001-06-27 08:57:37 $
+ * last change: $Author: kso $ $Date: 2001-10-25 13:47:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,6 +99,7 @@ namespace webdav_ucp
{
class DAVAuthListener;
+class DAVRedirectionListener;
class DAVSession : public ::cppu::OWeakObject
{
@@ -110,6 +111,11 @@ public:
virtual void setServerAuthListener(DAVAuthListener * inDAVAuthListener) = 0;
virtual void setProxyAuthListener(DAVAuthListener * inDAVAuthListener ) = 0;
+ // redirection notification
+ //
+ virtual void setRedirectionListener(
+ DAVRedirectionListener * inRedirectionListener) = 0;
+
// DAV methods
//
diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx
index 1913d0186850..96db48393669 100644
--- a/ucb/source/ucp/webdav/NeonSession.cxx
+++ b/ucb/source/ucp/webdav/NeonSession.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: NeonSession.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: mba $ $Date: 2001-09-14 13:46:58 $
+ * last change: $Author: kso $ $Date: 2001-10-25 13:47:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,9 @@
#ifndef _DAVAUTHLISTENER_HXX_
#include "DAVAuthListener.hxx"
#endif
+#ifndef _DAVREDIRECTIONLISTENER_HXX_
+#include "DAVRedirectionListener.hxx"
+#endif
#ifndef _NEONTYPES_HXX_
#include "NeonTypes.hxx"
#endif
@@ -178,7 +181,9 @@ NeonSession::NeonSession( DAVSessionFactory* pSessionFactory,
const rtl::OUString& inUri,
const ProxyConfig& rProxyCfg )
throw ( DAVException )
-: m_pSessionFactory( pSessionFactory )
+: mListener( 0 ),
+ mRedirectionListener( 0 ),
+ m_pSessionFactory( pSessionFactory )
{
// @@@ We need to keep the char buffer for hostname and proxyname
// for the whole session lifetime because neon only stores a pointer
@@ -270,6 +275,12 @@ void NeonSession::setProxyAuthListener(DAVAuthListener * inDAVAuthListener)
// Note: Content is currently not using proxy auth
}
+void NeonSession::setRedirectionListener(
+ DAVRedirectionListener * inRedirectionListener )
+{
+ mRedirectionListener = inRedirectionListener;
+}
+
// -------------------------------------------------------------------
// OPTIONS
// -------------------------------------------------------------------
@@ -1158,7 +1169,17 @@ int NeonSession::RedirectConfirm(
void NeonSession::RedirectNotify(
void * userdata, const char * src, const char * dest )
{
-// NeonSession * theSession = ( NeonSession * )userdata;
+ NeonSession * pSession = static_cast< NeonSession * >( userdata );
+ if ( pSession )
+ {
+ if ( pSession->mRedirectionListener )
+ {
+ pSession->mRedirectionListener->redirectNotify(
+ rtl::OUString(),
+ rtl::OUString::createFromAscii(
+ http_redirect_location( pSession->mHttpSession ) ) );
+ }
+ }
}
// static
diff --git a/ucb/source/ucp/webdav/NeonSession.hxx b/ucb/source/ucp/webdav/NeonSession.hxx
index 1b7fa6ab9e4a..6d71d638730a 100644
--- a/ucb/source/ucp/webdav/NeonSession.hxx
+++ b/ucb/source/ucp/webdav/NeonSession.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: NeonSession.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: sb $ $Date: 2001-08-08 10:04:35 $
+ * last change: $Author: kso $ $Date: 2001-10-25 13:47:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,17 +86,18 @@ namespace webdav_ucp
class NeonSession : public DAVSession
{
private:
- osl::Mutex mMutex;
- rtl::OUString mScheme;
- rtl::OUString mHostName;
- rtl::OUString mProxyName;
- sal_Int32 mPort;
- sal_Int32 mProxyPort;
- HttpSession * mHttpSession;
- DAVAuthListener * mListener;
- DAVSessionFactory * m_pSessionFactory;
+ osl::Mutex mMutex;
+ rtl::OUString mScheme;
+ rtl::OUString mHostName;
+ rtl::OUString mProxyName;
+ sal_Int32 mPort;
+ sal_Int32 mProxyPort;
+ HttpSession * mHttpSession;
+ DAVAuthListener * mListener;
+ DAVRedirectionListener * mRedirectionListener;
+ DAVSessionFactory * m_pSessionFactory;
// Note: Uncomment the following if locking support is required
- // NeonLockSession * mNeonLockSession;
+ // NeonLockSession * mNeonLockSession;
static sal_Bool sSockInited;
static http_request_hooks mRequestHooks;
@@ -136,6 +137,9 @@ class NeonSession : public DAVSession
virtual void setServerAuthListener(DAVAuthListener * inDAVAuthListener);
virtual void setProxyAuthListener(DAVAuthListener * inDAVAuthListener);
+ virtual void setRedirectionListener(
+ DAVRedirectionListener * inRedirectionListener );
+
virtual void OPTIONS( const ::rtl::OUString & inPath,
DAVCapabilities & outCapabilities,
const com::sun::star::uno::Reference<
diff --git a/ucb/source/ucp/webdav/webdavdatasupplier.cxx b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
index 54016526b3f9..1cc2a60c3843 100644
--- a/ucb/source/ucp/webdav/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: webdavdatasupplier.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: kso $ $Date: 2001-09-06 08:43:38 $
+ * last change: $Author: kso $ $Date: 2001-10-25 13:47:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -208,8 +208,7 @@ rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
if ( getResult( nIndex ) )
{
- rtl::OUString aId
- = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
+ rtl::OUString aId = m_pImpl->m_xContent->getResourceAccess().getURL();
const ContentProperties& props
= *( m_pImpl->m_aResults[ nIndex ]->pData );
@@ -219,6 +218,9 @@ rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
aId += props.aEscapedTitle;
+ if ( props.bTrailingSlash )
+ aId += rtl::OUString::createFromAscii( "/" );
+
m_pImpl->m_aResults[ nIndex ]->aId = aId;
return aId;
}
@@ -445,8 +447,7 @@ sal_Bool DataSupplier::getData()
return sal_False;
}
- NeonUri aURI(
- m_pImpl->m_xContent->getIdentifier()->getContentIdentifier() );
+ NeonUri aURI( m_pImpl->m_xContent->getResourceAccess().getURL() );
rtl::OUString aPath = aURI.GetPath();
if ( aPath.getStr()[ aPath.getLength() - 1 ] == sal_Unicode( '/' ) )
aPath = aPath.copy( 0, aPath.getLength() - 1 );