From ee7859f87e2f3e24b8a5793dbc88fc61a1a7751c Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 11 Sep 2007 19:34:52 +0000 Subject: [PATCH] Monotone-Parent: 41663dd56ce370b47da06520cdf3f63f55b42cb6 Monotone-Revision: 678f408cc158a19d36fc3c0d6f53b3434a652542 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-09-11T19:34:52 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 ++++++++ UI/Common/WODirectAction+SOGo.h | 2 ++ UI/Common/WODirectAction+SOGo.m | 19 +++++++++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cbc4bed2d..1cdacfa64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-09-11 Wolfgang Sourdeau + * UI/Common/WODirectAction+SOGo.m ([WODirectAction + -responseWithStatus:status]): new method that returns a WOResponse + initialized with the specified status code. + ([WODirectAction -responseWith204]): new method that invokes the + above one with "204" as parameter. + ([WODirectAction -redirectToLocation:newLocation]): rewrote method + to make use of -responseWithStatus:. + * UI/SOGoUI/UIxComponent.m ([UIxComponent -responseWith204]): new method that returns a WOResponse initialized with the 204 status code. diff --git a/UI/Common/WODirectAction+SOGo.h b/UI/Common/WODirectAction+SOGo.h index 92ec03206..067046b69 100644 --- a/UI/Common/WODirectAction+SOGo.h +++ b/UI/Common/WODirectAction+SOGo.h @@ -30,6 +30,8 @@ @interface WODirectAction (SOGoExtension) +- (WOResponse *) responseWithStatus: (unsigned int) status; +- (WOResponse *) responseWith204; - (WOResponse *) redirectToLocation: (NSString *) newLocation; @end diff --git a/UI/Common/WODirectAction+SOGo.m b/UI/Common/WODirectAction+SOGo.m index ddeea2aaa..13c8b86d8 100644 --- a/UI/Common/WODirectAction+SOGo.m +++ b/UI/Common/WODirectAction+SOGo.m @@ -28,15 +28,30 @@ @implementation WODirectAction (SOGoExtension) -- (WOResponse *) redirectToLocation: (NSString *) newLocation +- (WOResponse *) responseWithStatus: (unsigned int) status { WOResponse *response; response = [context response]; - [response setStatus: 302 /* moved */]; + [response setStatus: status]; + + return response; +} + +- (WOResponse *) responseWith204 +{ + return [self responseWithStatus: 204]; +} + +- (WOResponse *) redirectToLocation: (NSString *) newLocation +{ + WOResponse *response; + + response = [self responseWithStatus: 302]; [response setHeader: newLocation forKey: @"location"]; return response; } + @end