2 Copyright (C) 2002-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE 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 SOPE 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 SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include "SoSubContext.h"
23 #include "WOElementID.h"
24 #include "WOContext+SoObjects.h"
25 #include <NGObjWeb/WOApplication.h>
26 #include <NGObjWeb/WORequest.h>
27 #include <NGObjWeb/WOResponse.h>
30 @implementation SoSubContext
33 return [super version] + 0 /* v7 */;
36 NSAssert2([super version] == 7,
37 @"invalid superclass (%@) version %i !",
38 NSStringFromClass([self superclass]), [super version]);
41 - (id)initWithParentContext:(WOContext *)_parent {
42 if ((self = [super init])) {
43 self->parentContext = [_parent retain];
47 self->elementID = [[WOElementID alloc] init];
48 self->request = [[_parent request] retain];
49 self->response = [[_parent response] retain];
51 self->traversalStack = [[_parent objectTraversalStack] mutableCopy];
52 self->clientObject = [[_parent clientObject] retain];
54 self->soRequestType = @"INTERNAL";
59 return [self initWithParentContext:[[WOApplication application] context]];
63 [self->parentContext release];
69 - (WOContext *)parentContext {
70 return self->parentContext;
72 - (WOContext *)rootContext {
73 return [[self parentContext] rootContext];
78 - (NSString *)contextID {
79 /* a subcontext currently has no ID */
81 NOTE: a subcontext may *NOT* have the same ID as the parent-context,
82 otherwise havoc is done in component activation
87 - (void)setSession:(WOSession *)_session {
88 [self logWithFormat:@"ignoring -setSession:%@ on sub-context", _session];
90 - (WOSession *)session {
91 return [[self parentContext] session];
95 return [[self parentContext] hasSession];
97 - (BOOL)savePageRequired {
98 return [[self parentContext] savePageRequired];
101 - (void)setPage:(WOComponent *)_page {
102 [self logWithFormat:@"ignoring -setPage:%@ on sub-context", _page];
104 - (WOComponent *)page {
105 return [[self parentContext] page];
108 - (NSURL *)serverURL {
109 return [[self parentContext] serverURL];
112 return [[self parentContext] baseURL];
114 - (NSURL *)applicationURL {
115 return [[self parentContext] applicationURL];
117 - (NSURL *)urlForKey:(NSString *)_key {
118 return [[self parentContext] urlForKey:_key];
123 - (NSString *)description {
124 return [NSString stringWithFormat:
125 @"<0x%08X[%@]: parent=0x%08X>",
126 (unsigned)self, NSStringFromClass([self class]),
127 [self parentContext]];
130 @end /* SoSubContext */