]> err.no Git - sope/blobdiff - sope-appserver/NGObjWeb/WORequestHandler.m
fixed bundle resource lookup on MacOSX, changed resource lookup in
[sope] / sope-appserver / NGObjWeb / WORequestHandler.m
index 88866feb200e075a9b3847f31b1711e1a8bef8d3..a958082d52b570600969baa64d266f147f21bfc1 100644 (file)
@@ -1,20 +1,20 @@
 /*
-  Copyright (C) 2000-2004 SKYRIX Software AG
+  Copyright (C) 2000-2005 SKYRIX Software AG
 
-  This file is part of OpenGroupware.org.
+  This file is part of SOPE.
 
-  OGo is free software; you can redistribute it and/or modify it under
+  SOPE is free software; you can redistribute it and/or modify it under
   the terms of the GNU Lesser General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version.
 
-  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
   License for more details.
 
   You should have received a copy of the GNU Lesser General Public
-  License along with OGo; see the file COPYING.  If not, write to the
+  License along with SOPE; see the file COPYING.  If not, write to the
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
@@ -66,7 +66,7 @@ static NGLogger *perfLogger        = nil;
   NSDateClass = [NSDate class];
 
   lm         = [NGLoggerManager defaultLoggerManager];
-  logger     = [lm loggerForClass:self];
+  logger     = [lm loggerForDefaultKey:@"WODebuggingEnabled"];
   perfLogger = [lm loggerForDefaultKey:@"WOProfileRequestHandler"];
 
   ud                 = [NSUserDefaults standardUserDefaults];
@@ -248,7 +248,8 @@ static NGLogger *perfLogger        = nil;
         
         if (session != nil) {
           if ([session storesIDsInCookies]) {
-            [self debugWithFormat:@"add cookie to session: %@", session];
+            if (logger != nil) /* Note: required! do not remove */
+             [self debugWithFormat:@"add cookie to session: %@", session];
             [self addCookiesForSession:session
                   toResponse:response
                   inContext:context];
@@ -339,49 +340,50 @@ static NGLogger *perfLogger        = nil;
   toResponse:(WOResponse *)_response
   inContext:(WOContext *)_ctx
 {
-  if ([_sn storesIDsInCookies]) {
-    WOApplication *app;
-    NSString *cookieName = nil;
-    WOCookie *cookie     = nil;
-    NSString *uri;
-    NSString *value;
-    
-    app        = [WOApplication application];
-    cookieName = [app name];
-
-    if (!doNotSetCookiePath) {
-      NSString *tmp;
+  WOApplication *app;
+  WOCookie *cookie     = nil;
+  NSString *uri;
+  NSString *value;
+  
+  if (![_sn storesIDsInCookies])
+    return;
+  
+  app = [WOApplication application];
+  
+  // TODO: there is a DUP of this section in OpenGroupware.m to set an
+  //       expiration cookie
+  if (!doNotSetCookiePath) {
+    NSString *tmp;
       
-      if ((uri = [[_ctx request] applicationName]) == nil)
-        uri = [app name];
-      uri = [@"/" stringByAppendingString:uri];
-      if ((tmp = [[_ctx request] adaptorPrefix]))
-        uri = [tmp stringByAppendingString:uri];
-    }
-    else
-      uri = @"/";
-    
-#if 0
-    uri = [_ctx urlSessionPrefix];
-    uri = [_ctx urlWithRequestHandlerKey:
-                  [WOApplication componentRequestHandlerKey]
-                path:@"/"
-                queryString:nil];
+    if ((uri = [[_ctx request] applicationName]) == nil)
+      uri = [app name];
+    uri = [@"/" stringByAppendingString:uri];
+    if ((tmp = [[_ctx request] adaptorPrefix]))
+      uri = [tmp stringByAppendingString:uri];
+  }
+  else
+    uri = @"/";
+  
+#if 0 // TODO: explain!
+  uri = [_ctx urlSessionPrefix];
+  uri = [_ctx urlWithRequestHandlerKey:
+               [WOApplication componentRequestHandlerKey]
+             path:@"/"
+             queryString:nil];
 #endif
     
-    value = [_sn isTerminating]
-      ? (id)@"nil"
-      : [_sn sessionID];
+  value = [_sn isTerminating]
+    ? (id)@"nil"
+    : [_sn sessionID];
     
-    cookie = [WOCookie cookieWithName:cookieName
-                       value:value
-                       path:uri
-                       domain:[_sn domainForIDCookies]
-                       expires:[_sn expirationDateForIDCookies]
-                       isSecure:NO];
-    if (cookie)
-      [_response addCookie:cookie];
-  }
+  cookie = [WOCookie cookieWithName:[app name]
+                    value:value
+                    path:uri
+                    domain:[_sn domainForIDCookies]
+                    expires:[_sn expirationDateForIDCookies]
+                    isSecure:NO];
+  if (cookie != nil)
+    [_response addCookie:cookie];
 }
 
 @end /* WORequestHandler(Cookies) */