]> err.no Git - sope/blob - sope-appserver/NGObjWeb/NGObjWeb/WOContext.h
bugfix, bumped dyld versions
[sope] / sope-appserver / NGObjWeb / NGObjWeb / WOContext.h
1 /*
2   Copyright (C) 2000-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 #ifndef __NGObjWeb_WOContext_H__
23 #define __NGObjWeb_WOContext_H__
24
25 #import <Foundation/NSObject.h>
26 #include <NGObjWeb/WOPageGenerationContext.h>
27 #include <NGObjWeb/WOElementTrackingContext.h>
28
29 /*
30   WOContext
31   
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.
35 */
36
37 @class NSString, NSMutableDictionary, NSMutableArray, NSMutableSet;
38 @class NSArray, NSDictionary, NSURL;
39 @class WOApplication, WOSession, WOComponent, WORequest, WOResponse;
40 @class WOElementID;
41
42 #define NGObjWeb_MAX_COMPONENT_NESTING_DEPTH 50
43
44 @interface WOContext : NSObject < WOPageGenerationContext >
45 {
46 @protected
47   WOApplication       *application;     // non-retained
48   NSString            *ctxId;
49   WORequest           *request;
50   WOResponse          *response;
51   NSMutableDictionary *variables;
52   WOComponent         *page;
53   WOSession           *session;
54   NSMutableSet        *awakeComponents; // components that were woken up
55   
56   /* URLs */
57   NSURL               *baseURL;
58   NSURL               *appURL;
59   
60   /* element ids */
61   WOElementID *elementID;
62   WOElementID *reqElementID;
63   NSString    *urlPrefix; /* cached URL prefix */
64   
65   /* component stack */
66   id          componentStack[NGObjWeb_MAX_COMPONENT_NESTING_DEPTH];
67   id          contentStack[NGObjWeb_MAX_COMPONENT_NESTING_DEPTH];
68   signed char componentStackCount;
69   
70   /* misc */
71   id       activeFormElement;
72   NSString *qpJoin;
73   
74 @public /* need fast access to generation flags */
75   /* flags */
76   struct {
77     int savePageRequired:1; /* tracking component actions */
78     int inForm:1;
79     int xmlStyleEmptyElements:1;
80     int allowEmptyAttributes:1;
81     int reserved:28;
82   } wcFlags;
83   
84 @protected
85   /* SOPE */
86   id             clientObject;
87   NSMutableArray *traversalStack;
88   NSString       *soRequestType; // WebDAV, XML-RPC, METHOD
89   id             objectDispatcher;
90   NSString       *pathInfo;
91   id             rootURL;
92   id             objectPermissionCache;
93   id             activeUser;
94   
95 #if WITH_DEALLOC_OBSERVERS
96 @private
97   id             *deallocObservers;
98   unsigned short deallocObserverCount;
99   unsigned short deallocObserverCapacity;
100 #endif
101 }
102
103 + (id)contextWithRequest:(WORequest *)_request;
104 - (id)initWithRequest:(WORequest *)_request;
105 + (id)context;
106 - (id)init;
107
108 /* URLs */
109
110 - (NSURL *)baseURL;
111 - (NSURL *)applicationURL;
112 - (NSURL *)serverURL;
113 - (NSURL *)urlForKey:(NSString *)_key;
114
115 - (void)setGenerateXMLStyleEmptyElements:(BOOL)_flag;
116 - (BOOL)generateXMLStyleEmptyElements;
117 - (void)setGenerateEmptyAttributes:(BOOL)_flag;
118 - (BOOL)generateEmptyAttributes;
119
120 /* variables */
121
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;
127
128 @end
129
130 @interface WOContext(ElementIDs) < WOElementTrackingContext >
131 @end
132
133 @interface WOContext(URLs)
134
135 - (NSString *)componentActionURL;
136
137 - (NSString *)directActionURLForActionNamed:(NSString *)_actionName
138   queryDictionary:(NSDictionary *)_queryDict;
139
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
147   port:(int)_port;
148
149 - (NSString *)senderID; // new in WO4
150
151 - (NSString *)queryStringFromDictionary:(NSDictionary *)_queryDict;
152
153 - (void)setQueryPathSeparator:(NSString *)_sp;
154 - (NSString *)queryPathSeparator;
155
156 @end
157
158 @interface WOContext(PrivateMethods)
159
160 - (void)setRequestSenderID:(NSString *)_rqsid;
161 - (BOOL)savePageRequired;
162
163 @end
164
165 @interface WOContext(DeprecatedMethodsInWO4)
166
167 - (id)application; // use WOApplication:+application
168
169 - (void)setDistributionEnabled:(BOOL)_flag; // use methods in
170 - (BOOL)isDistributionEnabled;              // WOSession instead
171
172 - (NSString *)url;              // use componentActionURL methods
173 - (NSString *)urlSessionPrefix; // use componentActionURL methods
174
175 @end
176
177 @interface WOContext(SOPEAdditions)
178
179 /* languages for resource lookup (non-WO) */
180
181 - (NSArray *)resourceLookupLanguages;
182
183 @end
184
185 #endif /* __NGObjWeb_WOContext_H__ */