xref: /AOO41X/main/ucb/source/ucp/webdav/SerfLockRefreshProcImpl.cxx (revision 3edf699282957a8d2e0e344ed73ba96dfb5a45a4)
1*3edf6992SAndrea Pescetti /**************************************************************
2*3edf6992SAndrea Pescetti  *
3*3edf6992SAndrea Pescetti  * Licensed to the Apache Software Foundation (ASF) under one
4*3edf6992SAndrea Pescetti  * or more contributor license agreements.  See the NOTICE file
5*3edf6992SAndrea Pescetti  * distributed with this work for additional information
6*3edf6992SAndrea Pescetti  * regarding copyright ownership.  The ASF licenses this file
7*3edf6992SAndrea Pescetti  * to you under the Apache License, Version 2.0 (the
8*3edf6992SAndrea Pescetti  * "License"); you may not use this file except in compliance
9*3edf6992SAndrea Pescetti  * with the License.  You may obtain a copy of the License at
10*3edf6992SAndrea Pescetti  *
11*3edf6992SAndrea Pescetti  *   http://www.apache.org/licenses/LICENSE-2.0
12*3edf6992SAndrea Pescetti  *
13*3edf6992SAndrea Pescetti  * Unless required by applicable law or agreed to in writing,
14*3edf6992SAndrea Pescetti  * software distributed under the License is distributed on an
15*3edf6992SAndrea Pescetti  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3edf6992SAndrea Pescetti  * KIND, either express or implied.  See the License for the
17*3edf6992SAndrea Pescetti  * specific language governing permissions and limitations
18*3edf6992SAndrea Pescetti  * under the License.
19*3edf6992SAndrea Pescetti  *
20*3edf6992SAndrea Pescetti  *************************************************************/
21*3edf6992SAndrea Pescetti 
22*3edf6992SAndrea Pescetti // MARKER(update_precomp.py): autogen include statement, do not remove
23*3edf6992SAndrea Pescetti #include "precompiled_ucb.hxx"
24*3edf6992SAndrea Pescetti 
25*3edf6992SAndrea Pescetti #include "SerfTypes.hxx"
26*3edf6992SAndrea Pescetti #include "SerfLockRefreshProcImpl.hxx"
27*3edf6992SAndrea Pescetti #include "DAVProperties.hxx"
28*3edf6992SAndrea Pescetti 
29*3edf6992SAndrea Pescetti #include "webdavresponseparser.hxx"
30*3edf6992SAndrea Pescetti #include <serf/serf.h>
31*3edf6992SAndrea Pescetti #include <rtl/ustrbuf.hxx>
32*3edf6992SAndrea Pescetti #include <apr/apr_strings.h>
33*3edf6992SAndrea Pescetti 
34*3edf6992SAndrea Pescetti namespace http_dav_ucp
35*3edf6992SAndrea Pescetti {
36*3edf6992SAndrea Pescetti 
37*3edf6992SAndrea Pescetti SerfLockRefreshProcImpl::SerfLockRefreshProcImpl( const char* inSourcePath,
38*3edf6992SAndrea Pescetti                                                   const DAVRequestHeaders& inRequestHeaders, // on debug the header look empty
39*3edf6992SAndrea Pescetti                                                   const ucb::Lock& inLock,
40*3edf6992SAndrea Pescetti                                                   const char* inLockToken,
41*3edf6992SAndrea Pescetti                                                   const char* inTimeout,
42*3edf6992SAndrea Pescetti                                           DAVPropertyValue & outLock)
43*3edf6992SAndrea Pescetti     : SerfLockReqProcImpl( inSourcePath, inRequestHeaders, inLock, inTimeout, outLock )
44*3edf6992SAndrea Pescetti     , mpLockToken( inLockToken )
45*3edf6992SAndrea Pescetti {
46*3edf6992SAndrea Pescetti }
47*3edf6992SAndrea Pescetti 
48*3edf6992SAndrea Pescetti SerfLockRefreshProcImpl::~SerfLockRefreshProcImpl()
49*3edf6992SAndrea Pescetti {
50*3edf6992SAndrea Pescetti }
51*3edf6992SAndrea Pescetti 
52*3edf6992SAndrea Pescetti serf_bucket_t * SerfLockRefreshProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
53*3edf6992SAndrea Pescetti {
54*3edf6992SAndrea Pescetti     // create serf request
55*3edf6992SAndrea Pescetti     serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
56*3edf6992SAndrea Pescetti                                                                  "LOCK",
57*3edf6992SAndrea Pescetti                                                                  getPathStr(),
58*3edf6992SAndrea Pescetti                                                                  0,
59*3edf6992SAndrea Pescetti                                                                  serf_request_get_alloc( inSerfRequest ) );
60*3edf6992SAndrea Pescetti     // set request header fields
61*3edf6992SAndrea Pescetti     serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
62*3edf6992SAndrea Pescetti     if (hdrs_bkt != NULL)
63*3edf6992SAndrea Pescetti     {
64*3edf6992SAndrea Pescetti         // general header fields provided by caller
65*3edf6992SAndrea Pescetti         setRequestHeaders( hdrs_bkt );
66*3edf6992SAndrea Pescetti 
67*3edf6992SAndrea Pescetti         // request specific header fields
68*3edf6992SAndrea Pescetti         if(mTimeout != 0)
69*3edf6992SAndrea Pescetti         {
70*3edf6992SAndrea Pescetti             serf_bucket_headers_set( hdrs_bkt, "Timeout", mTimeout );
71*3edf6992SAndrea Pescetti         }
72*3edf6992SAndrea Pescetti         if(mpLockToken != 0)
73*3edf6992SAndrea Pescetti         {
74*3edf6992SAndrea Pescetti             serf_bucket_headers_set( hdrs_bkt, "if", mpLockToken );
75*3edf6992SAndrea Pescetti         }
76*3edf6992SAndrea Pescetti     }
77*3edf6992SAndrea Pescetti     return req_bkt;
78*3edf6992SAndrea Pescetti }
79*3edf6992SAndrea Pescetti 
80*3edf6992SAndrea Pescetti } // namespace http_dav_ucp
81