From: wolfgang Date: Thu, 13 Dec 2007 20:23:11 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1301 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd40ead025fbafaa491f4afbdd8eb499e3bb5125;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1301 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/ChangeLog b/ChangeLog index ef45ef7e..debdfec7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 2007-12-13 Wolfgang Sourdeau + * UI/MainUI/SOGoRootPage.m ([SOGoRootPage -crashAction]): new + action methods that generates a segmentation faults. + ([SOGoRootPage -exceptionAction]): new method that returns an + exception object. + ([SOGoRootPage -raisedExceptionAction]): new method that raises an + exception without returning it. + + * UI/SOGoUI/UIxComponent.m ([UIxComponent -responseWithStatus:status]) + ([UIxComponent -responseWithStatus:statusandString:contentString]) + ([UIxComponent -responseWithStatus:statusandJSONRepresentation:contentObject]) + ([UIxComponent -responseWith204]): new utility methods. + + * UI/Common/WODirectAction+SOGo.m ([WODirectAction + -responseWithStatus:statusandString:contentString]) + ([WODirectAction + -responseWithStatus:statusandJSONRepresentation:contentObject]): + new utility methods. + * SoObjects/SOGo/NSScanner+BSJSONAdditions.m ([NSScanner -scanJSONStringDelimiterString]): new category module taken from BSJSONAdditions 1.3. diff --git a/SOPE/sope-patchset-r1552.diff b/SOPE/sope-patchset-r1557.diff similarity index 89% rename from SOPE/sope-patchset-r1552.diff rename to SOPE/sope-patchset-r1557.diff index 774c0476..ca62e7bd 100644 --- a/SOPE/sope-patchset-r1552.diff +++ b/SOPE/sope-patchset-r1557.diff @@ -1,6 +1,50 @@ +Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m +=================================================================== +--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (révision 1557) ++++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (copie de travail) +@@ -713,6 +713,39 @@ + return ms; + } + ++/* GCSEOAdaptorChannel protocol */ ++static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \ ++ @" c_name VARCHAR (256) NOT NULL,\n" ++ @" c_content VARCHAR (100000) NOT NULL,\n" ++ @" c_creationdate INT4 NOT NULL,\n" ++ @" c_lastmodified INT4 NOT NULL,\n" ++ @" c_version INT4 NOT NULL,\n" ++ @" c_deleted INT4 NULL\n" ++ @")"); ++static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \ ++ @" c_uid VARCHAR (256) NOT NULL,\n" ++ @" c_object VARCHAR (256) NOT NULL,\n" ++ @" c_role VARCHAR (80) NOT NULL\n" ++ @")"); ++ ++- (NSException *) createGCSFolderTableWithName: (NSString *) tableName ++{ ++ NSString *sql; ++ ++ sql = [NSString stringWithFormat: sqlFolderFormat, tableName]; ++ ++ return [self evaluateExpressionX: sql]; ++} ++ ++- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName ++{ ++ NSString *sql; ++ ++ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName]; ++ ++ return [self evaluateExpressionX: sql]; ++} ++ + @end /* PostgreSQL72Channel */ + + @implementation PostgreSQL72Channel(PrimaryKeyGeneration) Index: sope-mime/NGImap4/NGImap4Connection.m =================================================================== ---- sope-mime/NGImap4/NGImap4Connection.m (révision 1552) +--- sope-mime/NGImap4/NGImap4Connection.m (révision 1557) +++ sope-mime/NGImap4/NGImap4Connection.m (copie de travail) @@ -381,7 +381,7 @@ @@ -13,7 +57,7 @@ Index: sope-mime/NGImap4/NGImap4Connection.m [self errorWithFormat:@"Could not list mailbox hierarchy!"]; Index: sope-mime/NGImap4/NGImap4ResponseNormalizer.m =================================================================== ---- sope-mime/NGImap4/NGImap4ResponseNormalizer.m (révision 1552) +--- sope-mime/NGImap4/NGImap4ResponseNormalizer.m (révision 1557) +++ sope-mime/NGImap4/NGImap4ResponseNormalizer.m (copie de travail) @@ -648,14 +648,13 @@ enumerator = [_flags objectEnumerator]; @@ -39,7 +83,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseNormalizer.m if (objs) free(objs); Index: sope-mime/NGImap4/NGImap4ResponseParser.m =================================================================== ---- sope-mime/NGImap4/NGImap4ResponseParser.m (révision 1552) +--- sope-mime/NGImap4/NGImap4ResponseParser.m (révision 1557) +++ sope-mime/NGImap4/NGImap4ResponseParser.m (copie de travail) @@ -84,6 +84,8 @@ static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self, @@ -230,7 +274,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m { Index: sope-mime/NGMail/NGSmtpClient.m =================================================================== ---- sope-mime/NGMail/NGSmtpClient.m (révision 1552) +--- sope-mime/NGMail/NGSmtpClient.m (révision 1557) +++ sope-mime/NGMail/NGSmtpClient.m (copie de travail) @@ -24,6 +24,82 @@ #include "NGSmtpReplyCodes.h" @@ -386,7 +430,7 @@ Index: sope-mime/NGMail/NGSmtpClient.m reply = [self receiveReply]; Index: sope-mime/NGMail/NGMimeMessageGenerator.m =================================================================== ---- sope-mime/NGMail/NGMimeMessageGenerator.m (révision 1552) +--- sope-mime/NGMail/NGMimeMessageGenerator.m (révision 1557) +++ sope-mime/NGMail/NGMimeMessageGenerator.m (copie de travail) @@ -86,37 +86,40 @@ char *des = NULL; @@ -452,7 +496,7 @@ Index: sope-mime/NGMail/NGMimeMessageGenerator.m unsigned isoEndLen = 2; Index: sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m =================================================================== ---- sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m (révision 1552) +--- sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m (révision 1557) +++ sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m (copie de travail) @@ -19,88 +19,30 @@ 02111-1307, USA. @@ -832,7 +876,7 @@ Index: sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m #if 0 Index: sope-mime/NGMime/NGMimeBodyPart.m =================================================================== ---- sope-mime/NGMime/NGMimeBodyPart.m (révision 1552) +--- sope-mime/NGMime/NGMimeBodyPart.m (révision 1557) +++ sope-mime/NGMime/NGMimeBodyPart.m (copie de travail) @@ -31,18 +31,6 @@ return 2; @@ -870,7 +914,7 @@ Index: sope-mime/NGMime/NGMimeBodyPart.m - (NSString *)contentId { Index: sope-mime/NGMime/NGMimeBodyParser.m =================================================================== ---- sope-mime/NGMime/NGMimeBodyParser.m (révision 1552) +--- sope-mime/NGMime/NGMimeBodyParser.m (révision 1557) +++ sope-mime/NGMime/NGMimeBodyParser.m (copie de travail) @@ -67,7 +67,10 @@ if (_data == nil) return nil; @@ -886,7 +930,7 @@ Index: sope-mime/NGMime/NGMimeBodyParser.m Index: sope-mime/NGMime/NGMimePartParser.h =================================================================== ---- sope-mime/NGMime/NGMimePartParser.h (révision 1552) +--- sope-mime/NGMime/NGMimePartParser.h (révision 1557) +++ sope-mime/NGMime/NGMimePartParser.h (copie de travail) @@ -117,6 +117,7 @@ BOOL parserParseRawBodyDataOfPart:1; @@ -908,7 +952,7 @@ Index: sope-mime/NGMime/NGMimePartParser.h @interface NSObject(NGMimePartParser) Index: sope-mime/NGMime/NGMimePartParser.m =================================================================== ---- sope-mime/NGMime/NGMimePartParser.m (révision 1552) +--- sope-mime/NGMime/NGMimePartParser.m (révision 1557) +++ sope-mime/NGMime/NGMimePartParser.m (copie de travail) @@ -227,7 +227,7 @@ } @@ -933,7 +977,7 @@ Index: sope-mime/NGMime/NGMimePartParser.m : [NGMimeType mimeType:[ctype stringValue]]; Index: sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m =================================================================== ---- sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m (révision 1552) +--- sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m (révision 1557) +++ sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m (copie de travail) @@ -49,80 +49,70 @@ @@ -1067,53 +1111,9 @@ Index: sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m } return data; } -Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m -=================================================================== ---- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (révision 1552) -+++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (copie de travail) -@@ -713,6 +713,39 @@ - return ms; - } - -+/* GCSEOAdaptorChannel protocol */ -+static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \ -+ @" c_name VARCHAR (256) NOT NULL,\n" -+ @" c_content VARCHAR (100000) NOT NULL,\n" -+ @" c_creationdate INT4 NOT NULL,\n" -+ @" c_lastmodified INT4 NOT NULL,\n" -+ @" c_version INT4 NOT NULL,\n" -+ @" c_deleted INT4 NULL\n" -+ @")"); -+static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \ -+ @" c_uid VARCHAR (256) NOT NULL,\n" -+ @" c_object VARCHAR (256) NOT NULL,\n" -+ @" c_role VARCHAR (80) NOT NULL\n" -+ @")"); -+ -+- (NSException *) createGCSFolderTableWithName: (NSString *) tableName -+{ -+ NSString *sql; -+ -+ sql = [NSString stringWithFormat: sqlFolderFormat, tableName]; -+ -+ return [self evaluateExpressionX: sql]; -+} -+ -+- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName -+{ -+ NSString *sql; -+ -+ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName]; -+ -+ return [self evaluateExpressionX: sql]; -+} -+ - @end /* PostgreSQL72Channel */ - - @implementation PostgreSQL72Channel(PrimaryKeyGeneration) Index: sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m =================================================================== ---- sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m (révision 1552) +--- sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m (révision 1557) +++ sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m (copie de travail) @@ -140,8 +140,12 @@ @@ -1156,7 +1156,7 @@ Index: sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m static char *iconv_wrapper(id self, char *_src, unsigned _srcLen, Index: sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h =================================================================== ---- sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h (révision 1552) +--- sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h (révision 1557) +++ sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h (copie de travail) @@ -19,6 +19,8 @@ 02111-1307, USA. @@ -1178,7 +1178,7 @@ Index: sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h id entityResolver; Index: sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m =================================================================== ---- sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m (révision 1552) +--- sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m (révision 1557) +++ sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m (copie de travail) @@ -30,6 +30,12 @@ #include @@ -1236,9 +1236,175 @@ Index: sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m self->doc = NULL; } - (void)tearDownParser { +Index: sope-appserver/mod_ngobjweb/config.c +=================================================================== +--- sope-appserver/mod_ngobjweb/config.c (révision 1557) ++++ sope-appserver/mod_ngobjweb/config.c (copie de travail) +@@ -21,7 +21,7 @@ + + #include "common.h" + +-//#define LOG_CONFIG 1 ++#define LOG_CONFIG 0 + + static char *_makeString(char *buf, char *str, int max) { + if (buf == NULL) +Index: sope-appserver/mod_ngobjweb/GNUmakefile +=================================================================== +--- sope-appserver/mod_ngobjweb/GNUmakefile (révision 1557) ++++ sope-appserver/mod_ngobjweb/GNUmakefile (copie de travail) +@@ -81,7 +81,7 @@ + + CFLAGS = -Wall -I. -fPIC \ + $(APXS_CFLAGS) $(APR_CFLAGS) \ +- $(APXS_INCLUDE_DIRS) $(APR_INCLUDE_DIRS) ++ $(APXS_INCLUDE_DIRS) $(APR_INCLUDE_DIRS) -O0 -ggdb + + LDFLAGS = $(APXS_LDFLAGS) $(APR_LDFLAGS) -shared -fPIC + +Index: sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c +=================================================================== +--- sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c (révision 1557) ++++ sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c (copie de travail) +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include "common.h" + #include "NGBufferedDescriptor.h" + + // returns the number of bytes which where read from the buffer +Index: sope-appserver/mod_ngobjweb/handler.c +=================================================================== +--- sope-appserver/mod_ngobjweb/handler.c (révision 1557) ++++ sope-appserver/mod_ngobjweb/handler.c (copie de travail) +@@ -267,7 +267,7 @@ + const char *uri; + unsigned requestContentLength; + void *requestBody; +- ++ + uri = r->uri; + requestContentLength = 0; + requestBody = NULL; +@@ -404,6 +404,9 @@ + "could not create socket in domain %i.", domain); + return DECLINED; + } ++ else ++ ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server, ++ "appFd socket created in domain %i: %d", domain, appFd); + + if ((result = _connectInstance(r, appFd, address, addressLen)) < 0) + return 500; +@@ -646,7 +649,10 @@ + + writeErrorHandler: + if (writeError == 1) { +- if (toApp) NGBufferedDescriptor_free(toApp); ++ if (toApp) { ++ NGBufferedDescriptor_free(toApp); ++ toApp = NULL; ++ } + + ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server, + "socket write error during transfer of HTTP header section"); +@@ -659,7 +665,10 @@ + if (!NGBufferedDescriptor_safeWrite(toApp, + requestBody, + requestContentLength)) { +- if (toApp) NGBufferedDescriptor_free(toApp); ++ if (toApp) { ++ NGBufferedDescriptor_free(toApp); ++ toApp = NULL; ++ } + ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server, + "couldn't transfer HTTP req body to app server (%i bytes)", + contentLength); +@@ -677,7 +686,10 @@ + /* read response line */ + + if (!NGScanResponseLine(toApp, NULL, &statusCode, NULL)) { +- if (toApp) NGBufferedDescriptor_free(toApp); ++ if (toApp) { ++ NGBufferedDescriptor_free(toApp); ++ toApp = NULL; ++ } + ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server, + "error during reading of response line .."); + return 500; +@@ -716,16 +728,8 @@ + } + + // read whole response +- if (!NGBufferedDescriptor_safeRead(toApp, buffer, contentLength)) { +- if (toApp) NGBufferedDescriptor_free(toApp); +- } ++ NGBufferedDescriptor_safeRead(toApp, buffer, contentLength); + +- // close connection to app +- if (toApp) { +- NGBufferedDescriptor_free(toApp); +- toApp = NULL; +- } +- + ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server, + "send response (size=%i)", + contentLength); +@@ -739,15 +743,14 @@ + int result = 0; + int writeCount = 0; + +- do { +- result = NGBufferedDescriptor_read(toApp, buffer, sizeof(buffer)); +- if (result > 0) { +- ap_rwrite(buffer, result, r); +- ap_rflush(r); +- writeCount += result; +- } ++ while ((result = NGBufferedDescriptor_read(toApp, ++ buffer, ++ sizeof(buffer)) ++ > 0)) { ++ ap_rwrite(buffer, result, r); ++ ap_rflush(r); ++ writeCount += result; + } +- while (result > 0); + + if (HEAVY_LOG && (writeCount > 0)) { + ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server, +@@ -756,10 +759,26 @@ + } + } + } +- ++ ++ // close connection to app ++ if (toApp) { ++ NGBufferedDescriptor_free(toApp); ++ toApp = NULL; ++ } ++ + return OK; + } + ++/* int ngobjweb_handler(request_rec *r) { */ ++/* int code; */ ++ ++/* fprintf (stderr, "ngobjweb_handler...\n======================"); */ ++/* code = real_ngobjweb_handler(r); */ ++/* fprintf (stderr, "================ %d\n", code); */ ++ ++/* return code; */ ++/* } */ ++ + #if WITH_LOGGING + #if 0 + static void test(void) { Index: sope-appserver/NGObjWeb/GNUmakefile.postamble =================================================================== ---- sope-appserver/NGObjWeb/GNUmakefile.postamble (révision 1552) +--- sope-appserver/NGObjWeb/GNUmakefile.postamble (révision 1557) +++ sope-appserver/NGObjWeb/GNUmakefile.postamble (copie de travail) @@ -23,14 +23,20 @@ @@ -1267,7 +1433,7 @@ Index: sope-appserver/NGObjWeb/GNUmakefile.postamble -endif Index: sope-appserver/NGObjWeb/WOContext.m =================================================================== ---- sope-appserver/NGObjWeb/WOContext.m (révision 1552) +--- sope-appserver/NGObjWeb/WOContext.m (révision 1557) +++ sope-appserver/NGObjWeb/WOContext.m (copie de travail) @@ -64,11 +64,13 @@ static BOOL testNSURLs = NO; @@ -1307,7 +1473,7 @@ Index: sope-appserver/NGObjWeb/WOContext.m serverURL = [@"http://" stringByAppendingString:host]; Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m =================================================================== ---- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (révision 1552) +--- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (révision 1557) +++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (copie de travail) @@ -216,6 +216,12 @@ assocCount++; @@ -1324,7 +1490,7 @@ Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m Index: sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m =================================================================== ---- sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m (révision 1552) +--- sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m (révision 1557) +++ sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m (copie de travail) @@ -40,6 +40,7 @@ WOAssociation *string; @@ -1354,7 +1520,7 @@ Index: sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m return YES; Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h =================================================================== ---- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h (révision 1552) +--- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h (révision 1557) +++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h (copie de travail) @@ -41,7 +41,8 @@ WOAssociation *pageName; @@ -1368,7 +1534,7 @@ Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h /* 'ivar' associations */ Index: sope-appserver/NGObjWeb/SoObjects/SoObject.m =================================================================== ---- sope-appserver/NGObjWeb/SoObjects/SoObject.m (révision 1552) +--- sope-appserver/NGObjWeb/SoObjects/SoObject.m (révision 1557) +++ sope-appserver/NGObjWeb/SoObjects/SoObject.m (copie de travail) @@ -39,22 +39,34 @@ static int debugLookup = -1; @@ -1519,7 +1685,7 @@ Index: sope-appserver/NGObjWeb/SoObjects/SoObject.m Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m =================================================================== ---- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (révision 1552) +--- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (révision 1557) +++ sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (copie de travail) @@ -31,6 +31,7 @@ #include diff --git a/UI/Common/WODirectAction+SOGo.h b/UI/Common/WODirectAction+SOGo.h index aa518c6d..70b098c7 100644 --- a/UI/Common/WODirectAction+SOGo.h +++ b/UI/Common/WODirectAction+SOGo.h @@ -31,6 +31,10 @@ @interface WODirectAction (SOGoExtension) - (WOResponse *) responseWithStatus: (unsigned int) status; +- (WOResponse *) responseWithStatus: (unsigned int) status + andString: (NSString *) contentString; +- (WOResponse *) responseWithStatus: (unsigned int) status + andJSONRepresentation: (NSObject *) contentObject; - (WOResponse *) responseWith204; - (WOResponse *) redirectToLocation: (NSString *) newLocation; diff --git a/UI/Common/WODirectAction+SOGo.m b/UI/Common/WODirectAction+SOGo.m index 6c1c3adf..e1f31afc 100644 --- a/UI/Common/WODirectAction+SOGo.m +++ b/UI/Common/WODirectAction+SOGo.m @@ -25,6 +25,7 @@ #import #import +#import #import #import @@ -42,6 +43,24 @@ return response; } +- (WOResponse *) responseWithStatus: (unsigned int) status + andString: (NSString *) contentString +{ + WOResponse *response; + + response = [self responseWithStatus: status]; + [response appendContentString: contentString]; + + return response; +} + +- (WOResponse *) responseWithStatus: (unsigned int) status + andJSONRepresentation: (NSObject *) contentObject; +{ + return [self responseWithStatus: status + andString: [contentObject jsonRepresentation]]; +} + - (WOResponse *) responseWith204 { return [self responseWithStatus: 204]; diff --git a/UI/MainUI/SOGoRootPage.m b/UI/MainUI/SOGoRootPage.m index bb696b81..cf295538 100644 --- a/UI/MainUI/SOGoRootPage.m +++ b/UI/MainUI/SOGoRootPage.m @@ -19,6 +19,8 @@ 02111-1307, USA. */ +#import + #import #import #import @@ -35,6 +37,12 @@ #import "SOGoRootPage.h" +@interface SOGoRootPage (crashAdditions) + +- (void) segfault; + +@end + @implementation SOGoRootPage - (void) dealloc @@ -110,4 +118,27 @@ return YES; } +- (id ) crashAction +{ + [self segfault]; + + return nil; +} + +- (id ) exceptionAction +{ + return (id ) + [NSException exceptionWithName: @"ExceptionAction" + reason: @"This exception is brought to you by SOGo" + userInfo: nil]; +} + +- (id ) raisedExceptionAction +{ + [NSException raise: @"ExceptionAction" + format: @"This exception is brought to you by SOGo"]; + + return nil; +} + @end /* SOGoRootPage */ diff --git a/UI/MainUI/product.plist b/UI/MainUI/product.plist index 63e2c5f8..83342e46 100644 --- a/UI/MainUI/product.plist +++ b/UI/MainUI/product.plist @@ -89,6 +89,21 @@ protectedBy = ""; pageName = "SOGoRootPage"; }; + crash = { + protectedBy = ""; + pageName = "SOGoRootPage"; + actionName = "crash"; + }; + exception = { + protectedBy = ""; + pageName = "SOGoRootPage"; + actionName = "exception"; + }; + raisedException = { + protectedBy = ""; + pageName = "SOGoRootPage"; + actionName = "raisedException"; + }; connect = { protectedBy = ""; pageName = "SOGoRootPage"; diff --git a/UI/SOGoUI/UIxComponent.h b/UI/SOGoUI/UIxComponent.h index f0c01908..5897f3aa 100644 --- a/UI/SOGoUI/UIxComponent.h +++ b/UI/SOGoUI/UIxComponent.h @@ -95,7 +95,13 @@ - (WOResourceManager *) pageResourceManager; - (NSString *) urlForResourceFilename: (NSString *) filename; +- (WOResponse *) responseWithStatus: (unsigned int) status; +- (WOResponse *) responseWithStatus: (unsigned int) status + andString: (NSString *) contentString; +- (WOResponse *) responseWithStatus: (unsigned int) status + andJSONRepresentation: (NSObject *) contentObject; - (WOResponse *) responseWith204; +- (WOResponse *) redirectToLocation: (NSString *) newLocation; /* Debugging */ - (BOOL)isUIxDebugEnabled; diff --git a/UI/SOGoUI/UIxComponent.m b/UI/SOGoUI/UIxComponent.m index 50e6bf25..2444791a 100644 --- a/UI/SOGoUI/UIxComponent.m +++ b/UI/SOGoUI/UIxComponent.m @@ -36,6 +36,7 @@ #import #import +#import #import #import #import @@ -584,12 +585,45 @@ static BOOL uixDebugEnabled = NO; return url; } -- (WOResponse *) responseWith204 +- (WOResponse *) responseWithStatus: (unsigned int) status { WOResponse *response; response = [context response]; - [response setStatus: 204]; + [response setStatus: status]; + + return response; +} + +- (WOResponse *) responseWithStatus: (unsigned int) status + andString: (NSString *) contentString +{ + WOResponse *response; + + response = [self responseWithStatus: status]; + [response appendContentString: contentString]; + + return response; +} + +- (WOResponse *) responseWithStatus: (unsigned int) status + andJSONRepresentation: (NSObject *) contentObject; +{ + return [self responseWithStatus: status + andString: [contentObject jsonRepresentation]]; +} + +- (WOResponse *) responseWith204 +{ + return [self responseWithStatus: 204]; +} + +- (WOResponse *) redirectToLocation: (NSString *) newLocation +{ + WOResponse *response; + + response = [self responseWithStatus: 302]; + [response setHeader: newLocation forKey: @"location"]; return response; }