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 .
22 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVRESOURCEACCESS_HXX
23 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVRESOURCEACCESS_HXX
26 #include <rtl/ustring.hxx>
27 #include <rtl/ref.hxx>
28 #include <osl/mutex.hxx>
29 #include <com/sun/star/io/XInputStream.hpp>
30 #include <com/sun/star/io/XOutputStream.hpp>
31 #include <com/sun/star/ucb/Lock.hpp>
32 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
33 #include <com/sun/star/ucb/WebDAVHTTPMethod.hpp>
34 #include "DAVAuthListener.hxx"
35 #include "DAVException.hxx"
36 #include "DAVSession.hxx"
37 #include "DAVResource.hxx"
38 #include "DAVTypes.hxx"
39 #include "SerfUri.hxx"
41 namespace http_dav_ucp
44 class DAVSessionFactory
;
46 class DAVResourceAccess
51 rtl::Reference
< DAVSession
> m_xSession
;
52 rtl::Reference
< DAVSessionFactory
> m_xSessionFactory
;
53 com::sun::star::uno::Reference
<
54 com::sun::star::uno::XComponentContext
> m_xContext
;
55 std::vector
< SerfUri
> m_aRedirectURIs
;
58 DAVResourceAccess() : m_xSessionFactory( 0 ) {}
59 DAVResourceAccess( const com::sun::star::uno::Reference
<
60 com::sun::star::uno::XComponentContext
> & rContext
,
62 DAVSessionFactory
> const & rSessionFactory
,
63 const OUString
& rURL
);
64 DAVResourceAccess( const DAVResourceAccess
& rOther
);
66 DAVResourceAccess
& operator=( const DAVResourceAccess
& rOther
);
68 void setURL( const OUString
& rNewURL
)
69 throw ( DAVException
);
73 const OUString
& getURL() const { return m_aURL
; }
75 rtl::Reference
< DAVSessionFactory
> getSessionFactory() const
76 { return m_xSessionFactory
; }
83 PROPFIND( const Depth nDepth
,
84 const std::vector
< OUString
> & rPropertyNames
,
85 std::vector
< DAVResource
> & rResources
,
86 const com::sun::star::uno::Reference
<
87 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
88 throw ( DAVException
);
92 PROPFIND( const Depth nDepth
,
93 std::vector
< DAVResourceInfo
> & rResInfo
,
94 const com::sun::star::uno::Reference
<
95 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
96 throw ( DAVException
);
99 PROPPATCH( const std::vector
< ProppatchValue
> & rValues
,
100 const com::sun::star::uno::Reference
<
101 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
102 throw ( DAVException
);
105 HEAD( const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
106 DAVResource
& rResource
,
107 const com::sun::star::uno::Reference
<
108 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
109 throw ( DAVException
);
111 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>
112 GET( const com::sun::star::uno::Reference
<
113 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
114 throw ( DAVException
);
117 GET( com::sun::star::uno::Reference
<
118 com::sun::star::io::XOutputStream
> & rStream
,
119 const com::sun::star::uno::Reference
<
120 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
121 throw ( DAVException
);
123 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>
124 GET( const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
125 DAVResource
& rResource
,
126 const com::sun::star::uno::Reference
<
127 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
128 throw ( DAVException
);
130 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>
131 GET( DAVRequestHeaders
& rRequestHeaders
,
132 const std::vector
< rtl::OUString
> & rHeaderNames
, // empty == 'all'
133 DAVResource
& rResource
,
134 const com::sun::star::uno::Reference
<
135 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
136 throw ( DAVException
);
139 GET( com::sun::star::uno::Reference
<
140 com::sun::star::io::XOutputStream
> & rStream
,
141 const std::vector
< OUString
> & rHeaderNames
, // empty == 'all'
142 DAVResource
& rResource
,
143 const com::sun::star::uno::Reference
<
144 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
145 throw ( DAVException
);
148 PUT( const com::sun::star::uno::Reference
<
149 com::sun::star::io::XInputStream
> & rStream
,
150 const com::sun::star::uno::Reference
<
151 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
152 throw ( DAVException
);
154 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>
155 POST( const OUString
& rContentType
,
156 const OUString
& rReferer
,
157 const com::sun::star::uno::Reference
<
158 com::sun::star::io::XInputStream
> & rInputStream
,
159 const com::sun::star::uno::Reference
<
160 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
161 throw ( DAVException
);
164 POST( const OUString
& rContentType
,
165 const OUString
& rReferer
,
166 const com::sun::star::uno::Reference
<
167 com::sun::star::io::XInputStream
> & rInputStream
,
168 com::sun::star::uno::Reference
<
169 com::sun::star::io::XOutputStream
> & rOutputStream
,
170 const com::sun::star::uno::Reference
<
171 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
172 throw ( DAVException
);
175 MKCOL( const com::sun::star::uno::Reference
<
176 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
177 throw ( DAVException
);
180 COPY( const OUString
& rSourcePath
,
181 const OUString
& rDestinationURI
,
183 const com::sun::star::uno::Reference
<
184 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
185 throw ( DAVException
);
188 MOVE( const OUString
& rSourcePath
,
189 const OUString
& rDestinationURI
,
191 const com::sun::star::uno::Reference
<
192 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
193 throw ( DAVException
);
196 DESTROY( const com::sun::star::uno::Reference
<
197 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
198 throw ( DAVException
);
202 LOCK( com::sun::star::ucb::Lock
& inLock
,
203 const com::sun::star::uno::Reference
<
204 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
205 throw( DAVException
);
207 #if 0 // currently not used, but please don't remove code
208 // refresh existing lock.
210 LOCK( sal_Int64 nTimeout
,
211 const com::sun::star::uno::Reference
<
212 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
213 throw ( DAVException
);
217 UNLOCK( const com::sun::star::uno::Reference
<
218 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
219 throw ( DAVException
);
223 throw ( DAVException
);
227 getUserRequestHeaders(
228 const com::sun::star::uno::Reference
<
229 com::sun::star::ucb::XCommandEnvironment
> & xEnv
,
230 const rtl::OUString
& rURI
,
231 com::sun::star::ucb::WebDAVHTTPMethod eMethod
,
232 DAVRequestHeaders
& rRequestHeaders
);
235 const OUString
& getRequestURI() const;
236 bool detectRedirectCycle( const OUString
& rRedirectURL
)
237 throw ( DAVException
);
238 bool handleException( DAVException
& e
, int errorCount
)
239 throw ( DAVException
);
241 throw ( DAVException
);
244 } // namespace http_dav_ucp
246 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVRESOURCEACCESS_HXX
248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */