SEL setSel = _getSetSel(info->ckey, info->keyLen);
if (![object respondsToSelector:setSel]) {
-#if 1
+#if 0
[self errorWithFormat:@"Could not set value for key '%s', "
- @"object %@ doesn't respond to %@.",
- self, info->ckey, object,
- setSel ? NSStringFromSelector(setSel) : @"<NULL>"];
+ @"object %@ doesn't respond to %@.",
+ info->ckey, object,
+ setSel ? NSStringFromSelector(setSel) : @"<NULL>"];
#endif
return NO;
}
- else {
+
+ /* object responds to the selector */
+ {
WOSetMethodType sm;
if ((sm.method = [object methodForSelector:setSel]) != NULL) {
+2006-03-14 Helge Hess <helge.hess@opengroupware.org>
+
+ * v4.5.224
+
+ * Associations/WOKeyPathAssociation.m: fixed a crasher in a debug log
+
+ * WOContext.m: changed to generate relative component action URLs in
+ case the request already was a valid component action URL. added a
+ way to detect whether the context session is a fresh one.
+
+ * WOComponentRequestHandler.m, WOApplication.m: minor code cleanups,
+ use -isNotEmpty
+
2006-03-12 Helge Hess <helge.hess@opengroupware.org>
* v4.5.223
#endif
return;
-#if __APPLE__
+#if __APPLE__
+ // TODO: same issue with gcc 4.1 on Linux ...
// make Tiger GCC happy
[super dealloc];
#endif
return self->method;
}
- (NSString *)methodName {
- return (self->method < NGHttpMethod_last) ? methodNames[self->method] : nil;
+ return (self->method < NGHttpMethod_last)
+ ? methodNames[self->method] : (NSString *)nil;
}
- (NSString *)path {
/*
Copyright (C) 2000-2005 SKYRIX Software AG
+ Copyright (C) 2006 Helge Hess
This file is part of SOPE.
int inForm:1;
int xmlStyleEmptyElements:1;
int allowEmptyAttributes:1;
- int reserved:28;
+ int hasNewSession:1; /* session was created during the run */
+ int reserved:27;
} wcFlags;
@protected
@interface WOContext(SOPEAdditions)
+- (BOOL)hasNewSession;
+
/* languages for resource lookup (non-WO) */
- (NSArray *)resourceLookupLanguages;
# version file
-SUBMINOR_VERSION:=223
+SUBMINOR_VERSION:=224
# v4.5.214 requires libNGExtensions v4.5.179
# v4.5.122 requires libNGExtensions v4.5.153
/*
Copyright (C) 2000-2005 SKYRIX Software AG
+ Copyright (C) 2006 Helge Hess
This file is part of SOPE.
pi = [NSProcessInfo processInfo];
env = [pi environment];
- if ([env objectForKey:@"GNUSTEP_SYSTEM_ROOT"] != nil) {
+ if ([[env objectForKey:@"GNUSTEP_SYSTEM_ROOT"] isNotNull]) {
isFlattened = [[[env objectForKey:@"GNUSTEP_FLATTENED"]
lowercaseString] isEqualToString:@"yes"];
}
- (id)initWithName:(NSString *)_name {
[WOApplication _initializeWOApp];
- if ((self = [super init])) {
+ if ((self = [super init]) != nil) {
NSUserDefaults *ud;
WORequestHandler *rh;
NSString *rk;
WOSession *sn;
sn = [self createSessionForRequest:[_ctx request]];
- [_ctx setSession:sn];
+ [_ctx setNewSession:sn];
if ([sn respondsToSelector:@selector(prepare)]) {
#if DEBUG
/* first look into form values */
if ((sessionId = [_request formValueForKey:WORequestValueSessionID])!=nil) {
- if ([sessionId length] > 0)
+ if ([sessionId isNotEmpty])
return sessionId;
}
e = [(id)sessionId objectEnumerator];
while ((sessionId = [e nextObject]) != nil) {
- if ([sessionId length] > 0 && ![sessionId isEqual:@"nil"])
+ if ([sessionId isNotEmpty] && ![sessionId isEqual:@"nil"])
return sessionId;
}
}
else {
- if ([sessionId length] > 0 && ![sessionId isEqual:@"nil"])
+ if ([sessionId isNotEmpty] && ![sessionId isEqual:@"nil"])
return sessionId;
}
}
}
else {
session = [store restoreSessionWithID:_sid request:[_ctx request]];
- if (session) {
+ if ([session isNotNull]) {
[_ctx setSession:session];
[session _awakeWithContext:_ctx];
}
ud = [NSUserDefaults standardUserDefaults];
p = [ud stringForKey:@"WODefaultResourceManager"];
- rmClass = ([p length] == 0)
- ? [WOResourceManager class]
- : NSClassFromString(p);
+ rmClass = [p isNotEmpty]
+ ? NSClassFromString(p)
+ : [WOResourceManager class];
if (rmClass == Nil) {
[self errorWithFormat:
- (WOResponse *)restoreSessionWithID:(NSString *)_sid
inContext:(WOContext *)_ctx
{
- WOApplication *app = [WOApplication application];
+ WOApplication *app;
WOSession *session;
+ app = [WOApplication application];
if (_sid == nil) {
// invalid session ID (or no session-ID ?!, which is no error ?) */
return [app handleSessionRestorationErrorInContext:_ctx];
session/context.element-id
*/
- if ([handlerPath length] > 0) {
+ if ([handlerPath isNotEmpty]) {
NSArray *spath = [_request requestHandlerPathArray];
-
+
if ([spath count] > 1)
[context setRequestSenderID:[spath objectAtIndex:1]];
- if ([spath count] > 0)
+ if ([spath isNotEmpty])
sessionID = [spath objectAtIndex:0];
}
- if ([sessionID length] == 0)
+ if (![sessionID isNotEmpty])
sessionID = [application sessionIDFromRequest:_request];
#if 1
[application awake];
/* restore or create session */
- if ([sessionID isNotNull]) {
+ if ([sessionID isNotEmpty]) {
if ((response = [self restoreSessionWithID:sessionID inContext:context]))
session = nil;
else {
/*
Copyright (C) 2000-2005 SKYRIX Software AG
+ Copyright (C) 2006 Helge Hess
This file is part of SOPE.
- (WODynamicElement *)componentContent;
- (void)setSession:(WOSession *)_session;
+- (void)setNewSession:(WOSession *)_session;
- (void)setPage:(WOComponent *)_page;
- (void)setResponse:(WOResponse *)_response;
/*
- Copyright (C) 2000-2005 SKYRIX Software AG
+ Copyright (C) 2000-2006 SKYRIX Software AG
+ Copyright (C) 2006 Helge Hess
This file is part of SOPE.
#include <NGObjWeb/WORequest.h>
#include <NGObjWeb/WOResponse.h>
#include <NGObjWeb/WOSession.h>
-#import <EOControl/EONull.h>
+#include <Foundation/NSNull.h>
#include "WOElementID.h"
#include "common.h"
#include <time.h>
[super dealloc];
}
+/* session */
+
- (void)setSession:(WOSession *)_session {
ASSIGN(self->session, _session);
}
+- (void)setNewSession:(WOSession *)_session {
+ [self setSession:_session];
+ self->wcFlags.hasNewSession = 1;
+}
- (id)session {
- // in WO4 -session creates a new session if none is associated
+ /* in WO4 -session creates a new session if none is associated */
if (self->session == nil) {
[[self application] _initializeSessionInContext:self];
- if (self->session == nil)
+ if (self->session == nil) {
[self logWithFormat:@"%s: missing session for context ..",
__PRETTY_FUNCTION__];
+ }
}
return self->session;
- (BOOL)hasSession {
return (self->session != nil) ? YES : NO;
}
+- (BOOL)hasNewSession {
+ if (!self->wcFlags.hasNewSession)
+ return NO;
+ return [self hasSession];
+}
- (BOOL)savePageRequired {
return self->wcFlags.savePageRequired ? YES : NO;
return;
else if (WOGetKVCGetMethod(self, _key) == NULL) {
if (_value == nil)
- _value = [EONull null];
+ _value = [NSNull null];
if (self->variables == nil) {
self->variables =
// 26% -urlWithRequestHandler...
// 21% -elementID (was 40% !! :-)
// ~20% mutable string ops
+
+ /*
+ This makes the request handler save the page in the session at the
+ end of the request (only necessary if the page generates URLs which
+ refer the context).
+ */
+ self->wcFlags.savePageRequired = 1;
+
if (newCURLStyle) {
+ // TODO: who uses that? Its not enabled per default
+ // TODO: what does this do?
NSMutableString *qs;
NSString *p;
- self->wcFlags.savePageRequired = 1;
qs = [MutableStrClass stringWithCapacity:64];
[qs appendString:WORequestValueSenderID];
static NSMutableString *url = nil; // THREAD
static IMP addStr = NULL;
NSString *s;
+ NSString *coRqhKey;
+
+ coRqhKey = [WOAppClass componentRequestHandlerKey];
+
+ /*
+ Optimization: use relative URL if the request already was a component
+ action (with a valid session)
+ */
+ if (!self->wcFlags.hasNewSession) {
+ if ([[self->request requestHandlerKey] isEqualToString:coRqhKey])
+ return [self->elementID elementID];
+ }
- self->wcFlags.savePageRequired = 1;
if (url == nil) {
url = [[MutableStrClass alloc] initWithCapacity:256];
addStr = [url methodForSelector:@selector(appendString:)];
}
else
[url setString:@"/"];
-
+
/*
Note: component actions *always* require sessions to be able to locate
the request component !
addStr(url, @selector(appendString:), @"/");
addStr(url, @selector(appendString:), [self->elementID elementID]);
- s = [self urlWithRequestHandlerKey:
- [WOAppClass componentRequestHandlerKey]
+ s = [self urlWithRequestHandlerKey:coRqhKey
path:url queryString:nil];
return s;
}