You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2012/02/23 16:52:47 UTC
svn commit: r1292832 [2/4] - /incubator/ooo/trunk/main/ucb/source/ucp/webdav/
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,159 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfPostReqProcImpl.hxx>
+
+#include <serf.h>
+
+using namespace com::sun::star;
+
+namespace http_dav_ucp
+{
+
+SerfPostReqProcImpl::SerfPostReqProcImpl( const char* inPath,
+ const char* inData,
+ apr_size_t inDataLen,
+ const char* inContentType,
+ const char* inReferer,
+ const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm )
+ : SerfRequestProcessorImpl( inPath )
+ , mpPostData( inData )
+ , mnPostDataLen( inDataLen )
+ , mpContentType( inContentType )
+ , mpReferer( inReferer )
+ , xInputStream( xioInStrm )
+ , xOutputStream()
+{
+}
+
+SerfPostReqProcImpl::SerfPostReqProcImpl( const char* inPath,
+ const char* inData,
+ apr_size_t inDataLen,
+ const char* inContentType,
+ const char* inReferer,
+ const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm )
+ : SerfRequestProcessorImpl( inPath )
+ , mpPostData( inData )
+ , mnPostDataLen( inDataLen )
+ , mpContentType( inContentType )
+ , mpReferer( inReferer )
+ , xInputStream()
+ , xOutputStream( xioOutStrm )
+{
+}
+
+SerfPostReqProcImpl::~SerfPostReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfPostReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+ serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+ // create body bucket
+ serf_bucket_t* body_bkt = 0;
+ if ( mpPostData != 0 && mnPostDataLen > 0 )
+ {
+ body_bkt = SERF_BUCKET_SIMPLE_STRING_LEN( mpPostData, mnPostDataLen, pSerfBucketAlloc );
+ }
+
+ // create serf request
+ serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
+ "POST",
+ getPathStr(),
+ body_bkt,
+ serf_request_get_alloc( inSerfRequest ) );
+
+ // TODO - correct headers
+ // set request header fields
+ serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+ serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+ serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+
+ // request specific header fields
+ if ( body_bkt != 0 )
+ {
+ serf_bucket_headers_setn( hdrs_bkt, "Content-Length",
+ rtl::OUStringToOString( rtl::OUString::valueOf( (sal_Int32)mnPostDataLen ), RTL_TEXTENCODING_UTF8 ) );
+ }
+ if ( mpContentType != 0 )
+ {
+ serf_bucket_headers_setn( hdrs_bkt, "Content-Type", mpContentType );
+ }
+ if ( mpReferer != 0 )
+ {
+ serf_bucket_headers_setn( hdrs_bkt, "Referer", mpReferer );
+ }
+
+ return req_bkt;
+}
+
+
+bool SerfPostReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * /*inAprPool*/,
+ apr_status_t & outStatus )
+{
+ const char* data;
+ apr_size_t len;
+
+ while (1) {
+ outStatus = serf_bucket_read(inSerfResponseBucket, 8096, &data, &len);
+ if (SERF_BUCKET_READ_ERROR(outStatus))
+ {
+ return true;
+ }
+
+ if ( len > 0 )
+ {
+ if ( xInputStream.is() )
+ {
+ xInputStream->AddToStream( data, len );
+ }
+ else if ( xOutputStream.is() )
+ {
+ const uno::Sequence< sal_Int8 > aDataSeq( (sal_Int8 *)data, len );
+ xOutputStream->writeBytes( aDataSeq );
+ }
+ }
+
+ /* are we done yet? */
+ if (APR_STATUS_IS_EOF(outStatus))
+ {
+ outStatus = APR_EOF;
+ return true;
+ }
+
+ /* have we drained the response so far? */
+ if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+ {
+ return false;
+ }
+ }
+
+ /* NOTREACHED */
+ return true;
+}
+
+} // namespace http_dav_ucp
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,73 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef INCLUDED_SERFPOSTREQPROCIMPL_HXX
+#define INCLUDED_SERFPOSTREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+#include <SerfInputStream.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+namespace http_dav_ucp
+{
+
+class SerfPostReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+ SerfPostReqProcImpl( const char* inPath,
+ const char* inData,
+ apr_size_t inDataLen,
+ const char* inContentType,
+ const char* inReferer,
+ const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm );
+
+ SerfPostReqProcImpl( const char* inPath,
+ const char* inData,
+ apr_size_t inDataLen,
+ const char* inContentType,
+ const char* inReferer,
+ const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm );
+
+ virtual ~SerfPostReqProcImpl();
+
+ virtual
+ serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+ virtual
+ bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * inAprPool,
+ apr_status_t & outStatus );
+
+private:
+ const char* mpPostData;
+ apr_size_t mnPostDataLen;
+ const char* mpContentType;
+ const char* mpReferer;
+ com::sun::star::uno::Reference< SerfInputStream > xInputStream;
+ com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOutputStream;
+
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFPOSTREQPROCIMPL_HXX
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,254 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfPropFindReqProcImpl.hxx>
+#include <SerfTypes.hxx>
+#include <DAVProperties.hxx>
+
+#include <webdavresponseparser.hxx>
+#include <comphelper/seqstream.hxx>
+
+using namespace com::sun::star;
+
+namespace http_dav_ucp
+{
+
+SerfPropFindReqProcImpl::SerfPropFindReqProcImpl( const char* inPath,
+ const Depth inDepth,
+ const std::vector< ::rtl::OUString > & inPropNames,
+ std::vector< DAVResource > & ioResources )
+ : SerfRequestProcessorImpl( inPath )
+ , mDepthStr( 0 )
+ , mpPropNames( &inPropNames )
+ , mpResources( &ioResources )
+ , mpResInfo( 0 )
+ , mbOnlyPropertyNames( false )
+ , xInputStream( new SerfInputStream() )
+{
+ init( inDepth );
+}
+
+SerfPropFindReqProcImpl::SerfPropFindReqProcImpl( const char* inPath,
+ const Depth inDepth,
+ std::vector< DAVResourceInfo > & ioResInfo )
+ : SerfRequestProcessorImpl( inPath )
+ , mDepthStr( 0 )
+ , mpPropNames( 0 )
+ , mpResources( 0 )
+ , mpResInfo( &ioResInfo )
+ , mbOnlyPropertyNames( true )
+ , xInputStream( new SerfInputStream() )
+{
+ init( inDepth );
+}
+
+void SerfPropFindReqProcImpl::init( const Depth inDepth )
+{
+ switch ( inDepth )
+ {
+ case DAVZERO:
+ mDepthStr = "0";
+ break;
+ case DAVONE:
+ mDepthStr = "1";
+ break;
+ case DAVINFINITY:
+ mDepthStr = "infinity";
+ break;
+ }
+}
+
+SerfPropFindReqProcImpl::~SerfPropFindReqProcImpl()
+{
+}
+
+#define PROPFIND_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?><propfind xmlns=\"DAV:\">"
+#define PROPFIND_TRAILER "</propfind>"
+
+serf_bucket_t * SerfPropFindReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+ serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+ // body bucket - certain properties OR all properties OR only property names
+ serf_bucket_t* body_bkt = 0;
+ sal_Int32 nDataLen = 0;
+ {
+ // create and fill body bucket with requested properties
+ body_bkt = serf_bucket_aggregate_create( pSerfBucketAlloc );
+
+ serf_bucket_t* tmp = 0;
+ const int nPropCount = ( !mbOnlyPropertyNames && mpPropNames )
+ ? mpPropNames->size()
+ : 0;
+ if ( nPropCount > 0 )
+ {
+ SerfPropName thePropName;
+ for ( int theIndex = 0; theIndex < nPropCount; theIndex ++ )
+ {
+ // split fullname into namespace and name!
+ DAVProperties::createSerfPropName( (*mpPropNames)[ theIndex ],
+ thePropName );
+
+ /* <*propname* xmlns="*propns*" /> */
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN("<", 1, pSerfBucketAlloc );
+ serf_bucket_aggregate_append( body_bkt, tmp );
+ nDataLen += 1;
+
+ tmp = SERF_BUCKET_SIMPLE_STRING( thePropName.name, pSerfBucketAlloc );
+ serf_bucket_aggregate_append( body_bkt, tmp );
+ nDataLen += strlen(thePropName.name);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN( " xmlns=\"",
+ sizeof(" xmlns=\"")-1,
+ pSerfBucketAlloc );
+ serf_bucket_aggregate_append( body_bkt, tmp );
+ nDataLen += sizeof(" xmlns=\"")-1;
+
+ tmp = SERF_BUCKET_SIMPLE_STRING( thePropName.nspace, pSerfBucketAlloc );
+ serf_bucket_aggregate_append( body_bkt, tmp );
+ nDataLen += strlen(thePropName.nspace);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN( "\"/>", sizeof("\"/>")-1,
+ pSerfBucketAlloc );
+ serf_bucket_aggregate_append( body_bkt, tmp );
+ nDataLen += sizeof("\"/>")-1;
+ }
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN("<prop>",
+ sizeof("<prop>")-1,
+ pSerfBucketAlloc );
+ serf_bucket_aggregate_prepend(body_bkt, tmp);
+ nDataLen += sizeof("<prop>")-1;
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN("</prop>",
+ sizeof("</prop>")-1,
+ pSerfBucketAlloc );
+ serf_bucket_aggregate_append(body_bkt, tmp);
+ nDataLen += sizeof("</prop>")-1;
+ }
+ else
+ {
+ if ( mbOnlyPropertyNames )
+ {
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN( "<propname/>",
+ sizeof("<propname/>")-1,
+ pSerfBucketAlloc );
+ nDataLen += sizeof("<propname/>")-1;
+ }
+ else
+ {
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN( "<allprop/>",
+ sizeof("<allprop/>")-1,
+ pSerfBucketAlloc );
+ nDataLen += sizeof("<allprop/>")-1;
+ }
+ serf_bucket_aggregate_append( body_bkt, tmp );
+ }
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN( PROPFIND_HEADER,
+ sizeof(PROPFIND_HEADER)-1,
+ pSerfBucketAlloc );
+ serf_bucket_aggregate_prepend(body_bkt, tmp);
+ nDataLen += sizeof(PROPFIND_HEADER)-1;
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN(PROPFIND_TRAILER,
+ sizeof(PROPFIND_TRAILER)-1,
+ pSerfBucketAlloc );
+ serf_bucket_aggregate_append(body_bkt, tmp);
+ nDataLen += sizeof(PROPFIND_TRAILER)-1;
+ }
+
+ // create serf request
+ serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
+ "PROPFIND",
+ getPathStr(),
+ body_bkt,
+ serf_request_get_alloc( inSerfRequest ) );
+
+ // TODO - correct header data
+ // set request header fields
+ serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+ serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+ serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+
+ // request specific header fields
+ serf_bucket_headers_setn( hdrs_bkt, "Depth", mDepthStr );
+ serf_bucket_headers_setn( hdrs_bkt, "Content-Type", "application/xml" );
+ serf_bucket_headers_setn( hdrs_bkt, "Content-Length",
+ rtl::OUStringToOString( rtl::OUString::valueOf( nDataLen ), RTL_TEXTENCODING_UTF8 ) );
+
+ return req_bkt;
+}
+
+
+bool SerfPropFindReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * /*inAprPool*/,
+ apr_status_t & outStatus )
+{
+ const char* data;
+ apr_size_t len;
+
+ while (1) {
+ outStatus = serf_bucket_read(inSerfResponseBucket, 2048, &data, &len);
+ if (SERF_BUCKET_READ_ERROR(outStatus))
+ {
+ return true;
+ }
+
+ if ( len > 0 )
+ {
+ xInputStream->AddToStream( data, len );
+ }
+
+ /* are we done yet? */
+ if (APR_STATUS_IS_EOF(outStatus))
+ {
+ if ( mbOnlyPropertyNames )
+ {
+ const std::vector< DAVResourceInfo > rResInfo( parseWebDAVPropNameResponse( xInputStream.get() ) );
+ *mpResInfo = rResInfo;
+ }
+ else
+ {
+ const std::vector< DAVResource > rResources( parseWebDAVPropFindResponse( xInputStream.get() ) );
+ *mpResources = rResources;
+ }
+
+ outStatus = APR_EOF;
+ return true;
+ }
+
+ /* have we drained the response so far? */
+ if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+ {
+ return false;
+ }
+ }
+
+ /* NOTREACHED */
+ return true;
+}
+
+} // namespace http_dav_ucp
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,74 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef INCLUDED_SERFPROPFINDREQPROCIMPL_HXX
+#define INCLUDED_SERFPROPFINDREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+#include <vector>
+#include <rtl/ustring.hxx>
+#include "DAVTypes.hxx"
+#include "DAVResource.hxx"
+
+#include <SerfInputStream.hxx>
+
+namespace http_dav_ucp
+{
+
+class SerfPropFindReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+ SerfPropFindReqProcImpl( const char* inPath,
+ const Depth inDepth,
+ const std::vector< ::rtl::OUString > & inPropNames,
+ std::vector< DAVResource > & ioResources );
+
+ SerfPropFindReqProcImpl( const char* inPath,
+ const Depth inDepth,
+ std::vector< DAVResourceInfo > & ioResInfo );
+
+ virtual ~SerfPropFindReqProcImpl();
+
+ virtual
+ serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+ virtual
+ bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * inAprPool,
+ apr_status_t & outStatus );
+
+private:
+ void init( const Depth inDepth );
+
+ const char* mDepthStr;
+ const std::vector< ::rtl::OUString > * mpPropNames;
+ std::vector< DAVResource > * mpResources;
+ std::vector< DAVResourceInfo > * mpResInfo;
+
+ const bool mbOnlyPropertyNames;
+ com::sun::star::uno::Reference< SerfInputStream > xInputStream;
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFPROPFINDREQPROCIMPL_HXX
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,199 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <rtl/ustring.hxx>
+#include <DAVProperties.hxx>
+#include <UCBDeadPropertyValue.hxx>
+
+#include <SerfPropPatchReqProcImpl.hxx>
+#include <SerfTypes.hxx>
+
+namespace http_dav_ucp
+{
+
+SerfPropPatchReqProcImpl::SerfPropPatchReqProcImpl( const char* inPath,
+ const std::vector< ProppatchValue > & inProperties )
+ : SerfRequestProcessorImpl( inPath )
+ , mpProperties( &inProperties )
+{
+}
+
+SerfPropPatchReqProcImpl::~SerfPropPatchReqProcImpl()
+{
+}
+
+#define PROPPATCH_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?><propertyupdate xmlns=\"DAV:\">"
+#define PROPPATCH_TRAILER "</propertyupdate>"
+
+serf_bucket_t * SerfPropPatchReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+ serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+ // body bucket
+ serf_bucket_t* body_bkt = 0;
+ rtl::OUString aBodyText;
+ {
+ // create and fill body bucket with properties to be set or removed
+ static const char* OpCodes[2] = { "set", "remove" };
+ const int nPropCount = ( mpProperties != 0 )
+ ? mpProperties->size()
+ : 0;
+ if ( nPropCount > 0 )
+ {
+ // <*operation code*><prop>
+ ProppatchOperation lastOp = (*mpProperties)[ 0 ].operation;
+ aBodyText += rtl::OUString::createFromAscii( "<" );
+ aBodyText += rtl::OUString::createFromAscii( OpCodes[lastOp] );
+ aBodyText += rtl::OUString::createFromAscii( "><prop>" );
+
+ SerfPropName thePropName;
+ for ( int n = 0; n < nPropCount; ++n )
+ {
+ const ProppatchValue & rProperty = (*mpProperties)[ n ];
+ // split fullname into namespace and name!
+ DAVProperties::createSerfPropName( rProperty.name,
+ thePropName );
+
+ if ( rProperty.operation != lastOp )
+ {
+ // </prop></*last operation code*><*operation code><prop>
+ aBodyText += rtl::OUString::createFromAscii( "</prop></" );
+ aBodyText += rtl::OUString::createFromAscii( OpCodes[lastOp] );
+ aBodyText += rtl::OUString::createFromAscii( "><" );
+ aBodyText += rtl::OUString::createFromAscii( OpCodes[rProperty.operation] );
+ aBodyText += rtl::OUString::createFromAscii( "><prop>" );
+ }
+
+ // <*propname* xmlns="*propns*"
+ aBodyText += rtl::OUString::createFromAscii( "<" );
+ aBodyText += rtl::OUString::createFromAscii( thePropName.name );
+ aBodyText += rtl::OUString::createFromAscii( " xmlns=\"" );
+ aBodyText += rtl::OUString::createFromAscii( thePropName.nspace );
+ aBodyText += rtl::OUString::createFromAscii( "\"" );
+
+ if ( rProperty.operation == PROPSET )
+ {
+ // >*property value*</*propname*>
+ aBodyText += rtl::OUString::createFromAscii( ">" );
+
+ rtl::OUString aStringValue;
+ if ( DAVProperties::isUCBDeadProperty( thePropName ) )
+ {
+ UCBDeadPropertyValue::toXML( rProperty.value,
+ aStringValue );
+ }
+ else
+ {
+ rProperty.value >>= aStringValue;
+ }
+ aBodyText += aStringValue;
+ aBodyText += rtl::OUString::createFromAscii( "</" );
+ aBodyText += rtl::OUString::createFromAscii( thePropName.name );
+ aBodyText += rtl::OUString::createFromAscii( ">" );
+ }
+ else
+ {
+ // />
+ aBodyText += rtl::OUString::createFromAscii( "/>" );
+ }
+
+ lastOp = rProperty.operation;
+ }
+
+ // </prop></*last operation code*>
+ aBodyText += rtl::OUString::createFromAscii( "</prop></" );
+ aBodyText += rtl::OUString::createFromAscii( OpCodes[lastOp] );
+ aBodyText += rtl::OUString::createFromAscii( ">" );
+
+ // add PropPatch xml header in front
+ aBodyText = rtl::OUString::createFromAscii( PROPPATCH_HEADER ) + aBodyText;
+
+ // add PropPatch xml trailer at end
+ aBodyText += rtl::OUString::createFromAscii( PROPPATCH_TRAILER );
+
+ const char* pTestValue = rtl::OUStringToOString( aBodyText, RTL_TEXTENCODING_UTF8 );
+ body_bkt = SERF_BUCKET_SIMPLE_STRING( rtl::OUStringToOString( aBodyText, RTL_TEXTENCODING_UTF8 ),
+ pSerfBucketAlloc );
+ }
+ }
+
+ // create serf request
+ serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
+ "PROPPATCH",
+ getPathStr(),
+ body_bkt,
+ serf_request_get_alloc( inSerfRequest ) );
+
+ // TODO - correct header data
+ // set request header fields
+ serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+ serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+ serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+
+ // request specific header fields
+ if ( body_bkt != 0 && aBodyText.getLength() > 0 )
+ {
+ serf_bucket_headers_setn( hdrs_bkt, "Content-Type", "application/xml" );
+ serf_bucket_headers_setn( hdrs_bkt, "Content-Length",
+ rtl::OUStringToOString( rtl::OUString::valueOf( aBodyText.getLength() ), RTL_TEXTENCODING_UTF8 ) );
+ }
+
+ return req_bkt;
+}
+
+
+bool SerfPropPatchReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * /*inAprPool*/,
+ apr_status_t & outStatus )
+{
+ const char* data;
+ apr_size_t len;
+
+ while (1) {
+ outStatus = serf_bucket_read(inSerfResponseBucket, 2048, &data, &len);
+ if (SERF_BUCKET_READ_ERROR(outStatus))
+ {
+ return true;
+ }
+
+ /* are we done yet? */
+ if (APR_STATUS_IS_EOF(outStatus))
+ {
+ outStatus = APR_EOF;
+ return true;
+ }
+
+ /* have we drained the response so far? */
+ if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+ {
+ return false;
+ }
+ }
+
+ /* NOTREACHED */
+ return true;
+}
+
+} // namespace http_dav_ucp
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,56 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef INCLUDED_SERFPROPPATCHREQPROCIMPL_HXX
+#define INCLUDED_SERFPROPPATCHREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+#include <vector>
+#include <DAVTypes.hxx>
+
+namespace http_dav_ucp
+{
+
+class SerfPropPatchReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+ SerfPropPatchReqProcImpl( const char* inPath,
+ const std::vector< ProppatchValue > & inProperties );
+
+ virtual ~SerfPropPatchReqProcImpl();
+
+ virtual
+ serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+ virtual
+ bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * inAprPool,
+ apr_status_t & outStatus );
+
+private:
+ const std::vector< ProppatchValue > * mpProperties;
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFPROPPATCHREQPROCIMPL_HXX
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,116 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <rtl/ustring.hxx>
+
+#include <SerfPutReqProcImpl.hxx>
+
+#include <serf.h>
+
+namespace http_dav_ucp
+{
+
+SerfPutReqProcImpl::SerfPutReqProcImpl( const char* inPath,
+ const char* inData,
+ apr_size_t inDataLen )
+ : SerfRequestProcessorImpl( inPath )
+ , mpData( inData )
+ , mnDataLen( inDataLen )
+{
+}
+
+SerfPutReqProcImpl::~SerfPutReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfPutReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+ serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+ // create body bucket
+ serf_bucket_t* body_bkt = 0;
+ if ( mpData != 0 && mnDataLen > 0 )
+ {
+ body_bkt = SERF_BUCKET_SIMPLE_STRING_LEN( mpData, mnDataLen, pSerfBucketAlloc );
+ }
+
+ // create serf request
+ serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
+ "PUT",
+ getPathStr(),
+ body_bkt,
+ serf_request_get_alloc( inSerfRequest ) );
+
+ // TODO - correct headers
+ // set request header fields
+ serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+ serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+ serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+
+ // request specific header fields
+ if ( body_bkt != 0 )
+ {
+ serf_bucket_headers_setn( hdrs_bkt, "Content-Length",
+ rtl::OUStringToOString( rtl::OUString::valueOf( (sal_Int32)mnDataLen ), RTL_TEXTENCODING_UTF8 ) );
+ }
+
+
+ return req_bkt;
+}
+
+
+bool SerfPutReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * /*inAprPool*/,
+ apr_status_t & outStatus )
+{
+ const char* data;
+ apr_size_t len;
+
+ while (1) {
+ outStatus = serf_bucket_read(inSerfResponseBucket, 8096, &data, &len);
+ if (SERF_BUCKET_READ_ERROR(outStatus))
+ {
+ return true;
+ }
+
+ /* are we done yet? */
+ if (APR_STATUS_IS_EOF(outStatus))
+ {
+ outStatus = APR_EOF;
+ return true;
+ }
+
+ /* have we drained the response so far? */
+ if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+ {
+ return false;
+ }
+ }
+
+ /* NOTREACHED */
+ return true;
+}
+
+} // namespace http_dav_ucp
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,57 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef INCLUDED_SERFPUTREQPROCIMPL_HXX
+#define INCLUDED_SERFPUTREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+namespace http_dav_ucp
+{
+
+class SerfPutReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+ SerfPutReqProcImpl( const char* inPath,
+ const char* inData,
+ apr_size_t inDataLen );
+
+
+ virtual ~SerfPutReqProcImpl();
+
+ virtual
+ serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+ virtual
+ bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * inAprPool,
+ apr_status_t & outStatus );
+
+private:
+ const char* mpData;
+ apr_size_t mnDataLen;
+
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFPUTREQPROCIMPL_HXX
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,526 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfRequestProcessor.hxx>
+#include <SerfRequestProcessorImpl.hxx>
+#include <SerfRequestProcessorImplFac.hxx>
+#include <SerfCallbacks.hxx>
+#include <SerfSession.hxx>
+
+#include <apr_strings.h>
+
+namespace http_dav_ucp
+{
+
+SerfRequestProcessor::SerfRequestProcessor( SerfSession& rSerfSession,
+ const rtl::OUString & inPath )
+ : mrSerfSession( rSerfSession )
+ , mPathStr( 0 )
+ , mDestPathStr( 0 )
+ , mpProcImpl( 0 )
+ , mbProcessingDone( false )
+ , mpDAVException()
+ , mnHTTPStatusCode( SC_NONE )
+ , mHTTPStatusCodeText()
+ , mRedirectLocation()
+ , mbSetupSerfRequestCalled( false )
+ , mbAcceptSerfResponseCalled( false )
+ , mbHandleSerfResponseCalled( false )
+{
+ mPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
+ rtl::OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ) );
+}
+
+SerfRequestProcessor::~SerfRequestProcessor()
+{
+ delete mpProcImpl;
+ delete mpDAVException;
+}
+
+void SerfRequestProcessor::prepareProcessor()
+{
+ delete mpDAVException;
+ mpDAVException = 0;
+ mnHTTPStatusCode = SC_NONE;
+ mHTTPStatusCodeText = rtl::OUString();
+ mRedirectLocation = rtl::OUString();
+
+ mbSetupSerfRequestCalled = false;
+ mbAcceptSerfResponseCalled = false;
+ mbHandleSerfResponseCalled = false;
+}
+
+// PROPFIND - allprop & named
+bool SerfRequestProcessor::processPropFind( const Depth inDepth,
+ const std::vector< ::rtl::OUString > & inPropNames,
+ std::vector< DAVResource > & ioResources,
+ apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createPropFindReqProcImpl( mPathStr,
+ inDepth,
+ inPropNames,
+ ioResources );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// PROPFIND - property names
+bool SerfRequestProcessor::processPropFind( const Depth inDepth,
+ std::vector< DAVResourceInfo > & ioResInfo,
+ apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createPropFindReqProcImpl( mPathStr,
+ inDepth,
+ ioResInfo );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// PROPPATCH
+bool SerfRequestProcessor::processPropPatch( const std::vector< ProppatchValue > & inProperties,
+ apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createPropPatchReqProcImpl( mPathStr,
+ inProperties );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// GET
+bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
+ apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createGetReqProcImpl( mPathStr,
+ xioInStrm );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// GET inclusive header fields
+bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createGetReqProcImpl( mPathStr,
+ xioInStrm,
+ inHeaderNames,
+ ioResource );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// GET
+bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
+ apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createGetReqProcImpl( mPathStr,
+ xioOutStrm );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// GET inclusive header fields
+bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createGetReqProcImpl( mPathStr,
+ xioOutStrm,
+ inHeaderNames,
+ ioResource );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// HEAD
+bool SerfRequestProcessor::processHead( const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createHeadReqProcImpl( mPathStr,
+ inHeaderNames,
+ ioResource );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// PUT
+bool SerfRequestProcessor::processPut( const char* inData,
+ apr_size_t inDataLen,
+ apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createPutReqProcImpl( mPathStr,
+ inData,
+ inDataLen );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// POST
+bool SerfRequestProcessor::processPost( const char* inData,
+ apr_size_t inDataLen,
+ const rtl::OUString & inContentType,
+ const rtl::OUString & inReferer,
+ const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
+ apr_status_t& outSerfStatus )
+{
+ mContentType = apr_pstrdup( mrSerfSession.getAprPool(),
+ rtl::OUStringToOString( inContentType, RTL_TEXTENCODING_UTF8 ) );
+ mReferer = apr_pstrdup( mrSerfSession.getAprPool(),
+ rtl::OUStringToOString( inReferer, RTL_TEXTENCODING_UTF8 ) );
+ mpProcImpl = createPostReqProcImpl( mPathStr,
+ inData,
+ inDataLen,
+ mContentType,
+ mReferer,
+ xioInStrm );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// POST
+bool SerfRequestProcessor::processPost( const char* inData,
+ apr_size_t inDataLen,
+ const rtl::OUString & inContentType,
+ const rtl::OUString & inReferer,
+ const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
+ apr_status_t& outSerfStatus )
+{
+ mContentType = apr_pstrdup( mrSerfSession.getAprPool(),
+ rtl::OUStringToOString( inContentType, RTL_TEXTENCODING_UTF8 ) );
+ mReferer = apr_pstrdup( mrSerfSession.getAprPool(),
+ rtl::OUStringToOString( inReferer, RTL_TEXTENCODING_UTF8 ) );
+ mpProcImpl = createPostReqProcImpl( mPathStr,
+ inData,
+ inDataLen,
+ mContentType,
+ mReferer,
+ xioOutStrm );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// DELETE
+bool SerfRequestProcessor::processDelete( apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createDeleteReqProcImpl( mPathStr );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// MKCOL
+bool SerfRequestProcessor::processMkCol( apr_status_t& outSerfStatus )
+{
+ mpProcImpl = createMkColReqProcImpl( mPathStr );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// COPY
+bool SerfRequestProcessor::processCopy( const rtl::OUString & inDestinationPath,
+ const bool inOverwrite,
+ apr_status_t& outSerfStatus )
+{
+ mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
+ rtl::OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ) );
+ mpProcImpl = createCopyReqProcImpl( mPathStr,
+ mDestPathStr,
+ inOverwrite );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+// MOVE
+bool SerfRequestProcessor::processMove( const rtl::OUString & inDestinationPath,
+ const bool inOverwrite,
+ apr_status_t& outSerfStatus )
+{
+ mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
+ rtl::OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ) );
+ mpProcImpl = createMoveReqProcImpl( mPathStr,
+ mDestPathStr,
+ inOverwrite );
+ outSerfStatus = runProcessor();
+
+ return outSerfStatus == APR_SUCCESS;
+}
+
+apr_status_t SerfRequestProcessor::runProcessor()
+{
+ prepareProcessor();
+
+ // create serf request
+ serf_connection_request_create( mrSerfSession.getSerfConnection(),
+ Serf_SetupRequest,
+ this );
+
+ // perform serf request
+ mbProcessingDone = false;
+ apr_status_t status = APR_SUCCESS;
+ serf_context_t* pSerfContext = mrSerfSession.getSerfContext();
+ apr_pool_t* pAprPool = mrSerfSession.getAprPool();
+ while ( true )
+ {
+ status = serf_context_run( pSerfContext,
+ SERF_DURATION_FOREVER,
+ pAprPool );
+ if ( APR_STATUS_IS_TIMEUP( status ) )
+ {
+ continue;
+ }
+ if ( status != APR_SUCCESS )
+ {
+ break;
+ }
+ if ( mbProcessingDone )
+ {
+ break;
+ }
+ }
+
+ postprocessProcessor( status );
+
+ return status;
+}
+
+void SerfRequestProcessor::postprocessProcessor( const apr_status_t inStatus )
+{
+ if ( inStatus == APR_SUCCESS )
+ {
+ return;
+ }
+
+ // DEBUG INFO
+ const char* SerfErrorStr = serf_error_string( inStatus );
+ char AprErrorStr[256];
+ apr_strerror( inStatus, AprErrorStr, sizeof( AprErrorStr ) );
+
+ switch ( inStatus )
+ {
+ case APR_EGENERAL:
+ // general error; <mnHTTPStatusCode> provides more information
+ {
+ // TODO: reactivate special handling copied from neon!?
+ /*
+ if ( mnHTTPStatusCode == SC_LOCKED )
+ {
+ if ( m_aSerfLockStore.findByUri(
+ makeAbsoluteURL( inPath ) ) == 0 )
+ {
+ // locked by 3rd party
+ throw DAVException( DAVException::DAV_LOCKED );
+ }
+ else
+ {
+ // locked by ourself
+ throw DAVException( DAVException::DAV_LOCKED_SELF );
+ }
+ }
+
+ // Special handling for 400 and 412 status codes, which may indicate
+ // that a lock previously obtained by us has been released meanwhile
+ // by the server. Unfortunately, RFC is not clear at this point,
+ // thus server implementations behave different...
+ else if ( mnHTTPStatusCode == SC_BAD_REQUEST || mnHTTPStatusCode == SC_PRECONDITION_FAILED )
+ {
+ if ( removeExpiredLocktoken( makeAbsoluteURL( inPath ), rEnv ) )
+ throw DAVException( DAVException::DAV_LOCK_EXPIRED );
+ }
+ */
+ switch ( mnHTTPStatusCode )
+ {
+ case SC_NONE:
+ if ( !mbSetupSerfRequestCalled )
+ {
+ mpDAVException = new DAVException( DAVException::DAV_HTTP_LOOKUP,
+ SerfUri::makeConnectionEndPointString( mrSerfSession.getHostName(),
+ mrSerfSession.getPort() ) );
+ }
+ else
+ {
+ mpDAVException = new DAVException( DAVException::DAV_HTTP_ERROR,
+ mHTTPStatusCodeText,
+ mnHTTPStatusCode );
+ }
+ break;
+ case SC_MOVED_PERMANENTLY:
+ case SC_MOVED_TEMPORARILY:
+ case SC_SEE_OTHER:
+ case SC_TEMPORARY_REDIRECT:
+ mpDAVException = new DAVException( DAVException::DAV_HTTP_REDIRECT,
+ mRedirectLocation );
+ break;
+ default:
+ mpDAVException = new DAVException( DAVException::DAV_HTTP_ERROR,
+ mHTTPStatusCodeText,
+ mnHTTPStatusCode );
+ break;
+ }
+ }
+ break;
+
+ default:
+ mpDAVException = new DAVException( DAVException::DAV_HTTP_ERROR );
+ break;
+ }
+
+}
+
+apr_status_t SerfRequestProcessor::provideSerfCredentials( char ** outUsername,
+ char ** outPassword,
+ serf_request_t * inRequest,
+ int inCode,
+ const char *inAuthProtocol,
+ const char *inRealm,
+ apr_pool_t *inAprPool )
+{
+ return mrSerfSession.provideSerfCredentials( outUsername,
+ outPassword,
+ inRequest,
+ inCode,
+ inAuthProtocol,
+ inRealm,
+ inAprPool );
+}
+
+apr_status_t SerfRequestProcessor::setupSerfRequest( serf_request_t * inSerfRequest,
+ serf_bucket_t ** outSerfRequestBucket,
+ serf_response_acceptor_t * outSerfResponseAcceptor,
+ void ** outSerfResponseAcceptorBaton,
+ serf_response_handler_t * outSerfResponseHandler,
+ void ** outSerfResponseHandlerBaton,
+ apr_pool_t * /*inAprPool*/ )
+{
+ mbSetupSerfRequestCalled = true;
+ *outSerfRequestBucket = mpProcImpl->createSerfRequestBucket( inSerfRequest );
+
+ // apply callbacks for accepting response and handling response
+ *outSerfResponseAcceptor = Serf_AcceptResponse;
+ *outSerfResponseAcceptorBaton = this;
+ *outSerfResponseHandler = Serf_HandleResponse;
+ *outSerfResponseHandlerBaton = this;
+
+ return APR_SUCCESS;
+}
+
+serf_bucket_t* SerfRequestProcessor::acceptSerfResponse( serf_request_t * inSerfRequest,
+ serf_bucket_t * inSerfStreamBucket,
+ apr_pool_t * inAprPool )
+{
+ mbAcceptSerfResponseCalled = true;
+ return mrSerfSession.acceptSerfResponse( inSerfRequest,
+ inSerfStreamBucket,
+ inAprPool );
+}
+
+apr_status_t SerfRequestProcessor::handleSerfResponse( serf_request_t * inSerfRequest,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * inAprPool )
+{
+ mbHandleSerfResponseCalled = true;
+
+ // some general response handling and error handling
+ {
+ if ( !inSerfResponseBucket )
+ {
+ /* A NULL response can come back if the request failed completely */
+ mbProcessingDone = true;
+ return APR_EGENERAL;
+ }
+
+ serf_status_line sl;
+ apr_status_t status = serf_bucket_response_status( inSerfResponseBucket, &sl );
+ if ( status )
+ {
+ mbProcessingDone = false; // allow another try in order to get a response
+ return status;
+ }
+ // TODO - check, if response status code handling is correct
+ mnHTTPStatusCode = ( sl.version != 0 && sl.code >= 0 )
+ ? static_cast< sal_uInt16 >( sl.code )
+ : SC_NONE;
+ if ( sl.reason )
+ {
+ mHTTPStatusCodeText = ::rtl::OUString::createFromAscii( sl.reason );
+ }
+ if ( ( sl.version == 0 || sl.code < 0 ) ||
+ mnHTTPStatusCode >= 300 )
+ {
+ if ( mnHTTPStatusCode == 301 ||
+ mnHTTPStatusCode == 302 ||
+ mnHTTPStatusCode == 303 ||
+ mnHTTPStatusCode == 307 )
+ {
+ // new location for certain redirections
+ serf_bucket_t *headers = serf_bucket_response_get_headers( inSerfResponseBucket );
+ const char* location = serf_bucket_headers_get( headers, "Location" );
+ if ( location )
+ {
+ mRedirectLocation = rtl::OUString::createFromAscii( location );
+ }
+ mbProcessingDone = true;
+ return APR_EGENERAL;
+ }
+ else if ( mrSerfSession.isHeadRequestInProgress() &&
+ ( mnHTTPStatusCode == 401 || mnHTTPStatusCode == 407 ) )
+ {
+ // keep going as authentication is not required on HEAD request.
+ // the response already contains header fields.
+ }
+ else
+ {
+ mbProcessingDone = true;
+ return APR_EGENERAL;
+ }
+ }
+ }
+
+ // request specific processing of the response bucket
+ apr_status_t status = APR_SUCCESS;
+ mbProcessingDone = mpProcImpl->processSerfResponseBucket( inSerfRequest,
+ inSerfResponseBucket,
+ inAprPool,
+ status );
+
+ return status;
+}
+
+} // namespace http_dav_ucp
+
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,178 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+#ifndef INCLUDED_SERFREQUESTPROCESSOR_HXX
+#define INCLUDED_SERFREQUESTPROCESSOR_HXX
+
+#include <apr_errno.h>
+#include <apr_pools.h>
+
+#include <serf.h>
+
+#include <DAVTypes.hxx>
+#include <DAVResource.hxx>
+#include <DAVException.hxx>
+
+#include <SerfInputStream.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+namespace http_dav_ucp
+{
+
+class SerfSession;
+class SerfRequestProcessorImpl;
+
+class SerfRequestProcessor
+{
+public:
+ SerfRequestProcessor( SerfSession& rSerfSession,
+ const rtl::OUString & inPath );
+ ~SerfRequestProcessor();
+
+ // PROPFIND - allprop & named
+ bool processPropFind( const Depth inDepth,
+ const std::vector< ::rtl::OUString > & inPropNames,
+ std::vector< DAVResource > & ioResources,
+ apr_status_t& outSerfStatus );
+
+ // PROPFIND - property names
+ bool processPropFind( const Depth inDepth,
+ std::vector< DAVResourceInfo > & ioResInfo,
+ apr_status_t& outSerfStatus );
+
+ // PROPPATCH
+ bool processPropPatch( const std::vector< ProppatchValue > & inProperties,
+ apr_status_t& outSerfStatus );
+
+ // GET
+ bool processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
+ apr_status_t& outSerfStatus );
+
+ // GET inclusive header fields
+ bool processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ apr_status_t& outSerfStatus );
+
+ // GET
+ bool processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
+ apr_status_t& outSerfStatus );
+
+ // GET inclusive header fields
+ bool processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ apr_status_t& outSerfStatus );
+
+ // HEAD
+ bool processHead( const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ apr_status_t& outSerfStatus );
+
+ // PUT
+ bool processPut( const char* inData,
+ apr_size_t inDataLen,
+ apr_status_t& outSerfStatus );
+
+ // POST
+ bool processPost( const char* inData,
+ apr_size_t inDataLen,
+ const rtl::OUString & inContentType,
+ const rtl::OUString & inReferer,
+ const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
+ apr_status_t& outSerfStatus );
+
+ // POST
+ bool processPost( const char* inData,
+ apr_size_t inDataLen,
+ const rtl::OUString & inContentType,
+ const rtl::OUString & inReferer,
+ const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
+ apr_status_t& outSerfStatus );
+
+ // DELETE
+ bool processDelete( apr_status_t& outSerfStatus );
+
+ // MKCOL
+ bool processMkCol( apr_status_t& outSerfStatus );
+
+ // COPY
+ bool processCopy( const rtl::OUString & inDestinationPath,
+ const bool inOverwrite,
+ apr_status_t& outSerfStatus );
+
+ // MOVE
+ bool processMove( const rtl::OUString & inDestinationPath,
+ const bool inOverwrite,
+ apr_status_t& outSerfStatus );
+
+ apr_status_t provideSerfCredentials( char ** outUsername,
+ char ** outPassword,
+ serf_request_t * inRequest,
+ int inCode,
+ const char *inAuthProtocol,
+ const char *inRealm,
+ apr_pool_t *inAprPool );
+
+ apr_status_t setupSerfRequest( serf_request_t * inSerfRequest,
+ serf_bucket_t ** outSerfRequestBucket,
+ serf_response_acceptor_t * outSerfResponseAcceptor,
+ void ** outSerfResponseAcceptorBaton,
+ serf_response_handler_t * outSerfResponseHandler,
+ void ** outSerfResponseHandlerBaton,
+ apr_pool_t * inAprPool );
+
+ serf_bucket_t* acceptSerfResponse( serf_request_t * inSerfRequest,
+ serf_bucket_t * inSerfStreamBucket,
+ apr_pool_t* inAprPool );
+
+ apr_status_t handleSerfResponse( serf_request_t * inSerfRequest,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * inAprPool );
+
+//private:
+ void prepareProcessor();
+ apr_status_t runProcessor();
+ void postprocessProcessor( const apr_status_t inStatus );
+
+ SerfSession& mrSerfSession;
+ const char* mPathStr;
+ const char* mDestPathStr;
+ const char* mContentType;
+ const char* mReferer;
+ SerfRequestProcessorImpl* mpProcImpl;
+
+ bool mbProcessingDone;
+
+ DAVException* mpDAVException;
+ sal_uInt16 mnHTTPStatusCode;
+ rtl::OUString mHTTPStatusCodeText;
+ rtl::OUString mRedirectLocation;
+
+ bool mbSetupSerfRequestCalled;
+ bool mbAcceptSerfResponseCalled;
+ bool mbHandleSerfResponseCalled;
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFREQUESTPROCESSOR_HXX
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,42 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <SerfRequestProcessorImpl.hxx>
+
+namespace http_dav_ucp
+{
+
+SerfRequestProcessorImpl::SerfRequestProcessorImpl( const char* inPath )
+ : mPathStr( inPath )
+{
+}
+
+SerfRequestProcessorImpl::~SerfRequestProcessorImpl()
+{
+}
+
+const char* SerfRequestProcessorImpl::getPathStr() const
+{
+ return mPathStr;
+}
+
+} // namespace http_dav_ucp
+
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,58 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef INCLUDED_SERFREQUESTPROCESSORIMPL_HXX
+#define INCLUDED_SERFREQUESTPROCESSORIMPL_HXX
+
+#include <serf.h>
+
+#include <sal/types.h>
+
+namespace http_dav_ucp
+{
+
+class SerfRequestProcessorImpl
+{
+public:
+ SerfRequestProcessorImpl( const char* inPath );
+
+ virtual ~SerfRequestProcessorImpl();
+
+ /*pure*/ virtual
+ serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest ) = 0;
+
+ /*pure*/ virtual
+ bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+ serf_bucket_t * inSerfResponseBucket,
+ apr_pool_t * inAprPool,
+ apr_status_t & outStatus ) = 0;
+
+protected:
+ const char* getPathStr() const;
+
+private:
+ const char* mPathStr;
+
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFREQUESTPROCESSORIMPL_HXX
Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,194 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfRequestProcessorImplFac.hxx>
+#include <SerfPropFindReqProcImpl.hxx>
+#include <SerfPropPatchReqProcImpl.hxx>
+#include <SerfGetReqProcImpl.hxx>
+#include <SerfHeadReqProcImpl.hxx>
+#include <SerfPutReqProcImpl.hxx>
+#include <SerfPostReqProcImpl.hxx>
+#include <SerfDeleteReqProcImpl.hxx>
+#include <SerfMkColReqProcImpl.hxx>
+#include <SerfCopyReqProcImpl.hxx>
+#include <SerfMoveReqProcImpl.hxx>
+
+namespace http_dav_ucp
+{
+ SerfRequestProcessorImpl* createPropFindReqProcImpl( const char* inPath,
+ const Depth inDepth,
+ const std::vector< ::rtl::OUString > & inPropNames,
+ std::vector< DAVResource > & ioResources )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfPropFindReqProcImpl( inPath,
+ inDepth,
+ inPropNames,
+ ioResources );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createPropFindReqProcImpl( const char* inPath,
+ const Depth inDepth,
+ std::vector< DAVResourceInfo > & ioResInfo )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfPropFindReqProcImpl( inPath,
+ inDepth,
+ ioResInfo );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createPropPatchReqProcImpl( const char* inPath,
+ const std::vector< ProppatchValue > & inProperties )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfPropPatchReqProcImpl( inPath,
+ inProperties );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createGetReqProcImpl( const char* inPath,
+ const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfGetReqProcImpl( inPath,
+ xioInStrm );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createGetReqProcImpl( const char* inPath,
+ const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource& ioResource )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfGetReqProcImpl( inPath,
+ xioInStrm,
+ inHeaderNames,
+ ioResource );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createGetReqProcImpl( const char* inPath,
+ const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfGetReqProcImpl( inPath,
+ xioOutStrm );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createGetReqProcImpl( const char* inPath,
+ const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream >& xioOutStrm,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource& ioResource )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfGetReqProcImpl( inPath,
+ xioOutStrm,
+ inHeaderNames,
+ ioResource );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createHeadReqProcImpl( const char* inPath,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource& ioResource )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfHeadReqProcImpl( inPath,
+ inHeaderNames,
+ ioResource );
+ return pReqProcImpl;
+ }
+
+
+ SerfRequestProcessorImpl* createPutReqProcImpl( const char* inPath,
+ const char* inData,
+ apr_size_t inDataLen )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfPutReqProcImpl( inPath,
+ inData,
+ inDataLen );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createPostReqProcImpl( const char* inPath,
+ const char* inData,
+ apr_size_t inDataLen,
+ const char* inContentType,
+ const char* inReferer,
+ const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfPostReqProcImpl( inPath,
+ inData,
+ inDataLen,
+ inContentType,
+ inReferer,
+ xioInStrm );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createPostReqProcImpl( const char* inPath,
+ const char* inData,
+ apr_size_t inDataLen,
+ const char* inContentType,
+ const char* inReferer,
+ const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfPostReqProcImpl( inPath,
+ inData,
+ inDataLen,
+ inContentType,
+ inReferer,
+ xioOutStrm );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createDeleteReqProcImpl( const char* inPath )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfDeleteReqProcImpl( inPath );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createMkColReqProcImpl( const char* inPath )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfMkColReqProcImpl( inPath );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createCopyReqProcImpl( const char* inSourcePath,
+ const char* inDestinationPath,
+ const bool inOverwrite )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfCopyReqProcImpl( inSourcePath,
+ inDestinationPath,
+ inOverwrite );
+ return pReqProcImpl;
+ }
+
+ SerfRequestProcessorImpl* createMoveReqProcImpl( const char* inSourcePath,
+ const char* inDestinationPath,
+ const bool inOverwrite )
+ {
+ SerfRequestProcessorImpl* pReqProcImpl = new SerfMoveReqProcImpl( inSourcePath,
+ inDestinationPath,
+ inOverwrite );
+ return pReqProcImpl;
+ }
+
+} // namespace http_dav_ucp