2 Copyright (C) 2002-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include "SoSubContext.h"
24 #include "WOElementID.h"
25 #include "WOContext+SoObjects.h"
26 #include <NGObjWeb/WOApplication.h>
27 #include <NGObjWeb/WORequest.h>
28 #include <NGObjWeb/WOResponse.h>
31 @implementation SoSubContext
34 return [super version] + 0 /* v7 */;
37 NSAssert2([super version] == 7,
38 @"invalid superclass (%@) version %i !",
39 NSStringFromClass([self superclass]), [super version]);
42 - (id)initWithParentContext:(WOContext *)_parent {
43 if ((self = [super init])) {
44 self->parentContext = [_parent retain];
48 self->elementID = [[WOElementID alloc] init];
49 self->request = [[_parent request] retain];
50 self->response = [[_parent response] retain];
52 self->traversalStack = [[_parent objectTraversalStack] mutableCopy];
53 self->clientObject = [[_parent clientObject] retain];
55 self->soRequestType = @"INTERNAL";
60 return [self initWithParentContext:[[WOApplication application] context]];
64 [self->parentContext release];
70 - (WOContext *)parentContext {
71 return self->parentContext;
73 - (WOContext *)rootContext {
74 return [[self parentContext] rootContext];
79 - (NSString *)contextID {
80 /* a subcontext currently has no ID */
82 NOTE: a subcontext may *NOT* have the same ID as the parent-context,
83 otherwise havoc is done in component activation
88 - (void)setSession:(WOSession *)_session {
89 [self logWithFormat:@"ignoring -setSession:%@ on sub-context", _session];
91 - (WOSession *)session {
92 return [[self parentContext] session];
96 return [[self parentContext] hasSession];
98 - (BOOL)savePageRequired {
99 return [[self parentContext] savePageRequired];
102 - (void)setPage:(WOComponent *)_page {
103 [self logWithFormat:@"ignoring -setPage:%@ on sub-context", _page];
105 - (WOComponent *)page {
106 return [[self parentContext] page];
109 - (NSURL *)serverURL {
110 return [[self parentContext] serverURL];
113 return [[self parentContext] baseURL];
115 - (NSURL *)applicationURL {
116 return [[self parentContext] applicationURL];
118 - (NSURL *)urlForKey:(NSString *)_key {
119 return [[self parentContext] urlForKey:_key];
124 - (NSString *)description {
125 return [NSString stringWithFormat:
126 @"<0x%08X[%@]: parent=0x%08X>",
127 (unsigned)self, NSStringFromClass([self class]),
128 [self parentContext]];
131 @end /* SoSubContext */