2 Copyright (C) 2000-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 #ifndef __NGObjWeb_WOContext_H__
23 #define __NGObjWeb_WOContext_H__
25 #import <Foundation/NSObject.h>
26 #include <NGObjWeb/WOPageGenerationContext.h>
27 #include <NGObjWeb/WOElementTrackingContext.h>
32 The WOContext is the central object for processing a single HTTP
33 transaction. It manages request, response, the session, the current
34 element id for component actions, the active component etc.
37 @class NSString, NSMutableDictionary, NSMutableArray, NSMutableSet;
38 @class NSArray, NSDictionary, NSURL;
39 @class WOApplication, WOSession, WOComponent, WORequest, WOResponse;
42 #define NGObjWeb_MAX_COMPONENT_NESTING_DEPTH 50
44 @interface WOContext : NSObject < WOPageGenerationContext >
47 WOApplication *application; // non-retained
51 NSMutableDictionary *variables;
54 NSMutableSet *awakeComponents; // components that were woken up
61 WOElementID *elementID;
62 WOElementID *reqElementID;
63 NSString *urlPrefix; /* cached URL prefix */
66 id componentStack[NGObjWeb_MAX_COMPONENT_NESTING_DEPTH];
67 id contentStack[NGObjWeb_MAX_COMPONENT_NESTING_DEPTH];
68 signed char componentStackCount;
74 @public /* need fast access to generation flags */
77 int savePageRequired:1; /* tracking component actions */
79 int xmlStyleEmptyElements:1;
80 int allowEmptyAttributes:1;
87 NSMutableArray *traversalStack;
88 NSString *soRequestType; // WebDAV, XML-RPC, METHOD
92 id objectPermissionCache;
95 #if WITH_DEALLOC_OBSERVERS
98 unsigned short deallocObserverCount;
99 unsigned short deallocObserverCapacity;
103 + (id)contextWithRequest:(WORequest *)_request;
104 - (id)initWithRequest:(WORequest *)_request;
111 - (NSURL *)applicationURL;
112 - (NSURL *)serverURL;
113 - (NSURL *)urlForKey:(NSString *)_key;
115 - (void)setGenerateXMLStyleEmptyElements:(BOOL)_flag;
116 - (BOOL)generateXMLStyleEmptyElements;
117 - (void)setGenerateEmptyAttributes:(BOOL)_flag;
118 - (BOOL)generateEmptyAttributes;
122 - (void)setObject:(id)_obj forKey:(NSString *)_key;
123 - (id)objectForKey:(NSString *)_key;
124 - (void)removeObjectForKey:(NSString *)_key;
125 - (void)takeValue:(id)_value forKey:(NSString *)_key;
126 - (id)valueForKey:(NSString *)_key;
130 @interface WOContext(ElementIDs) < WOElementTrackingContext >
133 @interface WOContext(URLs)
135 - (NSString *)componentActionURL;
137 - (NSString *)directActionURLForActionNamed:(NSString *)_actionName
138 queryDictionary:(NSDictionary *)_queryDict;
140 - (NSString *)urlWithRequestHandlerKey:(NSString *)_key
141 path:(NSString *)_path
142 queryString:(NSString *)_query;
143 - (NSString *)completeURLWithRequestHandlerKey:(NSString *)_key
144 path:(NSString *)_path
145 queryString:(NSString *)_query
146 isSecure:(BOOL)_isSecure
149 - (NSString *)senderID; // new in WO4
151 - (NSString *)queryStringFromDictionary:(NSDictionary *)_queryDict;
153 - (void)setQueryPathSeparator:(NSString *)_sp;
154 - (NSString *)queryPathSeparator;
158 @interface WOContext(PrivateMethods)
160 - (void)setRequestSenderID:(NSString *)_rqsid;
161 - (BOOL)savePageRequired;
165 @interface WOContext(DeprecatedMethodsInWO4)
167 - (id)application; // use WOApplication:+application
169 - (void)setDistributionEnabled:(BOOL)_flag; // use methods in
170 - (BOOL)isDistributionEnabled; // WOSession instead
172 - (NSString *)url; // use componentActionURL methods
173 - (NSString *)urlSessionPrefix; // use componentActionURL methods
177 @interface WOContext(SOPEAdditions)
179 /* languages for resource lookup (non-WO) */
181 - (NSArray *)resourceLookupLanguages;
185 #endif /* __NGObjWeb_WOContext_H__ */