1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVRESOURCEACCESS_HXX
22 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVRESOURCEACCESS_HXX
25 #include <rtl/ustring.hxx>
26 #include <rtl/ref.hxx>
27 #include <osl/mutex.hxx>
28 #include <com/sun/star/io/XInputStream.hpp>
29 #include <com/sun/star/io/XOutputStream.hpp>
30 #include <com/sun/star/ucb/Lock.hpp>
31 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
32 #include <com/sun/star/ucb/WebDAVHTTPMethod.hpp>
33 #include "DAVAuthListener.hxx"
34 #include "DAVException.hxx"
35 #include "DAVSession.hxx"
36 #include "DAVResource.hxx"
37 #include "DAVTypes.hxx"
38 #include "SerfUri.hxx"
40 namespace http_dav_ucp
43 class DAVSessionFactory
;
45 class DAVResourceAccess
50 rtl::Reference
< DAVSession
> m_xSession
;
51 rtl::Reference
< DAVSessionFactory
> m_xSessionFactory
;
52 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
53 std::vector
< SerfUri
> m_aRedirectURIs
;
56 DAVResourceAccess() = default;
57 DAVResourceAccess( const css::uno::Reference
< css::uno::XComponentContext
> & rContext
,
58 rtl::Reference
< DAVSessionFactory
> const & rSessionFactory
,
59 const OUString
& rURL
);
60 DAVResourceAccess( const DAVResourceAccess
& rOther
);
62 DAVResourceAccess
& operator=( const DAVResourceAccess
& rOther
);
64 /// @throws DAVException
65 void setURL( const OUString
& rNewURL
);
69 const OUString
& getURL() const { return m_aURL
; }
71 rtl::Reference
< DAVSessionFactory
> getSessionFactory() const
72 { return m_xSessionFactory
; }
78 /// @throws DAVException
80 PROPFIND( const Depth nDepth
,
81 const std::vector
< OUString
> & rPropertyNames
,
82 std::vector
< DAVResource
> & rResources
,
83 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
86 /// @throws DAVException
88 PROPFIND( const Depth nDepth
,
89 std::vector
< DAVResourceInfo
> & rResInfo
,
90 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
92 /// @throws DAVException
94 PROPPATCH( const std::vector
< ProppatchValue
> & rValues
,
95 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
97 /// @throws DAVException
99 HEAD( const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
100 DAVResource
& rResource
,
101 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
103 /// @throws DAVException
104 css::uno::Reference
< css::io::XInputStream
>
105 GET( const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
107 /// @throws DAVException
109 GET( css::uno::Reference
< css::io::XOutputStream
> & rStream
,
110 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
112 /// @throws DAVException
113 css::uno::Reference
< css::io::XInputStream
>
114 GET( const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
115 DAVResource
& rResource
,
116 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
118 /// @throws DAVException
119 css::uno::Reference
< css::io::XInputStream
>
120 GET( DAVRequestHeaders
& rRequestHeaders
,
121 const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
122 DAVResource
& rResource
,
123 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
125 /// @throws DAVException
127 GET( css::uno::Reference
< css::io::XOutputStream
> & rStream
,
128 const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
129 DAVResource
& rResource
,
130 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
132 /// @throws DAVException
134 PUT( const css::uno::Reference
< css::io::XInputStream
> & rStream
,
135 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
137 /// @throws DAVException
138 css::uno::Reference
< css::io::XInputStream
>
139 POST( const OUString
& rContentType
,
140 const OUString
& rReferer
,
141 const css::uno::Reference
< css::io::XInputStream
> & rInputStream
,
142 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
144 /// @throws DAVException
146 POST( const OUString
& rContentType
,
147 const OUString
& rReferer
,
148 const css::uno::Reference
< css::io::XInputStream
> & rInputStream
,
149 css::uno::Reference
< css::io::XOutputStream
> & rOutputStream
,
150 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
152 /// @throws DAVException
154 MKCOL( const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
156 /// @throws DAVException
158 COPY( const OUString
& rSourcePath
,
159 const OUString
& rDestinationURI
,
161 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
163 /// @throws DAVException
165 MOVE( const OUString
& rSourcePath
,
166 const OUString
& rDestinationURI
,
168 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
170 /// @throws DAVException
172 DESTROY( const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
175 /// @throws DAVException
177 LOCK( css::ucb::Lock
& inLock
,
178 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
180 /// @throws DAVException
182 UNLOCK( const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
184 /// @throws DAVException
190 getUserRequestHeaders(
191 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
,
192 const OUString
& rURI
,
193 css::ucb::WebDAVHTTPMethod eMethod
,
194 DAVRequestHeaders
& rRequestHeaders
);
197 const OUString
& getRequestURI() const;
198 /// @throws DAVException
199 bool detectRedirectCycle( const OUString
& rRedirectURL
);
200 /// @throws DAVException
201 bool handleException( DAVException
& e
, int errorCount
);
202 /// @throws DAVException
206 } // namespace http_dav_ucp
208 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVRESOURCEACCESS_HXX
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */