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 .
24 #include <rtl/ustring.hxx>
25 #include <rtl/ref.hxx>
26 #include <osl/mutex.hxx>
27 #include <com/sun/star/io/XInputStream.hpp>
28 #include <com/sun/star/io/XOutputStream.hpp>
29 #include <com/sun/star/beans/NamedValue.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 "CurlUri.hxx"
40 namespace http_dav_ucp
43 class DAVSessionFactory
;
45 class DAVResourceAccess
50 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
> m_aFlags
;
51 rtl::Reference
< DAVSession
> m_xSession
;
52 rtl::Reference
< DAVSessionFactory
> m_xSessionFactory
;
53 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
54 std::vector
<CurlUri
> m_aRedirectURIs
;
57 DAVResourceAccess() = default;
58 DAVResourceAccess( css::uno::Reference
< css::uno::XComponentContext
> xContext
,
59 rtl::Reference
< DAVSessionFactory
> xSessionFactory
,
61 DAVResourceAccess( const DAVResourceAccess
& rOther
);
63 DAVResourceAccess
& operator=( const DAVResourceAccess
& rOther
);
65 /// @throws DAVException
66 void setFlags( const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& rFlags
);
68 /// @throws DAVException
69 void setURL( const OUString
& rNewURL
);
73 const OUString
& getURL() const { return m_aURL
; }
75 const rtl::Reference
< DAVSessionFactory
> & getSessionFactory() const
76 { return m_xSessionFactory
; }
80 /// @throws DAVException
83 DAVOptions
& rOptions
,
84 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
87 /// @throws DAVException
89 PROPFIND( const Depth nDepth
,
90 const std::vector
< OUString
> & rPropertyNames
,
91 std::vector
< DAVResource
> & rResources
,
92 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
95 /// @throws DAVException
97 PROPFIND( const Depth nDepth
,
98 std::vector
< DAVResourceInfo
> & rResInfo
,
99 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
101 /// @throws DAVException
103 PROPPATCH( const std::vector
< ProppatchValue
> & rValues
,
104 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
106 /// @throws DAVException
108 HEAD( const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
109 DAVResource
& rResource
,
110 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
112 /// @throws DAVException
113 css::uno::Reference
< css::io::XInputStream
>
114 GET( const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
116 /// @throws DAVException
118 GET( css::uno::Reference
< css::io::XOutputStream
> & rStream
,
119 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
121 /// @throws DAVException
122 css::uno::Reference
< css::io::XInputStream
>
123 GET( const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
124 DAVResource
& rResource
,
125 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
127 /// used as HEAD substitute when HEAD is not implemented on server
128 /// @throws DAVException
130 GET0( DAVRequestHeaders
& rRequestHeaders
,
131 const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
132 DAVResource
& rResource
,
133 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
135 /// @throws DAVException
137 GET( css::uno::Reference
< css::io::XOutputStream
> & rStream
,
138 const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
139 DAVResource
& rResource
,
140 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
142 /// @throws DAVException
144 PUT( const css::uno::Reference
< css::io::XInputStream
> & rStream
,
145 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
147 /// @throws DAVException
148 css::uno::Reference
< css::io::XInputStream
>
149 POST( const OUString
& rContentType
,
150 const OUString
& rReferer
,
151 const css::uno::Reference
< css::io::XInputStream
> & rInputStream
,
152 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
154 /// @throws DAVException
156 POST( const OUString
& rContentType
,
157 const OUString
& rReferer
,
158 const css::uno::Reference
< css::io::XInputStream
> & rInputStream
,
159 css::uno::Reference
< css::io::XOutputStream
> & rOutputStream
,
160 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
162 /// @throws DAVException
164 MKCOL( const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
166 /// @throws DAVException
168 COPY( const OUString
& rSourcePath
,
169 const OUString
& rDestinationURI
,
171 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
173 /// @throws DAVException
175 MOVE( const OUString
& rSourcePath
,
176 const OUString
& rDestinationURI
,
178 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
180 /// @throws DAVException
182 DESTROY( const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
185 /// @throws DAVException
187 LOCK( css::ucb::Lock
& inLock
,
188 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
190 /// @throws DAVException
192 UNLOCK( const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
);
194 /// @throws DAVException
200 getUserRequestHeaders(
201 const css::uno::Reference
< css::ucb::XCommandEnvironment
> & xEnv
,
202 const OUString
& rURI
,
203 css::ucb::WebDAVHTTPMethod eMethod
,
204 DAVRequestHeaders
& rRequestHeaders
);
206 /// @throws DAVException
207 bool handleException(DAVException
const& e
, int errorCount
);
210 const OUString
& getRequestURI() const;
211 /// @throws DAVException
212 bool detectRedirectCycle(::std::u16string_view rRedirectURL
);
213 /// @throws DAVException
217 } // namespace http_dav_ucp
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */