]> err.no Git - sope/blob - sope-appserver/NGObjWeb/NGObjWeb/WOContext.h
improved SOPE security exceptions
[sope] / sope-appserver / NGObjWeb / NGObjWeb / WOContext.h
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
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
9   later version.
10
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.
15
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
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 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   /* FORM support */
71   BOOL inForm;
72   id   activeFormElement;
73   
74   NSString *qpJoin;
75   
76   /* tracking component actions */
77   BOOL savePageRequired;
78   
79   /* SOPE */
80   id             clientObject;
81   NSMutableArray *traversalStack;
82   NSString       *soRequestType; // WebDAV, XML-RPC, METHOD
83   id             objectDispatcher;
84   NSString       *pathInfo;
85   id             rootURL;
86   id             objectPermissionCache;
87   id             activeUser;
88   
89 #if WITH_DEALLOC_OBSERVERS
90 @private
91   id             *deallocObservers;
92   unsigned short deallocObserverCount;
93   unsigned short deallocObserverCapacity;
94 #endif
95 }
96
97 + (id)contextWithRequest:(WORequest *)_request;
98 - (id)initWithRequest:(WORequest *)_request;
99 + (id)context;
100 - (id)init;
101
102 /* URLs */
103
104 - (NSURL *)baseURL;
105 - (NSURL *)applicationURL;
106 - (NSURL *)serverURL;
107 - (NSURL *)urlForKey:(NSString *)_key;
108
109 /* variables */
110
111 - (void)setObject:(id)_obj forKey:(NSString *)_key;
112 - (id)objectForKey:(NSString *)_key;
113 - (void)removeObjectForKey:(NSString *)_key;
114 - (void)takeValue:(id)_value forKey:(NSString *)_key;
115 - (id)valueForKey:(NSString *)_key;
116
117 @end
118
119 @interface WOContext(ElementIDs) < WOElementTrackingContext >
120 @end
121
122 @interface WOContext(URLs)
123
124 - (NSString *)componentActionURL;
125
126 - (NSString *)directActionURLForActionNamed:(NSString *)_actionName
127   queryDictionary:(NSDictionary *)_queryDict;
128
129 - (NSString *)urlWithRequestHandlerKey:(NSString *)_key
130   path:(NSString *)_path
131   queryString:(NSString *)_query;
132 - (NSString *)completeURLWithRequestHandlerKey:(NSString *)_key
133   path:(NSString *)_path
134   queryString:(NSString *)_query
135   isSecure:(BOOL)_isSecure
136   port:(int)_port;
137
138 - (NSString *)senderID; // new in WO4
139
140 - (NSString *)queryStringFromDictionary:(NSDictionary *)_queryDict;
141
142 @end
143
144 @interface WOContext(PrivateMethods)
145
146 - (void)setRequestSenderID:(NSString *)_rqsid;
147 - (BOOL)savePageRequired;
148
149 @end
150
151 @interface WOContext(DeprecatedMethodsInWO4)
152
153 - (id)application; // use WOApplication:+application
154
155 - (void)setDistributionEnabled:(BOOL)_flag; // use methods in
156 - (BOOL)isDistributionEnabled;              // WOSession instead
157
158 - (NSString *)url;              // use componentActionURL methods
159 - (NSString *)urlSessionPrefix; // use componentActionURL methods
160
161 @end
162
163 #endif /* __NGObjWeb_WOContext_H__ */