]> err.no Git - sope/blob - sope-appserver/NGObjWeb/SoObjects/SoSubContext.m
added some WebDrive WebDAV properties
[sope] / sope-appserver / NGObjWeb / SoObjects / SoSubContext.m
1 /*
2   Copyright (C) 2002-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
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
9   later version.
10
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.
15
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
19   02111-1307, USA.
20 */
21
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>
28 #include "common.h"
29
30 @implementation SoSubContext
31
32 + (int)version {
33   return [super version] + 0 /* v8 */;
34 }
35 + (void)initialize {
36   NSAssert2([super version] == 8,
37             @"invalid superclass (%@) version %i !",
38             NSStringFromClass([self superclass]), [super version]);
39 }
40
41 - (id)initWithParentContext:(WOContext *)_parent {
42   if ((self = [super init])) {
43     self->parentContext = [_parent retain];
44
45     self->qpJoin = @"&";
46     
47     self->elementID = [[WOElementID alloc] init];
48     self->request   = [[_parent request]  retain];
49     self->response  = [[_parent response] retain];
50     
51     self->traversalStack = [[_parent objectTraversalStack] mutableCopy];
52     self->clientObject   = [[_parent clientObject] retain];
53     
54     self->soRequestType = @"INTERNAL";
55   }
56   return self;
57 }
58 - (id)init {
59   return [self initWithParentContext:[[WOApplication application] context]];
60 }
61
62 - (void)dealloc {
63   [self->parentContext release];
64   [super dealloc];
65 }
66
67 /* accessors */
68
69 - (WOContext *)parentContext {
70   return self->parentContext;
71 }
72 - (WOContext *)rootContext {
73   return [[self parentContext] rootContext];
74 }
75
76 /* overrides */
77
78 - (NSString *)contextID {
79   /* a subcontext currently has no ID */
80   /*
81     NOTE: a subcontext may *NOT* have the same ID as the parent-context,
82           otherwise havoc is done in component activation
83   */
84   return nil;
85 }
86
87 - (void)setSession:(WOSession *)_session {
88   [self logWithFormat:@"ignoring -setSession:%@ on sub-context", _session];
89 }
90 - (id)session {
91   return [[self parentContext] session];
92 }
93
94 - (BOOL)hasSession {
95   return [[self parentContext] hasSession];
96 }
97 - (BOOL)savePageRequired {
98   return [[self parentContext] savePageRequired];
99 }
100
101 - (void)setPage:(WOComponent *)_page {
102   [self logWithFormat:@"ignoring -setPage:%@ on sub-context", _page];
103 }
104 - (id)page {
105   return [[self parentContext] page];
106 }
107
108 - (NSURL *)serverURL {
109   return [[self parentContext] serverURL];
110 }
111 - (NSURL *)baseURL {
112   return [[self parentContext] baseURL];
113 }
114 - (NSURL *)applicationURL {
115   return [[self parentContext] applicationURL];
116 }
117 - (NSURL *)urlForKey:(NSString *)_key {
118   return [[self parentContext] urlForKey:_key];
119 }
120
121 /* description */
122
123 - (NSString *)description {
124   return [NSString stringWithFormat:
125                      @"<0x%08X[%@]: parent=0x%08X>",
126                      (unsigned)self, NSStringFromClass([self class]),
127                      [self parentContext]];
128 }
129
130 @end /* SoSubContext */