You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by ga...@apache.org on 2013/03/25 17:37:25 UTC
svn commit: r1460757 - in /chemistry/objectivecmis/trunk: ./
ObjectiveCMIS.xcodeproj/ ObjectiveCMIS.xcodeproj/project.xcworkspace/
ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
ObjectiveCMIS/Utils/CMISHttpRequest.m
Author: gavincornwell
Date: Mon Mar 25 16:37:25 2013
New Revision: 1460757
URL: http://svn.apache.org/r1460757
Log:
- Fixed a double PUT, updating properties on a node was calling the same PUT call twice which
- Added more TRACE output to CMISHttpRequest, you'll now see the request body and response code
- Added ignore patterns for build, ObjectiveCMISHelp and xcuserdata folders
Modified:
chemistry/objectivecmis/trunk/ (props changed)
chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/ (props changed)
chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.xcworkspace/ (props changed)
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m
Propchange: chemistry/objectivecmis/trunk/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 25 16:37:25 2013
@@ -0,0 +1,2 @@
+build
+ObjectiveCMISHelp
Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 25 16:37:25 2013
@@ -0,0 +1 @@
+xcuserdata
Propchange: chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.xcworkspace/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 25 16:37:25 2013
@@ -0,0 +1 @@
+xcuserdata
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m?rev=1460757&r1=1460756&r2=1460757&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m Mon Mar 25 16:37:25 2013
@@ -579,34 +579,17 @@
properties:properties
cmisRequest:request
completionBlock:^(CMISObjectData *objectData, NSError *error) {
- // Create XML needed as body of html
-
- CMISAtomEntryWriter *xmlWriter = [[CMISAtomEntryWriter alloc] init];
- xmlWriter.cmisProperties = properties;
- xmlWriter.generateXmlInMemory = YES;
-
- [self.bindingSession.networkProvider invokePUT:[NSURL URLWithString:selfLink]
- session:self.bindingSession
- body:[xmlWriter.generateAtomEntryXml dataUsingEncoding:NSUTF8StringEncoding]
- headers:[NSDictionary dictionaryWithObject:kCMISMediaTypeEntry forKey:@"Content-type"]
- cmisRequest:request
- completionBlock:^(CMISHttpResponse *httpResponse, NSError *error) {
- if (httpResponse) {
- // Object id and changeToken might have changed because of this operation
- CMISAtomEntryParser *atomEntryParser = [[CMISAtomEntryParser alloc] initWithData:httpResponse.data];
- NSError *error = nil;
- if ([atomEntryParser parseAndReturnError:&error]) {
- objectIdParam.outParameter = [[atomEntryParser.objectData.properties propertyForId:kCMISPropertyObjectId] firstValue];
-
- if (changeTokenParam != nil) {
- changeTokenParam.outParameter = [[atomEntryParser.objectData.properties propertyForId:kCMISPropertyChangeToken] firstValue];
- }
- }
- completionBlock(nil);
- } else {
- completionBlock([CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeConnection]);
- }
- } ];
+ if (objectData == nil) {
+ completionBlock([CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeConnection]);
+ }
+ else {
+ // update the out parameter as the objectId may have changed
+ objectIdParam.outParameter = [[objectData.properties propertyForId:kCMISPropertyObjectId] firstValue];
+ if (changeTokenParam != nil) {
+ changeTokenParam.outParameter = [[objectData.properties propertyForId:kCMISPropertyChangeToken] firstValue];
+ }
+ completionBlock(nil);
+ }
}];
}];
return request;
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m?rev=1460757&r1=1460756&r2=1460757&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m Mon Mar 25 16:37:25 2013
@@ -78,6 +78,10 @@ NSString * const kCMISExceptionVersionin
- (BOOL)startRequest:(NSMutableURLRequest*)urlRequest
{
if (self.requestBody) {
+ if ([CMISLog sharedInstance].logLevel == CMISLogLevelTrace) {
+ CMISLogTrace(@"Request body: %@", [[NSString alloc] initWithData:self.requestBody encoding:NSUTF8StringEncoding]);
+ }
+
[urlRequest setHTTPBody:self.requestBody];
}
@@ -191,6 +195,7 @@ NSString * const kCMISExceptionVersionin
- (BOOL)checkStatusCodeForResponse:(CMISHttpResponse *)response httpRequestMethod:(CMISHttpRequestMethod)httpRequestMethod error:(NSError **)error
{
if ([CMISLog sharedInstance].logLevel == CMISLogLevelTrace) {
+ CMISLogTrace(@"Response status code: %d", response.statusCode);
CMISLogTrace(@"Response body: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
}