* added GSWeb/GSWApplication+Defaults.h

* GSWeb/GNUmakefile: use -Werror
* GSWeb/GSWFileUpload.* added multiple file support
* Testing/DynamicElements/FileUpload1Page.wo added multiple file support
* GSWeb/* fixed warnings on Mountain Lion



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@36200 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2013-02-27 04:27:07 +00:00
parent 041da71850
commit 2658ffe6b6
61 changed files with 1099 additions and 1054 deletions

View file

@ -1,3 +1,10 @@
2013-02-26 David Wetzel <dave@turbocat.de>
* added GSWeb/GSWApplication+Defaults.h
* GSWeb/GNUmakefile: use -Werror
* GSWeb/GSWFileUpload.* added multiple file support
* Testing/DynamicElements/FileUpload1Page.wo added multiple file support
* GSWeb/* fixed warnings on Mountain Lion
2011-05-13 David Wetzel <dave@turbocat.de>
* GSWAdaptors/Apache2/mod_gsw.c
modified find_app_by_name() wen dealing with single instances

View file

@ -397,6 +397,6 @@ ifeq ($(doc),yes)
include $(GNUSTEP_MAKEFILES)/documentation.make
endif
ADDITIONAL_OBJCFLAGS = -Werror-implicit-function-declaration
ADDITIONAL_OBJCFLAGS = -Werror-implicit-function-declaration -Werror
-include Makefile.postamble

View file

@ -70,8 +70,6 @@
-(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)aContext;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext;
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext;

View file

@ -309,19 +309,19 @@ static NSString * static_tempQueryKey = nil;
}
//--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext
{
GSWElement* element=nil;
NSString* senderID=nil;
NSString* elementID=nil;
BOOL disabledInContext=NO;
BOOL isInForm=NO;
BOOL XYValues=NO;
BOOL thisOne=NO;
GSWComponent* component=nil;
int x=0;
int y=0;
NSObject <GSWActionResults> * results = nil;
NSString* senderID=nil;
NSString* elementID=nil;
BOOL disabledInContext=NO;
BOOL isInForm=NO;
BOOL XYValues=NO;
BOOL thisOne=NO;
GSWComponent* component=nil;
NSInteger x=0;
NSInteger y=0;
component=GSWContext_component(aContext);
@ -427,13 +427,13 @@ static NSString * static_tempQueryKey = nil;
if (actionAssociation)
{
[aContext _setActionInvoked:YES];
element=[actionAssociation valueInComponent:component];
NSAssert4(!element || [element isKindOfClass:[GSWElement class]],
results = (NSObject <GSWActionResults> *) [actionAssociation valueInComponent:component];
NSAssert4(!results || [results isKindOfClass:[GSWElement class]],
@"actionAssociation=%@, component=%@ Element is a %@ not a GSWElement: %@",
actionAssociation,
component,
[element class],
element);
[results class],
results);
}
else
{
@ -445,48 +445,48 @@ static NSString * static_tempQueryKey = nil;
else if (_action)
{
[aContext _setActionInvoked:YES];
element=[_action valueInComponent:component];
NSAssert4(!element || [element isKindOfClass:[GSWElement class]],
results = (NSObject <GSWActionResults> *)[_action valueInComponent:component];
NSAssert4(!results || [results isKindOfClass:[GSWElement class]],
@"_action=%@, component=%@ Element is a %@ not a GSWElement: %@",
_action,
component,
[element class],
element);
[results class],
results);
}
else
{
//NSDebugMLLog0(@"gswdync",@"GSWActiveImage Couldn't trigger action.");
};
};
if (!element)
if (!results)
{
element=[aContext page];
NSAssert2(!element || [element isKindOfClass:[GSWElement class]],
results=[aContext page];
NSAssert2(!results || [results isKindOfClass:[GSWElement class]],
@"Element is a %@ not a GSWElement: %@",
[element class],
element);
[results class],
results);
};
}
else
{
element=[super invokeActionForRequest:request
inContext:aContext];
NSAssert2(!element || [element isKindOfClass:[GSWElement class]],
{
results = (NSObject <GSWActionResults> *) [super invokeActionForRequest:request
inContext:aContext];
NSAssert2(!results || [results isKindOfClass:[GSWElement class]],
@"Element is a %@ not a GSWElement: %@",
[element class],
element);
};
[results class],
results);
}
}
else
{
element=[super invokeActionForRequest:request
inContext:aContext];
NSAssert2(!element || [element isKindOfClass:[GSWElement class]],
results = (NSObject <GSWActionResults> *) [super invokeActionForRequest:request
inContext:aContext];
NSAssert2(!results || [results isKindOfClass:[GSWElement class]],
@"Element is a %@ not a GSWElement: %@",
[element class],
element);
[results class],
results);
};
return element;
return results;
};
-(void)appendAttributesToResponse:(GSWResponse*) response

View file

@ -0,0 +1,57 @@
/** GSWApplication+Defaults.h - <title>GSWeb: GSWApplication+Defaults.h</title>
Copyright (C) 2013 Free Software Foundation, Inc.
Written by: David Wetzel <dave@turbocat.de>
$Revision: 30698 $
$Date: 2010-06-13 21:19:25 -0700 (So, 13 Jun 2010) $
This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</license>
**/
// $Id: GSWToggle.h 30698 2010-06-14 04:19:25Z dwetzel $
#ifndef _GSWApplication_Defaults_h__
#define _GSWApplication_Defaults_h__
@interface GSWApplication (GSWApplicationDefaults)
+(void)_initUserDefaultsKeys;
+(void)_initRegistrationDomainDefaults;
-(void)_initAdaptorsWithUserDefaults:(NSUserDefaults*)userDefault;
-(NSDictionary*)_argsDictionaryWithUserDefaults:(NSUserDefaults*)userDefault;
-(void)setResponseClassName:(NSString*)className;
-(NSString*)responseClassName;
-(void)setRequestClassName:(NSString*)className;
-(NSString*)requestClassName;
-(void)setContextClassName:(NSString*)className;
-(NSString*)contextClassName;
@end
#endif //_GSWApplication_Defaults_h__

View file

@ -34,6 +34,7 @@
RCS_ID("$Id$")
#include "GSWeb.h"
#include "GSWApplication+Defaults.h"
#include <GNUstepBase/NSObject+GNUstepBase.h>
@ -63,47 +64,51 @@ static NSUserDefaults *_userDefaults = nil;
void
GSWeb_ApplicationDebugSetChange()
{
static NSString* prevStateString=nil;
NSProcessInfo* processInfo=[NSProcessInfo processInfo];
NSMutableSet* debugSet=[processInfo debugSet];
NSString* debugSetConfigFilePath=nil;
NSString* newStateString=nil;
BOOL change=NO;
static NSString * prevStateString=nil;
NSProcessInfo * processInfo=[NSProcessInfo processInfo];
NSMutableSet * debugSet=[processInfo debugSet];
NSString * debugSetConfigFilePath = nil;
NSString * newStateString = nil;
BOOL change=NO;
NSStringEncoding usedEncoding;
NSError * error = nil;
debugSetConfigFilePath = [GSWApplication debugSetConfigFilePath];
NSDebugFLog(@"debugSetConfigFilePath=%@", debugSetConfigFilePath);
debugSetConfigFilePath = [GSWApplication debugSetConfigFilePath];
NSDebugFLog(@"debugSetConfigFilePath=%@", debugSetConfigFilePath);
if (debugSetConfigFilePath)
newStateString = [NSString stringWithContentsOfFile:
[GSWApplication debugSetConfigFilePath]];
if (debugSetConfigFilePath) {
newStateString = [NSString stringWithContentsOfFile:[GSWApplication debugSetConfigFilePath]
usedEncoding:&usedEncoding
error:&error];
NSDebugFLog(@"debugSet=%@", debugSet);
NSDebugFLog(@"newStateString=%@", newStateString);
NSDebugFLog(@"prevStateString=%@", prevStateString);
}
NSDebugFLog(@"debugSet=%@", debugSet);
NSDebugFLog(@"newStateString=%@", newStateString);
NSDebugFLog(@"prevStateString=%@", prevStateString);
if (newStateString)
change =! [newStateString isEqualToString: prevStateString];
else if (prevStateString)
change =! [prevStateString isEqualToString: newStateString];
if (newStateString)
change =! [newStateString isEqualToString: prevStateString];
else if (prevStateString)
change =! [prevStateString isEqualToString: newStateString];
NSDebugFLog(@"change=%d",change);
NSDebugFLog(@"change=%d",change);
if (change)
if (change)
{
NSArray* pList=[newStateString propertyList];
[debugSet removeAllObjects];
if (pList && [pList isKindOfClass:[NSArray class]])
NSArray* pList=[newStateString propertyList];
[debugSet removeAllObjects];
if (pList && [pList isKindOfClass:[NSArray class]])
{
int count=[pList count];
int i=0;
for(i=0;i<count;i++)
int count=[pList count];
int i=0;
for(i=0;i<count;i++)
{
[debugSet addObject:[pList objectAtIndex:i]];
};
};
ASSIGN(prevStateString,newStateString);
};
};
[debugSet addObject:[pList objectAtIndex:i]];
}
}
ASSIGN(prevStateString,newStateString);
}
}
void
GSWApplicationSetDebugSetOption(NSString* opt)
@ -526,27 +531,27 @@ GSWeb_DestroyGlobalAppDefaultOptions(void)
They may be merged later. */
#define INIT_DFLT_OBJ(name,opt) \
if (_dflt_init_##name == NO) { \
id key = [NSString stringWithCString: #name]; \
id key = [NSString stringWithCString: #name encoding:NSUTF8StringEncoding]; \
id val = [NSUSERDEFAULTS objectForKey: opt]; \
TAKEVALUEFORKEY; }
#define INIT_DFLT_BOOL(name, opt) \
if (_dflt_init_##name == NO) { \
id key = [NSString stringWithCString: #name]; \
id key = [NSString stringWithCString: #name encoding:NSUTF8StringEncoding]; \
BOOL v = [NSUSERDEFAULTS boolForKey: opt]; \
id val = [NSNumber numberWithBool: v]; \
TAKEVALUEFORKEY; }
#define INIT_DFLT_INT(name, opt) \
if (_dflt_init_##name == NO) { \
id key = [NSString stringWithCString: #name]; \
id key = [NSString stringWithCString: #name encoding:NSUTF8StringEncoding]; \
int v = [NSUSERDEFAULTS integerForKey: opt]; \
id val = GSWIntNumber(v); \
TAKEVALUEFORKEY; }
#define INIT_DFLT_FLT(name, opt) \
if (_dflt_init_##name == NO) { \
id key = [NSString stringWithCString: #name]; \
id key = [NSString stringWithCString: #name encoding:NSUTF8StringEncoding]; \
float v = [NSUSERDEFAULTS floatForKey: opt]; \
id val = [NSNumber numberWithFloat: v]; \
TAKEVALUEFORKEY; }
@ -676,11 +681,6 @@ static NSString *_dflt_requestClassName = nil;
return _dflt_requestClassName;
}
@end
//====================================================================
@implementation GSWApplication (UserDefaults)
//--------------------------------------------------------------------
static BOOL _dflt_init_loadFrameworks = NO;
static NSArray *_dflt_loadFrameworks = nil;
@ -1143,12 +1143,6 @@ static NSNumber *_dflt_sessionTimeOut = nil;
return _dflt_sessionTimeOut;
}
@end
//====================================================================
@implementation GSWApplication (GSWUserDefaults)
//--------------------------------------------------------------------
//NDFN
static BOOL _dflt_init_statusDebuggingEnabled = NO;

View file

@ -203,7 +203,7 @@ GSWEB_EXPORT BOOL WOStrictFlag;
-(GSWContext*)createContextForRequest:(GSWRequest*)aRequest;
-(Class)responseClass;
//-(Class)responseClass;
-(GSWResponse*)createResponseInContext:(GSWContext*)aContext;
@ -230,7 +230,7 @@ GSWEB_EXPORT BOOL WOStrictFlag;
-(int)lockedDecrementActiveSessionCount;
-(int)lockedIncrementActiveSessionCount;
//-(int)lockedIncrementActiveSessionCount;
-(int)_activeSessionsCount;
@ -290,8 +290,8 @@ GSWEB_EXPORT BOOL WOStrictFlag;
-(GSWSession*)restoreSessionWithID:(NSString*)aSessionID
inContext:(GSWContext*)aContext;
-(GSWSession*)_restoreSessionWithID:(NSString*)aSessionID
inContext:(GSWContext*)aContext;
//-(GSWSession*)_restoreSessionWithID:(NSString*)aSessionID
// inContext:(GSWContext*)aContext;
-(void)saveSessionForContext:(GSWContext*)aContext;
@ -362,8 +362,8 @@ GSWEB_EXPORT BOOL WOStrictFlag;
-(void)awake;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext;
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext;
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext;
@ -543,18 +543,11 @@ GSWEB_EXPORT BOOL WOStrictFlag;
-(GSWRequestHandler*)handlerForRequest:(GSWRequest*)aRequest;
+(void)_initRegistrationDomainDefaults;
+(void)_initUserDefaultsKeys;
-(void)_initAdaptorsWithUserDefaults:(NSUserDefaults*)userDefault;
-(NSDictionary*)_argsDictionaryWithUserDefaults:(NSUserDefaults*)userDefault;
-(void)setContextClassName:(NSString*)className;
-(NSString*)contextClassName;
-(void)setResponseClassName:(NSString*)className;
-(NSString*)responseClassName;
-(void)setRequestClassName:(NSString*)className;
-(NSString*)requestClassName;
//-(void)setResponseClassName:(NSString*)className;
//-(NSString*)responseClassName;
//-(void)setRequestClassName:(NSString*)className;
//-(NSString*)requestClassName;
//NDFN
-(id)propListWithResourceNamed:(NSString*)aName
@ -587,13 +580,13 @@ GSWEB_EXPORT BOOL WOStrictFlag;
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages;
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages;
//-(NSDictionary*)stringsTableNamed:(NSString*)aTableName
// inFramework:(NSString*)aFrameworkName
// languages:(NSArray*)languages;
//NDFN
-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages;
//-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName
// inFramework:(NSString*)aFrameworkName
// languages:(NSArray*)languages;
//NDFN
-(NSArray*)filterLanguages:(NSArray*)languages;
@end

View file

@ -36,6 +36,7 @@ RCS_ID("$Id$")
#include "GSWPrivate.h"
#include "GSWLifebeatThread.h"
#include "GSWRecording.h"
#include "GSWApplication+Defaults.h"
#include "stacktrace.h"
#include "attach.h"
@ -64,6 +65,7 @@ application unlock
- (NSString *)adaptor;
- (NSString *)host;
- (NSNumber *)port;
+ (id)defaultGroup;
@end
#ifdef GNUSTEP
@ -77,7 +79,7 @@ application unlock
@end
#define GSWFPutSL(string, file) \
do { fputs([string lossyCString],file); fputs("\n",file); fflush(file); } \
do { fputs([[string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES] bytes], file); fputs("\n",file); fflush(file); } \
while (0)
/* GSWApplication+Defaults.m */
@ -659,7 +661,7 @@ int GSWApplicationMain(NSString* applicationClassName,
{
NSString* path=nil;
path=[[_resourceManager _appProjectBundle] path];
path=[[_resourceManager _appProjectBundle] bundlePath];
return path;
};
@ -847,8 +849,8 @@ int GSWApplicationMain(NSString* applicationClassName,
-(void)_resetCache
{
//OK
NSEnumerator * anEnum = nil;
GSWComponentDefinition * definition = nil;
// NSEnumerator * anEnum = nil;
// GSWComponentDefinition * definition = nil;
[self lock];
NS_DURING
@ -1539,12 +1541,12 @@ to another instance **/
if (!_remoteMonitor)
{
NSString* monitorHost=[self _monitorHost];
NSNumber* workerThreadCount=[[self class]workerThreadCount];
// NSNumber* workerThreadCount=[[self class]workerThreadCount];
id proxy=nil;
if ([[NSDistantObject class] respondsToSelector:@selector(setDebug:)])
{
[NSDistantObject setDebug:YES];
}
// if ([[NSDistantObject class] respondsToSelector:@selector(setDebug:)])
// {
// [NSDistantObject setDebug:YES];
// }
_remoteMonitorConnection = [NSConnection connectionWithRegisteredName:GSWMonitorServiceName
host:monitorHost];
proxy=[_remoteMonitorConnection rootProxy];
@ -2257,29 +2259,28 @@ to another instance **/
//--------------------------------------------------------------------
//invokeActionForRequest:inContext:
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext
{
//OK
GSWElement* element=nil;
GSWSession* session=nil;
GSWSession* session=nil;
id <GSWActionResults> results = nil;
NS_DURING
NS_DURING
{
session=[aContext existingSession];
element=[session invokeActionForRequest:aRequest
inContext:aContext];
session = [aContext existingSession];
results = [session invokeActionForRequest:aRequest
inContext:aContext];
}
NS_HANDLER
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
@"In GSWApplication invokeActionForRequest:inContext");
[localException raise];
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
@"In GSWApplication invokeActionForRequest:inContext");
[localException raise];
}
NS_ENDHANDLER;
NS_ENDHANDLER;
return element;
};
return results;
}
//--------------------------------------------------------------------
//appendToResponse:inContext:
@ -2471,7 +2472,7 @@ to another instance **/
{
NSString* message=[NSString stringWithFormat:@"Exception Handling failed. Can't find Error Page named '%@'",
pageName];
NSLog(message);
NSLog(@"%@", message);
response=[GSWResponse responseWithMessage:message
inContext:context
@ -2729,7 +2730,7 @@ to another instance **/
NSBundle* bundle=[NSBundle bundleWithPath:path];
if (bundle)
{
BOOL result=[bundle load];
[bundle load];
aClass=[bundle principalClass];
};
return aClass;
@ -3565,19 +3566,6 @@ to another instance **/
return 1;
};
//--------------------------------------------------------------------
+(BOOL)_lockDefaultEditingContext
{
[self notImplemented: _cmd]; //TODOFN
return YES;
};
//--------------------------------------------------------------------
+(void)_setLockDefaultEditingContext:(BOOL)flag
{
[self notImplemented: _cmd]; //TODOFN
};
//--------------------------------------------------------------------
+(id)_allowsConcurrentRequestHandling
{
@ -3634,28 +3622,33 @@ to another instance **/
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
{
id propList=nil;
GSWResourceManager* resourceManager=nil;
NSString* pathName=nil;
id propList=nil;
GSWResourceManager* resourceManager=nil;
NSString* pathName=nil;
resourceManager=[self resourceManager];
pathName=[resourceManager pathForResourceNamed:[NSString stringWithFormat:@"%@.%@",aName,type]
inFramework:aFrameworkName
languages:languages];
if (pathName)
resourceManager=[self resourceManager];
pathName=[resourceManager pathForResourceNamed:[NSString stringWithFormat:@"%@.%@",aName,type]
inFramework:aFrameworkName
languages:languages];
if (pathName)
{
NSString* propListString=[NSString stringWithContentsOfFile:pathName];
propList=[propListString propertyList];
if (!propList)
NSStringEncoding encoding;
NSError *error = nil;
NSString* propListString=[NSString stringWithContentsOfFile:pathName
usedEncoding:&encoding
error:&error];
propList = [propListString propertyList];
if (!propList)
{
// LOGSeriousError(@"Bad propertyList \n%@\n from file %@",
// propListString,
// pathName);
// LOGSeriousError(@"Bad propertyList \n%@\n from file %@",
// propListString,
// pathName);
};
};
return propList;
};
return propList;
}
//--------------------------------------------------------------------
+(BOOL)createUnknownComponentClasses:(NSArray*)classes
@ -3799,31 +3792,31 @@ to another instance **/
};
//--------------------------------------------------------------------
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
{
NSDictionary* st=nil;
st=[[self resourceManager]stringsTableNamed:aTableName
inFramework:aFrameworkName
languages:languages];
return st;
};
////--------------------------------------------------------------------
////NDFN
//-(NSDictionary*)stringsTableNamed:(NSString*)aTableName
// inFramework:(NSString*)aFrameworkName
// languages:(NSArray*)languages
//{
// NSDictionary* st=nil;
//
// st=[[self resourceManager]stringsTableNamed:aTableName
// inFramework:aFrameworkName
// languages:languages];
//
// return st;
//};
//--------------------------------------------------------------------
//NDFN
-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
{
return [[self resourceManager]stringsTableArrayNamed:aTableName
inFramework:aFrameworkName
languages:languages];
};
//-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName
// inFramework:(NSString*)aFrameworkName
// languages:(NSArray*)languages
//{
// return [[self resourceManager]stringsTableArrayNamed:aTableName
// inFramework:aFrameworkName
// languages:languages];
//};
//--------------------------------------------------------------------
//NDFN

View file

@ -378,7 +378,7 @@ static Class NSStringClass = Nil;
{
NSString* numberString=[trimmedString stringByDeletingPrefix:@"#"];
//char* cString=[numberString lossyCString];//TODO
const char* cString=[numberString cString];//TODO
const char* cString=[numberString UTF8String];
char* endPtr=NULL;
int value=strtol(cString,&endPtr,16);
if (endPtr && *endPtr)
@ -410,7 +410,7 @@ static Class NSStringClass = Nil;
else
{
//char* cString=[trimmedString lossyCString];//TODO
const char* cString=[trimmedString cString];//TODO
const char* cString=[trimmedString UTF8String];
char* endPtr=NULL;
int value=strtol(cString,&endPtr,10);

View file

@ -111,115 +111,126 @@ static Class standardClass = Nil;
-(void)appendToResponse:(GSWResponse*)aResponse
inContext:(GSWContext*)aContext
{
GSWComponent* component=nil;
BOOL hideInCommentValue=NO;
id languageValue=nil;
id scriptValue=nil;
GSWComponent* component=nil;
BOOL hideInCommentValue=NO;
id languageValue=nil;
id scriptValue=nil;
GSWStartElement(aContext);
GSWSaveAppendToResponseElementID(aContext);
component=GSWContext_component(aContext);
[super appendToResponse:aResponse
inContext:aContext];
//hideInCommentValue=[_hideInComment valueInComponent:component];
hideInCommentValue=GSWDynamicElement_evaluateValueInContext(self,standardClass,
standardEvaluateConditionInContextIMP,
_hideInComment,aContext);
GSWResponse_appendContentAsciiString(aResponse,@"<SCRIPT language=");
languageValue=[_language valueInComponent:component];
GSWStartElement(aContext);
GSWSaveAppendToResponseElementID(aContext);
component=GSWContext_component(aContext);
[super appendToResponse:aResponse
inContext:aContext];
//hideInCommentValue=[_hideInComment valueInComponent:component];
hideInCommentValue=GSWDynamicElement_evaluateValueInContext(self,standardClass,
standardEvaluateConditionInContextIMP,
_hideInComment,aContext);
GSWResponse_appendContentAsciiString(aResponse,@"<SCRIPT language=");
languageValue=[_language valueInComponent:component];
GSWResponse_appendContentHTMLAttributeValue(aResponse,languageValue);
if ([_otherAttributes count]>0)
{
NSEnumerator* enumerator = [_otherAttributes keyEnumerator];
id key;
id value;
while ((key = [enumerator nextObject]))
{
value=[_otherAttributes objectForKey:key];
GSWResponse_appendContentCharacter(aResponse,' ');
GSWResponse_appendContentString(aResponse,key);
if (value)
{
GSWResponse_appendContentCharacter(aResponse,'=');
GSWResponse_appendContentHTMLAttributeValue(aResponse,value);
};
};
};
if (_scriptSource)
GSWResponse_appendContentHTMLAttributeValue(aResponse,languageValue);
if ([_otherAttributes count]>0)
{
scriptValue=[_scriptSource valueInComponent:component];
if (scriptValue)
NSEnumerator* enumerator = [_otherAttributes keyEnumerator];
id key;
id value;
while ((key = [enumerator nextObject]))
{
GSWResponse_appendContentString(aResponse,@" src=\"");
GSWResponse_appendContentString(aResponse,scriptValue);
GSWResponse_appendContentCharacter(aResponse,'"');
value=[_otherAttributes objectForKey:key];
GSWResponse_appendContentCharacter(aResponse,' ');
GSWResponse_appendContentString(aResponse,key);
if (value)
{
GSWResponse_appendContentCharacter(aResponse,'=');
GSWResponse_appendContentHTMLAttributeValue(aResponse,value);
};
};
};
if (_scriptSource)
{
scriptValue=[_scriptSource valueInComponent:component];
if (scriptValue)
{
GSWResponse_appendContentString(aResponse,@" src=\"");
GSWResponse_appendContentString(aResponse,scriptValue);
GSWResponse_appendContentCharacter(aResponse,'"');
};
}
GSWResponse_appendContentCharacter(aResponse,'>');
if (_scriptString || _scriptFile)
GSWResponse_appendContentCharacter(aResponse,'>');
if (_scriptString || _scriptFile)
{
GSWResponse_appendContentCharacter(aResponse,'\n');
if (hideInCommentValue)
GSWResponse_appendContentAsciiString(aResponse,@"<!-- GNUstepWeb ClientScript\n");
GSWResponse_appendContentCharacter(aResponse,'\n');
if (hideInCommentValue)
GSWResponse_appendContentAsciiString(aResponse,@"<!-- GNUstepWeb ClientScript\n");
if (_scriptString)
if (_scriptString)
{
scriptValue=[_scriptString valueInComponent:component];
if (scriptValue)
GSWResponse_appendContentString(aResponse,scriptValue);
else
scriptValue=[_scriptString valueInComponent:component];
if (scriptValue)
GSWResponse_appendContentString(aResponse,scriptValue);
else
{
//TODO
//TODO
};
}
else if (_scriptFile)
else if (_scriptFile)
{
NSString* scriptFileName=[_scriptFile valueInComponent:component];
if (scriptFileName)
NSString* scriptFileName=[_scriptFile valueInComponent:component];
if (scriptFileName)
{
GSWResourceManager* resourceManager=nil;
NSString* path=nil;
resourceManager=[GSWApp resourceManager];
path=[resourceManager pathForResourceNamed:scriptFileName
inFramework:nil
languages:[aContext languages]];
if (path)
NSError * error = nil;
GSWResourceManager * resourceManager = nil;
NSString * path = nil;
resourceManager=[GSWApp resourceManager];
path=[resourceManager pathForResourceNamed:scriptFileName
inFramework:nil
languages:[aContext languages]];
if (path)
{
NSString* scriptValue=nil;
scriptValue=[NSString stringWithContentsOfFile:path];
if (scriptValue)
NSString * scriptValue = nil;
NSStringEncoding usedEncoding;
scriptValue = [NSString stringWithContentsOfFile:path
usedEncoding:&usedEncoding
error:&error];
if (scriptValue)
{
GSWResponse_appendContentString(aResponse,scriptValue);
GSWResponse_appendContentString(aResponse,scriptValue);
}
else
else
{
//TODO
//TODO
}
}
else
else
{
NSException* exception=nil;
exception=[NSException exceptionWithName:NSInvalidArgumentException
reason:[NSString stringWithFormat:
@"Can't find script file '%@'",
scriptFileName]
userInfo:nil];
[exception raise];
NSException* exception=nil;
exception=[NSException exceptionWithName:NSInvalidArgumentException
reason:[NSString stringWithFormat:
@"Can't open script file '%@' - %@",
scriptFileName, error]
userInfo:nil];
[exception raise];
};
}
else
else
{
//TODO
NSException* exception=nil;
exception=[NSException exceptionWithName:NSInvalidArgumentException
reason:[NSString stringWithFormat:
@"No script file name"]
userInfo:nil];
[exception raise];
};
};
GSWResponse_appendContentCharacter(aResponse,'\n');
if (hideInCommentValue)
GSWResponse_appendContentAsciiString(aResponse,@"//-->\n");
GSWResponse_appendContentCharacter(aResponse,'\n');
if (hideInCommentValue)
GSWResponse_appendContentAsciiString(aResponse,@"//-->\n");
};
GSWResponse_appendContentAsciiString(aResponse,@"</SCRIPT>");
GSWStopElement(aContext);
GSWResponse_appendContentAsciiString(aResponse,@"</SCRIPT>");
GSWStopElement(aContext);
};
//--------------------------------------------------------------------

View file

@ -44,7 +44,7 @@
#include "GSWResponse.h"
#include "GSWContext.h"
@interface GSWComponent : GSWElement <NSCopying>
@interface GSWComponent : GSWElement <NSCopying, GSWActionResults>
{
//TODO ==> private @private
NSString* _name;
@ -157,7 +157,7 @@
-(void)sleepInContext:(GSWContext*)aContext;
-(void)appendToResponse:(GSWResponse*)aResponse
inContext:(GSWContext*)aContext;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext;
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext;
@ -269,6 +269,5 @@ Call this method before using a component which was cached in a variable.
+(void)_registerObserver:(id)observer;
-(void)validateAPIAssociations;
@end
#endif //_GSWComponent_h__

View file

@ -85,9 +85,9 @@ static Class GSWHTMLBareStringClass = Nil;
if (myClass == ([GSWComponent class])) {
ASSIGN(_name, [aContext _componentName]);
} else {
ASSIGN(_name, [NSString stringWithCString:object_getClassName(self)]);
ASSIGN(_name, NSStringFromClass([self class]));
}
ASSIGN(_templateName,[NSString stringWithCString:class_getName(myClass)]);
ASSIGN(_templateName,NSStringFromClass(myClass));
_isPage = NO;
_subComponents = nil;
[self setCachingEnabled:[GSWApp isCachingEnabled]];
@ -901,28 +901,28 @@ static Class GSWHTMLBareStringClass = Nil;
}
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext
-(id <GSWActionResults>) invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext
{
GSWElement* template=nil;
GSWElement* element=nil;
id <GSWActionResults> results = nil;
GSWElement * template = nil;
NS_DURING
NS_DURING
template = [self template];
if (template != nil) {
if ([template class] != GSWHTMLBareStringClass) {
element=[template invokeActionForRequest:aRequest
inContext:aContext];
template = [self template];
if (template != nil) {
if ([template class] != GSWHTMLBareStringClass) {
results = [template invokeActionForRequest:aRequest
inContext:aContext];
}
}
}
NS_HANDLER
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
@"In %s", __PRETTY_FUNCTION__);
[localException raise];
NS_ENDHANDLER
NS_HANDLER
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
@"In %s", __PRETTY_FUNCTION__);
[localException raise];
NS_ENDHANDLER
return element;
return results;
}
@ -1306,7 +1306,7 @@ Call this method before using a component which was cached in a variable.
[response setHTTPVersion:httpVersion];
[response setHeader:@"text/html"
forKey:@"content-type"];
forKey:@"Content-Type"];
[aContext _setResponse:response];
pageElement=[aContext _pageElement];
@ -1459,20 +1459,19 @@ Call this method before using a component which was cached in a variable.
-(NSString*)urlForResourceNamed:(NSString*)aName
ofType:(NSString*)type
{
NSString* url = nil;
NSString* url = nil;
GSOnceMLog(@"%s is depricated in WO 4.0. Use GSWResourceManagers implementation of "
@"urlForResourceNamed:inFramework:languages:request: "
@"instead.",
__PRETTY_FUNCTION__);
GSOnceMLog(@"%s is depricated in WO 4.0. Use GSWResourceManagers implementation of "
@"urlForResourceNamed:inFramework:languages:request: "
@"instead.",
__PRETTY_FUNCTION__);
url=[[GSWApp resourceManager] urlForResourceNamed:aName
ofType:type
inFramework:nil
languages:[self languages]
request:nil];
url=[[GSWApp resourceManager] urlForResourceNamed:aName
inFramework:nil
languages:[self languages]
request:nil];
return url;
return url;
}
//--------------------------------------------------------------------
@ -1487,7 +1486,6 @@ Call this method before using a component which was cached in a variable.
__PRETTY_FUNCTION__);
path=[[GSWApp resourceManager] pathForResourceNamed:aName
ofType:type
inFramework:nil
languages:[self languages]];
@ -1554,32 +1552,6 @@ Call this method before using a component which was cached in a variable.
[self notImplemented: _cmd]; //TODOFN
}
-(void)validateAPIAssociations
{
NSDictionary* api=[[self _componentDefinition] componentAPI];
if (api)
{
NSArray* required=[api objectForKey:@"Required"];
//TODO useit NSArray* optional=[api objectForKey:@"Optional"];
int i=0;
int count=[required count];
id aName=nil;
for(i=0;i<count;i++)
{
aName=[required objectAtIndex:i];
if (![self hasBinding:aName])
{
[NSException raise:NSGenericException
format:@"There is no binding for '%@' in parent '%@' for component '%@' [parents : %@]",
aName,
[_parent class],
[self class],
[self parentsClasses]];
}
}
}
}
- (id)unarchiver: (WOKeyValueUnarchiver*)archiver objectForReference: (id)keyPath
{
if ([keyPath isKindOfClass:[NSString class]])

View file

@ -80,7 +80,7 @@ static Class GSWHTMLBareStringClass = Nil;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext
{
GSWElement* element=nil;
id <GSWActionResults, NSObject> element=nil;
GSWComponent* component=nil;
GSWComponent* parent=nil;
GSWElement* childTemplate=nil;
@ -93,7 +93,7 @@ static Class GSWHTMLBareStringClass = Nil;
if ([childTemplate class] != GSWHTMLBareStringClass) {
parent=[component parent];
[aContext _setCurrentComponent:parent];
element=[childTemplate invokeActionForRequest:request
element = (id <GSWActionResults, NSObject>)[childTemplate invokeActionForRequest:request
inContext:aContext];
NSAssert3(!element || [element isKindOfClass:[GSWElement class]],
@"childTemplate=%@ Element is a %@ not a GSWElement: %@",

View file

@ -99,18 +99,14 @@
*/
- (NSDictionary *) archive;
-(NSString*)pathForResourceNamed:(NSString*)aName
ofType:(NSString*)aType
languages:(NSArray*)languages;
// does this exist in wo?
//-(NSString*)pathForResourceNamed:(NSString*)aName
// ofType:(NSString*)aType
// languages:(NSArray*)languages;
- (GSWComponentReference*) componentReferenceWithAssociations:(NSDictionary*)associations
template:(GSWElement*)template;
-(NSDictionary*)componentAPI;
//+ (id) copyWithZone: (NSZone*)z;
@end

View file

@ -169,52 +169,17 @@ RCS_ID("$Id$")
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext
{
GSWElement* element=nil;
// GSWComponent* component=nil;
// GSWComponent* componentPrev=nil;
id <GSWActionResults, NSObject> element=nil;
[self _pushComponentInContext:aContext];
element = [GSWContext_component(aContext) invokeActionForRequest: request
inContext: aContext];
[self _popComponentFromContext:aContext];
[self _pushComponentInContext:aContext];
return element;
element = (id <GSWActionResults, NSObject>) [GSWContext_component(aContext) invokeActionForRequest: request
inContext: aContext];
[self _popComponentFromContext:aContext];
//
// GSWStartElement(aContext);
// GSWAssertCorrectElementID(aContext);
//
// NSDebugMLLog(@"gswdync",@"name=%@ senderId=%@",
// _name,GSWContext_senderID(aContext));
//
// componentPrev=GSWContext_component(aContext);
// [self _pushComponentInContext:aContext];
//
// component=GSWContext_component(aContext);
// if (component)
// {
// if ([self prefixMatchSenderIDInContext:aContext]) //Avoid trying to find action if we are not the good component
// {
// element=[component invokeActionForRequest:request
// inContext:aContext];
// NSAssert4(!element || [element isKindOfClass:[GSWElement class]],
// @"Name= %@, from: %@, Element is a %@ not a GSWElement: %@",
// _name,
// component,
// [element class],
// element);
// };
// [self _popComponentFromContext:aContext];
// }
// else
// [aContext _setCurrentComponent:componentPrev];
//
// GSWStopElement(aContext);
// GSWAssertDebugElementIDsCount(aContext);
//
return element;
// return element;
};
}
//--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request

View file

@ -160,7 +160,7 @@ GSWResponse * _dispatchWithPreparedPage(GSWComponent * aPage, GSWSession * aSess
[aResponse setHTTPVersion:[aRequest httpVersion]];
[aResponse setHeader:@"text/html"
forKey:@"content-type"];
forKey:@"Content-Type"];
[aContext _setResponse:aResponse];
if (oldContextID == nil) {
@ -170,7 +170,8 @@ GSWResponse * _dispatchWithPreparedPage(GSWComponent * aPage, GSWSession * aSess
[aContext _setPageChanged:NO];
if (aSenderID != nil) {
GSWElement * anActionResults = [anApplication invokeActionForRequest:aRequest inContext:aContext];
id <GSWActionResults, NSObject> anActionResults = (id <GSWActionResults, NSObject>) [anApplication invokeActionForRequest:aRequest
inContext:aContext];
if ((anActionResults == nil) || ([anActionResults isKindOfClass: [GSWComponent class]])) {
GSWComponent * aResultComponent = (GSWComponent*) anActionResults;

View file

@ -117,8 +117,8 @@ static Class standardClass = Nil;
}
}
-(GSWElement*)invokeActionForRequest:(GSWRequest*) request
inContext:(GSWContext*) context
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*) request
inContext:(GSWContext*) context
{
GSWComponent * component = GSWContext_component(context);
BOOL conVal = [_condition boolValueInComponent:component];

View file

@ -146,16 +146,16 @@ NSString* GSWHTTPHeader_AdaptorStats[2] = { @"x-gsweb-adaptorstats", @"x-webobje
NSString* GSWHTTPHeader_MethodPost=@"POST";
NSString* GSWHTTPHeader_MethodGet=@"GET";
NSString* GSWHTTPHeader_AcceptLanguage=@"accept-language";
NSString* GSWHTTPHeader_AcceptEncoding=@"accept-encoding";
NSString* GSWHTTPHeader_ContentType=@"content-type";
NSString* GSWHTTPHeader_AcceptLanguage=@"Accept-Language";
NSString* GSWHTTPHeader_AcceptEncoding=@"Accept-Encoding";
NSString* GSWHTTPHeader_ContentType=@"Content-Type";
NSString* GSWHTTPHeader_FormURLEncoded=@"application/x-www-form-urlencoded";
NSString* GSWHTTPHeader_MultipartFormData=@"multipart/form-data";
NSString* GSWHTTPHeader_MimeType_TextPlain=@"text/plain";
NSString* GSWHTTPHeader_UserAgent=@"user-agent";
NSString* GSWHTTPHeader_Referer=@"referer";
NSString* GSWHTTPHeader_UserAgent=@"User-Agent";
NSString* GSWHTTPHeader_Referer=@"Referer";
NSString* GSWHTTPHeader_ContentLength=@"content-length";
NSString* GSWHTTPHeader_ContentLength=@"Content-Length";
NSString* GSWHTTPHeader_Response_OK=@"OK";

View file

@ -59,12 +59,12 @@ BOOL GSWDynamicElement_evaluateValueInContext(GSWDynamicElement* element,Class s
GSWIMP_BOOL imp,GSWAssociation* condition,GSWContext* context)
{
// was object_get_class
if (imp && object_getClass(element)==standardClass)
{
return (*imp)(element,evaluateConditionInContextSEL,
condition,context);
}
else
// if (imp && object_getClass(element)==standardClass)
// {
// return (*imp)(element,evaluateConditionInContextSEL,
// condition,context);
// }
// else
return [element evaluateCondition:condition
inContext:context];
};

View file

@ -208,8 +208,8 @@ static Class GSWHTMLBareStringClass = Nil;
-(id <GSWActionResults>) invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext
{
return [self invokeChildrenAction:request
inContext:aContext];
return [self invokeChildrenAction:request
inContext:aContext];
}
-(void) appendChildrenToResponse:(GSWResponse*) response

View file

@ -64,11 +64,11 @@
freeWhenDone:(BOOL)flag;
-(id)initWithCharacters:(const unichar*)chars
length:(NSUInteger)length;
-(id)initWithCStringNoCopy:(char*)byteString
length:(NSUInteger)length
freeWhenDone:(BOOL)flag;
-(id)initWithCString:(const char*)byteString
length:(NSUInteger)length;
//-(id)initWithCStringNoCopy:(char*)byteString
// length:(NSUInteger)length
// freeWhenDone:(BOOL)flag;
//-(id)initWithCString:(const char*)byteString
// length:(NSUInteger)length;
-(id)initWithCString:(const char*)byteString;
-(id)initWithString:(NSString*)string;
-(id)initWithFormat:(NSString*)format,...;

View file

@ -97,31 +97,31 @@ static SEL appendStringSel = NULL;
}
//--------------------------------------------------------------------
-(id)initWithCStringNoCopy:(char*)byteString
length:(NSUInteger)length
freeWhenDone:(BOOL)flag
{
_url = [(NSMutableString*) [NSMutableString alloc] initWithCStringNoCopy:byteString
length:length
freeWhenDone:flag];
if (byteString) {
[self _parse];
}
return self;
}
//-(id)initWithCStringNoCopy:(char*)byteString
// length:(NSUInteger)length
// freeWhenDone:(BOOL)flag
//{
// _url = [(NSMutableString*) [NSMutableString alloc] initWithCStringNoCopy:byteString
// length:length
// freeWhenDone:flag];
// if (byteString) {
// [self _parse];
// }
// return self;
//}
//--------------------------------------------------------------------
-(id)initWithCString:(const char*)byteString
length:(NSUInteger)length;
{
_url = [(NSMutableString*) [NSMutableString alloc] initWithCString:byteString
length:length];
if (byteString) {
[self _parse];
}
return self;
}
//-(id)initWithCString:(const char*)byteString
// length:(NSUInteger)length;
//{
// _url = [(NSMutableString*) [NSMutableString alloc] initWithCString:byteString
// length:length];
// if (byteString) {
// [self _parse];
// }
//
// return self;
//}
//--------------------------------------------------------------------
-(id)initWithCString:(const char*)byteString;
@ -250,7 +250,7 @@ static SEL appendStringSel = NULL;
};
//--------------------------------------------------------------------
- (unichar) characterAtIndex: (unsigned)index
- (unichar)characterAtIndex:(NSUInteger)index
{
if (!_flags.composed)
{

View file

@ -35,6 +35,7 @@
#include "GSWDefines.h"
#include "GSWConstants.h"
#include "GSWUtils.h"
#include "GSWResponse.h"
GSWEB_EXPORT BYTE ElementsMap_htmlBareString;
GSWEB_EXPORT BYTE ElementsMap_gswebElement;
@ -147,8 +148,11 @@ GSWEB_EXPORT BYTE ElementsMap_attributeElement;
-(void)appendToResponse:(GSWResponse*)response
inContext:(GSWContext*)context;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
-(id <GSWActionResults>) invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext;
//-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
// inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context;

View file

@ -197,7 +197,7 @@ BYTE ElementsMap_attributeElement = (BYTE)0x41; // 'A'
//--------------------------------------------------------------------
// invokeActionForRequest:inContext:
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context
{
//Does Nothing

View file

@ -33,20 +33,27 @@
#define _GSWFileUpload_h__
//====================================================================
/*
if multiple is yes, filepath, mimeType and data will be in arrays.
*/
@interface GSWFileUpload: GSWInput
{
GSWAssociation* _data;
GSWAssociation* _filepath;
// these are new in 5.x
GSWAssociation* _mimeType;
GSWAssociation* _copyData;
GSWAssociation* _inputStream;
GSWAssociation* _outputStream;
GSWAssociation* _bufferSize;
GSWAssociation* _streamToFilePath;
GSWAssociation* _overwrite;
GSWAssociation* _finalFilePath;
GSWAssociation* _data;
GSWAssociation* _filepath;
// these are new in 5.x
GSWAssociation* _mimeType;
GSWAssociation* _copyData;
GSWAssociation* _inputStream;
GSWAssociation* _outputStream;
GSWAssociation* _bufferSize;
GSWAssociation* _streamToFilePath;
GSWAssociation* _overwrite;
GSWAssociation* _finalFilePath;
// new in modern browsers
GSWAssociation* _multiple;
}
@end

View file

@ -89,6 +89,11 @@ RCS_ID("$Id$")
}
*/
ASSIGN(_multiple, [_associations objectForKey: multiple__Key]);
if (_multiple != nil) {
[_associations removeObjectForKey: multiple__Key];
}
if (((_data == nil) && (_filepath == nil)) || ((_data != nil) && (![_data isValueSettable])) ||
((_filepath != nil) && (![_filepath isValueSettable]))) {
[NSException raise:NSInvalidArgumentException
@ -101,18 +106,19 @@ RCS_ID("$Id$")
//--------------------------------------------------------------------
-(void)dealloc
{
DESTROY(_data);
DESTROY(_filepath);
DESTROY(_mimeType);
DESTROY(_copyData);
DESTROY(_inputStream);
DESTROY(_outputStream);
DESTROY(_bufferSize);
DESTROY(_streamToFilePath);
DESTROY(_overwrite);
DESTROY(_finalFilePath);
DESTROY(_data);
DESTROY(_filepath);
DESTROY(_mimeType);
DESTROY(_copyData);
DESTROY(_inputStream);
DESTROY(_outputStream);
DESTROY(_bufferSize);
DESTROY(_streamToFilePath);
DESTROY(_overwrite);
DESTROY(_finalFilePath);
DESTROY(_multiple);
[super dealloc];
[super dealloc];
};
@ -124,7 +130,13 @@ RCS_ID("$Id$")
-(void) _appendValueAttributeToResponse:(GSWResponse *) response
inContext:(GSWContext*) context
{
// nothing!
GSWComponent * component = GSWContext_component(context);
if (_multiple != nil && ([_multiple boolValueInComponent:component])) {
GSWResponse_appendContentCharacter(response,' ');
GSWResponse_appendContentAsciiString(response,@"multiple");
}
}
-(void) _appendCloseTagToResponse:(GSWResponse *) response
@ -134,98 +146,90 @@ RCS_ID("$Id$")
}
//--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context
{
//Bypass GSWInput
return nil;
};
}
/*
"7.1.filename" = (
"15072009(002).jpg",
"31082009.jpg"
);
"7.3" = (
Submit
);
*/
//--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context
{
GSWComponent * component = GSWContext_component(context);
if ((![self disabledInComponent: component]) && ([context _wasFormSubmitted])) {
GSWComponent* component=nil;
NSString* nameInContext=nil;
NSArray* fileDatas=nil;
NSString* fileNameFormValueName=nil;
NSString* fileNameValue=nil;
NSData* dataValue=nil;
int fileDatasCount=0;
NS_DURING
{
component=GSWContext_component(context);
nameInContext=[self nameInContext:context];
fileDatas=[request formValuesForKey:nameInContext];
fileDatasCount=[fileDatas count];
/*
if (_fileDatasCount!=1)
{
ExceptionRaise(@"GSWFileUpload",
@"GSWFileUpload: File Data Nb != 1 :%d",
_fileDatasCount);
};
*/
if (fileDatasCount==1)
{
dataValue=[fileDatas objectAtIndex:0];
if (dataValue)
{
if ([dataValue isKindOfClass:[NSData class]])
{
if ([dataValue length]==0)
{
// LOGError(@"Empty Data: %@",dataValue);
};
}
else
{
if ([dataValue isKindOfClass:[NSString class]] && [dataValue length]==0)
{
// LOGError(@"No Data: %@",dataValue);
dataValue=nil;
}
else
{
};
};
}
else
{
// LOGError0(@"No Data:");
};
fileNameFormValueName=[NSString stringWithFormat:@"%@.filename",nameInContext];
fileNameValue=[request formValueForKey:fileNameFormValueName];
if (!fileNameValue || [fileNameValue length]==0)
{
//LOGError(@"No fileName: %@",fileNameValue);
};
[_filepath setValue:fileNameValue
inComponent:component];
[_data setValue:dataValue
inComponent:component];
}
else
{
// bug in omniweb-browser if you click cancel in FileOpenPanel, it transmits incorrect datas
GSWComponent * component = GSWContext_component(context);
if ((![self disabledInComponent: component]) && ([context _wasFormSubmitted]))
{
GSWComponent * component=nil;
NSString * nameInContext=nil;
NSArray * fileDatas=nil;
NSString * fileNameFormValueName=nil;
NSString * mimeValueName=nil;
NSUInteger fileDatasCount=0;
[_filepath setValue:nil
inComponent:component];
[_data setValue:nil
inComponent:component];
}
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"GSWFileUpload in takeValuesFromRequest");
[localException raise];
};
NS_ENDHANDLER;
};
};
NS_DURING
{
component=GSWContext_component(context);
nameInContext=[self nameInContext:context];
fileNameFormValueName = [NSString stringWithFormat:@"%@.filename", nameInContext];
mimeValueName = [NSString stringWithFormat:@"%@.%@",nameInContext, @"content-type"];
fileDatas = [request formValuesForKey:nameInContext];
fileDatasCount = [fileDatas count];
if (fileDatasCount >= 1)
{
NSArray * fileNameValue = [request formValuesForKey:fileNameFormValueName];
NSArray * mimeValue = [request formValuesForKey:mimeValueName];;
if ([[fileNameValue objectAtIndex:0] length] == 0) {
fileNameValue = nil;
fileDatas = nil;
mimeValue = nil;
}
if (_multiple != nil && ([_multiple boolValueInComponent:component])) {
[_filepath setValue:fileNameValue
inComponent:component];
[_data setValue:fileDatas
inComponent:component];
[_mimeType setValue:mimeValue
inComponent:component];
} else {
[_filepath setValue:[fileNameValue objectAtIndex:0]
inComponent:component];
[_data setValue:[fileDatas objectAtIndex:0]
inComponent:component];
[_mimeType setValue:[mimeValue objectAtIndex:0]
inComponent:component];
}
}
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"GSWFileUpload in takeValuesFromRequest");
[localException raise];
}
NS_ENDHANDLER;
}
}
@end

View file

@ -51,9 +51,6 @@
-(void)appendToResponse:(GSWResponse*)aResponse
inContext:(GSWContext*)aContext;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext;
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext;

View file

@ -162,17 +162,17 @@ static Class GSWHTMLBareStringClass = Nil;
//--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext
{
if ([_element class] != GSWHTMLBareStringClass) {
if ([_element class] != GSWHTMLBareStringClass) {
return [_element invokeActionForRequest:aRequest
inContext:aContext];
}
return nil;
};
return [_element invokeActionForRequest:aRequest
inContext:aContext];
}
return nil;
}
//--------------------------------------------------------------------

View file

@ -102,12 +102,17 @@ BOOL canBeOnSegment(NSPoint m,NSPoint a,NSPoint b)
//--------------------------------------------------------------------
+(NSArray*)geometricRegionsWithFile:(NSString*)fileName
{
NSArray* regions=nil;
NSString* string=[NSString stringWithContentsOfFile:fileName];
NSArray * regions = nil;
NSStringEncoding usedEncoding;
NSError * error = nil;
NSString* string=[NSString stringWithContentsOfFile:fileName
usedEncoding:&usedEncoding
error:&error];
if (!string)
{
ExceptionRaise(@"GSWGeometricRegion: Can't open File '%@'",
fileName);
ExceptionRaise(@"GSWGeometricRegion: Can't open File '%@' %@",
fileName, error);
}
else
regions=[self geometricRegionsWithString:string];

View file

@ -92,8 +92,8 @@ RCS_ID("$Id$")
{
}
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context
{
[NSException raise:NSInvalidArgumentException

View file

@ -395,7 +395,7 @@ static Class GSWHTMLBareStringClass = Nil;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext
{
GSWElement* element=nil;
id <GSWActionResults, NSObject> element=nil;
BOOL searchIsOver=NO;
NSString* senderID=nil;
int length=0;
@ -430,8 +430,8 @@ id currentEl = nil;
currentEl = (*objectAtIndexIMP)(aDynamicChildrensArray,objectAtIndexSEL,elementsN[1]);
if ([currentEl class] != GSWHTMLBareStringClass) {
element=[currentEl invokeActionForRequest:request
inContext:aContext];
element = (id <GSWActionResults, NSObject>) [currentEl invokeActionForRequest:request
inContext:aContext];
NSAssert3(!element || [element isKindOfClass:[GSWElement class]],
@"From: %@, Element is a %@ not a GSWElement: %@",

View file

@ -188,7 +188,7 @@ RCS_ID("$Id$")
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)context
{
GSWElement* element = nil;
id <GSWActionResults, NSObject> element = nil;
NSString* senderID = nil;
NSString* elementID = nil;
GSWComponent * component = nil;
@ -211,7 +211,7 @@ RCS_ID("$Id$")
}
}
} else {
element = [super invokeActionForRequest: aRequest inContext: context];
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest: aRequest inContext: context];
}
return element;
};

View file

@ -49,8 +49,7 @@
#define READ_SIZE 2048
static NSString *URIResponseString = @" GNUstep Web\r\n";
static NSString *CONTENT_LENGTH = @"content-length";
static NSString *CONTENT_LENGTHCOLON = @"content-length: ";
static NSString *CONTENT_LENGTHCOLON = @"Content-Length: ";
static NSString *GET = @"GET";
static NSString *POST = @"POST";
static NSString *HEAD = @"HEAD";
@ -59,7 +58,7 @@ static NSString *HEADERSEP = @": ";
static NSString *NEWLINE = @"\r\n";
static NSString *NEWLINE2 = @"\r\n";
static NSString *HTTP11 = @"HTTP/1.1";
static NSString *CONNECTION = @"connection";
static NSString *CONNECTION = @"Connection";
static NSString *KEEP_ALIVE = @"keep-alive";
static BOOL _alwaysAppendContentLength = YES;
@ -139,7 +138,8 @@ void _unpackHeaderLineAddToDict(NSString *line, NSMutableDictionary* headers)
if ((components) && ([components count] == 2)) {
value = [components objectAtIndex:1];
key = [components objectAtIndex:0];
key = [[key stringByTrimmingSpaces] lowercaseString];
key = [key stringByTrimmingSpaces];
if ([key isEqualToString:GSWHTTPHeader_AdaptorVersion[GSWNAMES_INDEX]]
|| [key isEqualToString:GSWHTTPHeader_ServerName[GSWNAMES_INDEX]]) {
@ -180,7 +180,7 @@ void _appendMessageHeaders(GSWResponse * message,NSMutableString * headers)
if (![headerDict isKindOfClass:[NSMutableDictionary class]]) {
headerDict = [[headerDict mutableCopy] autorelease];
}
[headerDict removeObjectForKey:CONTENT_LENGTH];
[headerDict removeObjectForKey:GSWHTTPHeader_ContentLength];
keyArray = [headerDict allKeys];
count = [keyArray count];
@ -237,9 +237,9 @@ void _sendMessage(GSWResponse * message, NSFileHandle* fh, NSString * httpVersio
// I am uable to reproduce the need for double clicking on links/forms,
// but for now, we send close. -- dw
if (YES /*keepAlive == NO*/) {
[headers appendString:@"connection: close\r\n"];
[headers appendString:@"Connection: close\r\n"];
} else {
[headers appendString:@"connection: keep-alive\r\n"];
[headers appendString:@"Connection: keep-alive\r\n"];
}
}
@ -397,7 +397,7 @@ void _sendMessage(GSWResponse * message, NSFileHandle* fh, NSString * httpVersio
method = [requestArray objectAtIndex:0];
if ((tmpValue = [headers objectForKey:CONTENT_LENGTH]) && ([tmpValue count])) {
if ((tmpValue = [headers objectForKey:GSWHTTPHeader_ContentLength]) && ([tmpValue count])) {
NSString * tmpString = [tmpValue objectAtIndex:0];
contentLength = [tmpString intValue];

View file

@ -72,9 +72,6 @@
-(void)_appendDirectActionToResponse:(GSWResponse*)response
inContext:(GSWContext*)context;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context;
-(void)takeValuesFromRequest:(GSWRequest*)request
inContext:(GSWContext*)context;

View file

@ -388,18 +388,18 @@ RCS_ID("$Id$")
// todo: check if 100% compatible
//--------------------------------------------------------------------
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext
{
GSWElement* element=nil;
id <GSWActionResults, NSObject> element=nil;
NSString* senderID=nil;
NSString* elementID=nil;
BOOL isInForm=NO;
BOOL XYValues=NO;
BOOL thisOne=NO;
GSWComponent* component=nil;
int x=0;
int y=0;
NSInteger x=0;
NSInteger y=0;
component=GSWContext_component(aContext);
GSWContext_appendZeroElementIDComponent(aContext);
senderID=GSWContext_senderID(aContext);
@ -534,12 +534,12 @@ RCS_ID("$Id$")
element=[aContext page];
}
else
element=[super invokeActionForRequest:request
inContext:aContext];
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
inContext:aContext];
}
else
element=[super invokeActionForRequest:request
inContext:aContext];
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
inContext:aContext];
return element;
};

View file

@ -265,10 +265,11 @@ static GSWMailDelivery *sharedInstance;
// -i When reading a message from standard input, don't treat a line with only a . character as the end of input.
// -t Extract recipients from message headers. This requires that no recipients be specified on the command line.
sendmailCommand=[sendmailPath stringByAppendingString:@" -i -t"];
sendmailFile=popen([sendmailCommand lossyCString],"w");
sendmailFile=popen([sendmailCommand UTF8String],"w");
if (sendmailFile)
{
const char* cString=[emailString lossyCString];
const char* cString=[[emailString dataUsingEncoding:NSASCIIStringEncoding
allowLossyConversion:YES] bytes];
size_t len=strlen(cString);
size_t written=fwrite(cString, sizeof(char),len,sendmailFile);
if (written!=len)

View file

@ -298,7 +298,7 @@ void initGSWMessageDataCache(void)
{
cstring[0] = (char)i;
myNSString = [NSString stringWithCString:cstring
length:1];
encoding:NSASCIIStringEncoding];
myData = [myNSString dataUsingEncoding:NSASCIIStringEncoding
allowLossyConversion:YES];
[myData retain];
@ -822,28 +822,32 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
- (void)appendContentString:(NSString *)aValue
{
// checking [aValue length] takes too long!
if (aValue)
// checking [aValue length] takes too long!
if (aValue)
{
NSData *myData = [aValue dataUsingEncoding:_contentEncoding
allowLossyConversion:NO];
NSData *myData = [aValue dataUsingEncoding:_contentEncoding
allowLossyConversion:NO];
if (!myData)
if (!myData)
{
[NSException raise:NSInvalidArgumentException
format:@"%s: could not convert '%s' non-lossy to encoding %i",
__PRETTY_FUNCTION__, [aValue lossyCString],_contentEncoding];
NSData *lossyData = [aValue dataUsingEncoding:_contentEncoding
allowLossyConversion:YES];
[NSException raise:NSInvalidArgumentException
format:@"%s: could not convert '%s' non-lossy to encoding %i",
__PRETTY_FUNCTION__, [lossyData bytes], _contentEncoding];
}
_checkBody(self);
(*_contentDataADImp)(_contentData,appendDataSel,myData);
_checkBody(self);
(*_contentDataADImp)(_contentData,appendDataSel,myData);
#ifndef NO_GNUSTEP
// Caching management
if (_currentCacheData)
#warning check this. -- dw
// Caching management
if (_currentCacheData)
{
assertCurrentCacheDataADImp();
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,myData);
assertCurrentCacheDataADImp();
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,myData);
};
#endif
};
@ -877,35 +881,43 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
// append one ASCII char
-(void)appendContentCharacter:(char)aChar
{
NSData *myData = nil;
int i = aChar;
NSData *myData = nil;
int i = aChar;
myData=GSWMessageDataCache[i];
myData=GSWMessageDataCache[i];
if (!myData)
if (!myData)
{
NSString* string=[NSString stringWithCString:&aChar
length:1];
if (string)
char string[2];
string[0] = aChar;
string[1] = '\0';
NSString* nsstring=[NSString stringWithCString:string
encoding:_contentEncoding];
NSLog(@"%s - '%s' '%@'",__PRETTY_FUNCTION__, string, nsstring);
if (nsstring)
{
GSWMessage_appendContentString(self,string);
GSWMessage_appendContentString(self,nsstring);
}
}
else
else
{
_checkBody(self);
(*_contentDataADImp)(_contentData,appendDataSel,myData);
_checkBody(self);
(*_contentDataADImp)(_contentData,appendDataSel,myData);
#ifndef NO_GNUSTEP
// Caching management
if (_currentCacheData)
// Caching management
if (_currentCacheData)
{
assertCurrentCacheDataADImp();
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,myData);
};
assertCurrentCacheDataADImp();
(*_currentCacheDataADImp)(_currentCacheData,appendDataSel,myData);
}
#endif
}
};
}
//--------------------------------------------------------------------
-(int)_contentLength

View file

@ -184,18 +184,23 @@ NSString* formattedByteSizeValue(unsigned int value)
+ (NSString *)contentOfProcFile: (NSString *)procFile
{
NSString *path;
NSString *content;
NSString * path;
NSString * content;
NSStringEncoding usedEncoding;
NSError * error = nil;
path = [NSString stringWithFormat: @"/proc/%@", procFile];
content = [NSString stringWithContentsOfFile: path];
path = [NSString stringWithFormat: @"/proc/%@", procFile];
if ([content length] == 0)
content = [NSString stringWithContentsOfFile:path
usedEncoding:&usedEncoding
error:&error];
if (!content)
{
//LOGSeriousError(@"Read (%@) attempt failed", path);
//LOGSeriousError(@"Read (%@) attempt failed", path);
}
return content;
return content;
}
-(NSString*)contentOfPIDFile:(NSString*)pidFile
@ -217,7 +222,7 @@ NSString* formattedByteSizeValue(unsigned int value)
if (pidstat)
{
const char* statsChars=[pidstat cString];
const char* statsChars=[pidstat UTF8String];
if (sscanf(statsChars, "%ld %ld %ld %ld %ld %ld %ld",
&_pagesNb,//size
&_residentPagesNb,//resident
@ -242,7 +247,7 @@ NSString* formattedByteSizeValue(unsigned int value)
NSRange cmdEnd=[pidstat rangeOfString:@") "];
if (cmdEnd.length>0)
{
NSString* pid_cmd=[pidstat substringToIndex:cmdEnd.location];
// NSString* pid_cmd=[pidstat substringToIndex:cmdEnd.location];
if (cmdEnd.location+cmdEnd.length<[pidstat length])
{
@ -254,7 +259,7 @@ NSString* formattedByteSizeValue(unsigned int value)
memset(P->cmd, 0, sizeof P->cmd); // clear even though *P xcalloc'd ?!
sscanf(S, "%d (%39c", &P->pid, P->cmd);
*/
const char* statsChars=[stats cString];
const char* statsChars=[stats UTF8String];
char cState;
long utime;
long stime;

View file

@ -82,11 +82,14 @@ RCS_ID("$Id$")
ASSIGN(_recordingPath,recordingPath);
NSDebugMLog(@"_recordingPath=%@",_recordingPath);
NSError *error = nil;
if (![fileManager createDirectoryAtPath:_recordingPath
attributes:nil])
if (![fileManager createDirectoryAtURL:[NSURL fileURLWithPath:_recordingPath]
withIntermediateDirectories:YES
attributes:nil
error:&error])
{
ExceptionRaise(@"GSWRecording: can't create directory '%@'",_recordingPath);
ExceptionRaise(@"GSWRecording: can't create directory '%@' - %@",_recordingPath, error);
};
};
};
@ -213,72 +216,79 @@ RCS_ID("$Id$")
-(void)saveRequest:(GSWRequest*)request
{
NSDebugMLog(@"_recordingStep=%d",_recordingStep);
NSDebugMLog(@"_recordingStep=%d",_recordingStep);
ASSIGN(_request,request);
ASSIGN(_request,request);
NSDebugMLog(@"request=%p",request);
NSDebugMLog(@"request=%p",request);
if (request)
if (request)
{
NSString* headerString=nil;
NSString* requestString=nil;
NSString * headerString = nil;
NSString * requestString = nil;
NSError * error = nil;
NSString* requestURI=[_request uri];
NSString* filePath= [_recordingPath stringByAppendingPathComponent:
[NSString stringWithFormat:@"%0.6d-request",_recordingStep]];
NSString* requestURI=[_request uri];
NSString* filePath= [_recordingPath stringByAppendingPathComponent:
[NSString stringWithFormat:@"%0.6d-request",_recordingStep]];
[GSWApplication logWithFormat:@"Saving Request into '%@'",filePath];
[GSWApplication logWithFormat:@"Saving Request into '%@'",filePath];
headerString = [NSString stringWithFormat:@"%@ %@ %@\r\n%@",
[_request method],
requestURI,
[_request httpVersion],
[self _headersStringForMessage:_request]];
NSDebugMLog(@" headerString=%@", headerString);
requestString = [headerString stringByAppendingString:[request contentString]];
headerString = [NSString stringWithFormat:@"%@ %@ %@\r\n%@",
[_request method],
requestURI,
[_request httpVersion],
[self _headersStringForMessage:_request]];
NSDebugMLog(@" headerString=%@", headerString);
requestString = [headerString stringByAppendingString:[request contentString]];
[requestString writeToFile:filePath
atomically:NO];
};
[requestString writeToFile:filePath
atomically:NO
encoding:NSUTF8StringEncoding
error:&error];
}
}
//--------------------------------------------------------------------
-(void)saveResponse:(GSWResponse*)response
{
NSString* filePath=nil;
NSString* responseString=nil;
NSString* headerString=nil;
NSString* filePath=nil;
NSString* responseString=nil;
NSString* headerString=nil;
NSError * error = nil;
NSDebugMLog(@"_recordingStep=%d",_recordingStep);
NSDebugMLog(@"_recordingStep=%d",_recordingStep);
NSDebugMLLog(@"GSWRecording",@"recordingSessionID=%@",
[response headerForKey:GSWHTTPHeader_RecordingSessionID[GSWebNamingConv]]);
NSDebugMLLog(@"GSWRecording",@"recordingSessionID=%@",
[response headerForKey:GSWHTTPHeader_RecordingSessionID[GSWebNamingConv]]);
response = [self _wildcardedResponse:response];
response = [self _wildcardedResponse:response];
filePath= [_recordingPath stringByAppendingPathComponent:
[NSString stringWithFormat:@"%0.6d-response",_recordingStep]];
filePath= [_recordingPath stringByAppendingPathComponent:
[NSString stringWithFormat:@"%0.6d-response",_recordingStep]];
[GSWApplication logWithFormat:@"Saving Response into '%@'",filePath];
[GSWApplication logWithFormat:@"Saving Response into '%@'",filePath];
headerString=[NSString stringWithFormat:@"%@ %u %@\r\n%@",
[response httpVersion],
(unsigned int)[response status],
GSWHTTPHeader_Response_HeaderLineEnd[GSWebNamingConv],
[self _headersStringForMessage:response]];
headerString=[NSString stringWithFormat:@"%@ %u %@\r\n%@",
[response httpVersion],
(unsigned int)[response status],
GSWHTTPHeader_Response_HeaderLineEnd[GSWebNamingConv],
[self _headersStringForMessage:response]];
NSDebugMLog(@"headerString=%@",headerString);
NSDebugMLog(@"headerString=%@",headerString);
responseString = [headerString stringByAppendingString:[response contentString]];
responseString = [headerString stringByAppendingString:[response contentString]];
[responseString writeToFile:filePath
atomically:NO];
_recordingStep++;
[responseString writeToFile:filePath
atomically:NO
encoding:NSUTF8StringEncoding
error:&error];
NSDebugMLog(@"_recordingStep=%d",_recordingStep);
_recordingStep++;
NSDebugMLog(@"_recordingStep=%d",_recordingStep);
}

View file

@ -222,11 +222,11 @@ static inline NSString* _indexStringForSenderAndElement(NSString * senderStr, NS
}
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)context
{
GSWComponent * component = GSWContext_component(context);
GSWElement * element = nil;
id <GSWActionResults, NSObject> element = nil;
NSString * indexStr = nil;
NSString * senderID = [context senderID];
@ -266,8 +266,8 @@ static inline NSString* _indexStringForSenderAndElement(NSString * senderStr, NS
inComponent:component];
}
[context appendElementIDComponent: indexStr];
element = [super invokeActionForRequest:request
inContext:context];
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
inContext:context];
[context deleteLastElementIDComponent];
} else {
count = 0;
@ -287,8 +287,8 @@ static inline NSString* _indexStringForSenderAndElement(NSString * senderStr, NS
for (k = 0; k < count && element == nil; k++) {
_prepareForIterationWithIndex(k, count, arrayValue, context, component, _item, _index);
element = [super invokeActionForRequest:request
inContext:context];
element = (id <GSWActionResults, NSObject>) [super invokeActionForRequest:request
inContext:context];
}

View file

@ -98,7 +98,7 @@ Cf RFC 2616 (http://www.rfc-editor.org/rfc/rfc2616.txt)
-(NSArray*)browserLanguages;
-(NSArray*)browserAcceptedEncodings;
-(NSArray*)requestHandlerPathArray;
-(NSString*)uri;
-(GSWDynamicURLString*) uri;
-(NSString*)urlProtocol;//NDFN
-(NSString*)urlHost;//NDFN
-(NSString*)urlPortString;//NDFN

View file

@ -813,7 +813,6 @@ RCS_ID("$Id$")
-(void)appendFormValue:(id)value
forKey:(NSString*)key
{
if (value)
{
NSMutableDictionary* formValues=nil;
@ -1494,7 +1493,7 @@ RCS_ID("$Id$")
}
else
{
//NSDebugMLLog(@"requests",@"contentType=%@",contentType);
NSLog(@"%s contentType=%@",__PRETTY_FUNCTION__, contentType);
};
_finishedParsingMultipartFormData=YES;
};
@ -1538,153 +1537,177 @@ RCS_ID("$Id$")
-(void)_getFormValuesFromMultipartFormData
{
NSMutableDictionary* formValues=nil;
GSMimeParser* parser=nil;
id key=nil;
NSData* headersData=nil;
NSMutableString* headersString=[NSMutableString string];
NSDictionary* headers=nil;
NSEnumerator* enumerator=nil;
IMP headersString_appendStringIMP=NULL;
NSStringEncoding e;
NSMutableDictionary* formValues=nil;
GSMimeParser* parser=nil;
id key=nil;
NSData* headersData=nil;
NSMutableString* headersString=[NSMutableString string];
NSDictionary* headers=nil;
NSEnumerator* enumerator=nil;
IMP headersString_appendStringIMP=NULL;
NSStringEncoding e;
formValues=(NSMutableDictionary*)[NSMutableDictionary dictionary];
formValues=(NSMutableDictionary*)[NSMutableDictionary dictionary];
// Append Each Header
headers=[self headers];
enumerator=[headers keyEnumerator];
while((key=[enumerator nextObject]))
// Append Each Header
headers=[self headers];
enumerator=[headers keyEnumerator];
while((key=[enumerator nextObject]))
{
NSArray* value=[headers objectForKey:key];
int i=0;
int count=[value count];
for(i=0;i<count;i++)
NSArray* value=[headers objectForKey:key];
int i=0;
int count=[value count];
for(i=0;i<count;i++)
{
// append "key: value\n" to headersString
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
key);
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
@": ");
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
[value objectAtIndex:i]);
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
@"\n");
// append "key: value\n" to headersString
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
key);
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
@": ");
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
[value objectAtIndex:i]);
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
@"\n");
};
};
// Append \n to specify headers end.
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
@"\n");
// Append \n to specify headers end.
GSWeb_appendStringWithImpPtr(headersString,
&headersString_appendStringIMP,
@"\n");
// headersData=[headersString dataUsingEncoding:[self formValueEncoding]];
// NSASCIIStringEncoding should be ok dave@turbocat.de
headersData=[headersString dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
// headersData=[headersString dataUsingEncoding:[self formValueEncoding]];
// NSASCIIStringEncoding should be ok dave@turbocat.de
headersData=[headersString dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
parser=[GSMimeParser mimeParser];
[parser parse:headersData];
[parser expectNoHeaders];
parser=[GSMimeParser mimeParser];
[parser parse:headersData];
[parser expectNoHeaders];
e = [self formValueEncoding];
switch (e)
e = [self formValueEncoding];
switch (e)
{
case NSISOLatin1StringEncoding:
[parser setDefaultCharset: @"iso-8859-1"];
break;
case NSUTF8StringEncoding:
[parser setDefaultCharset: @"utf-8"];
break;
default:
[parser setDefaultCharset:
[GSObjCClass([parser mimeDocument]) charsetFromEncoding: e]];
break;
case NSISOLatin1StringEncoding:
[parser setDefaultCharset: @"iso-8859-1"];
break;
case NSUTF8StringEncoding:
[parser setDefaultCharset: @"utf-8"];
break;
default:
[parser setDefaultCharset:
[GSObjCClass([parser mimeDocument]) charsetFromEncoding: e]];
break;
}
if ([parser parse:_contentData])
[parser parse:nil];
if ([parser isComplete] == NO)
if ([parser parse:_contentData])
[parser parse:nil];
if ([parser isComplete] == NO)
{
//TODO
//TODO
}
else
else
{
GSMimeDocument* document = [parser mimeDocument];
NSArray* content=nil;
NSString* contentSubtype=nil;
GSMimeDocument* document = [parser mimeDocument];
NSArray* content=nil;
NSString* contentSubtype=nil;
content=[document content];
contentSubtype=[document contentSubtype];
content=[document content];
contentSubtype=[document contentSubtype];
if ([contentSubtype isEqual:@"form-data"])
if ([contentSubtype isEqual:@"form-data"])
{
if (![content isKindOfClass:[NSArray class]])
if (![content isKindOfClass:[NSArray class]])
{
//TODO
//TODO
}
else
else
{
int i=0;
int count=[content count];
for(i=0;i<count;i++)
int i=0;
int count=[content count];
for(i=0;i<count;i++)
{
GSMimeDocument* aDoc=[content objectAtIndex:i];
GSMimeHeader* contentDispositionHeader=nil;
NSString* contentDispositionValue=nil;
NSDictionary* contentDispositionParams=nil;
id aDocContent=nil;
NSAssert2([aDoc isKindOfClass:[GSMimeDocument class]],
@"Document is not a GSMimeDocument but a %@:\n%@",
[aDoc class],aDoc);
aDocContent=[aDoc content];
contentDispositionHeader=[aDoc headerNamed:@"content-disposition"];
contentDispositionValue=[contentDispositionHeader value];
contentDispositionParams=[contentDispositionHeader parameters];
if ([contentDispositionValue isEqual:@"form-data"])
GSMimeDocument* aDoc=[content objectAtIndex:i];
GSMimeHeader* contentDispositionHeader=nil;
NSString* contentDispositionValue=nil;
NSDictionary* contentDispositionParams=nil;
id aDocContent=nil;
NSAssert2([aDoc isKindOfClass:[GSMimeDocument class]],
@"Document is not a GSMimeDocument but a %@:\n%@",
[aDoc class],aDoc);
aDocContent=[aDoc content];
contentDispositionHeader=[aDoc headerNamed:@"content-disposition"];
contentDispositionValue=[contentDispositionHeader value];
contentDispositionParams=[contentDispositionHeader parameters];
if ([contentDispositionValue isEqual:@"form-data"])
{
NSString* formDataName=[contentDispositionParams objectForKey:@"name"];
if (!formDataName)
NSString* formDataName=[contentDispositionParams objectForKey:@"name"];
if (!formDataName)
{
ExceptionRaise(@"GSWRequest",
@"GSWRequest: No name \n%@\n",
aDoc);
ExceptionRaise(@"GSWRequest",
@"GSWRequest: No name \n%@\n",
aDoc);
}
else
else
{
NSString* paramName=nil;
NSEnumerator* paramNamesEnumerator=[contentDispositionParams keyEnumerator];
while((paramName=[paramNamesEnumerator nextObject]))
NSString* paramName=nil;
NSEnumerator* paramNamesEnumerator=[contentDispositionParams keyEnumerator];
while((paramName=[paramNamesEnumerator nextObject]))
{
if (![paramName isEqualToString:@"name"])
if (![paramName isEqualToString:@"name"])
{
NSArray* previous=nil;
NSString* paramFormValueName=nil;
id paramValue=nil;
NSArray * previous = nil;
NSArray * prevContentType = nil;
NSString * paramFormValueName = nil;
NSString * typeFormValueName = nil;
NSString * contentType = nil;
id paramValue = nil;
paramValue=[contentDispositionParams objectForKey:paramName];
paramFormValueName=[NSString stringWithFormat:@"%@.%@",formDataName,paramName];
previous=[formValues objectForKey:paramFormValueName];
paramValue = [contentDispositionParams objectForKey:paramName];
if (previous)
[formValues setObject:[previous arrayByAddingObject:paramValue]
forKey:paramFormValueName];
else
[formValues setObject:[NSArray arrayWithObject:paramValue]
forKey:paramFormValueName];
};
};
if (aDocContent)
paramFormValueName = [NSString stringWithFormat:@"%@.%@",formDataName,paramName];
previous = [formValues objectForKey:paramFormValueName];
typeFormValueName = [NSString stringWithFormat:@"%@.%@",formDataName, @"content-type"];
prevContentType = [formValues objectForKey:typeFormValueName];
contentType = [NSString stringWithFormat:@"%@/%@",
[aDoc contentType],
[aDoc contentSubtype]];
if (prevContentType) {
[formValues setObject:[prevContentType arrayByAddingObject:contentType]
forKey:typeFormValueName];
} else {
[formValues setObject:[NSArray arrayWithObject:contentType]
forKey:typeFormValueName];
}
if (previous) {
if (paramValue) {
[formValues setObject:[previous arrayByAddingObject:paramValue]
forKey:paramFormValueName];
}
} else {
if (paramValue) {
[formValues setObject:[NSArray arrayWithObject:paramValue]
forKey:paramFormValueName];
}
}
}
}
if (aDocContent)
{
NSArray* previous=[formValues objectForKey:formDataName];
if (previous)
[formValues setObject:[previous arrayByAddingObject:aDocContent]
forKey:formDataName];
else
[formValues setObject:[NSArray arrayWithObject:aDocContent]
forKey:formDataName];
NSArray* previous=[formValues objectForKey:formDataName];
if (previous)
[formValues setObject:[previous arrayByAddingObject:aDocContent]
forKey:formDataName];
else
[formValues setObject:[NSArray arrayWithObject:aDocContent]
forKey:formDataName];
};
};
};
@ -1692,7 +1715,7 @@ RCS_ID("$Id$")
};
};
};
ASSIGN(_formValues,formValues);
ASSIGN(_formValues,formValues);
};
//--------------------------------------------------------------------

View file

@ -44,7 +44,7 @@ RCS_ID("$Id$")
[aResponse setStatus:404];
[aResponse setHeader:@"0"
forKey:@"content-length"];
forKey:GSWHTTPHeader_ContentLength];
return aResponse;
}
@ -110,12 +110,12 @@ RCS_ID("$Id$")
-(GSWResponse*)handleRequest:(GSWRequest*)aRequest
{
GSWResponse* response=nil;
NSString * wodataValue=nil;
NSDictionary * elements=nil;
NSString * uri = nil;
NSString * urlRequestHandlerPath = nil;
NSString * filePath = nil;
GSWResponse * response=nil;
NSString * wodataValue=nil;
// NSDictionary * elements=nil;
GSWDynamicURLString * uri = nil;
NSString * urlRequestHandlerPath = nil;
NSString * filePath = nil;
uri = [aRequest uri];
urlRequestHandlerPath = [uri urlRequestHandlerPath];
@ -174,6 +174,8 @@ RCS_ID("$Id$")
timeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]
locale:nil];
NSLog(@"dateString is %@", dateString);
aResponse = [GSWApp createResponseInContext:nil];
[aResponse setHeader:dateString
@ -204,7 +206,7 @@ RCS_ID("$Id$")
if (contentType)
{
[aResponse setHeader:contentType
forKey:@"content-type"];
forKey:@"Content-Type"];
}

View file

@ -92,7 +92,7 @@ GSWEB_EXPORT void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(
@end
//====================================================================
@interface GSWResponse : GSWMessage
@interface GSWResponse: GSWMessage <GSWActionResults>
{
@private
unsigned int _status;

View file

@ -205,11 +205,11 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
if (!_isClientCachingDisabled && _canDisableClientCaching)
{
[self setHeader:disabledCacheDateString
forKey:@"date"];
forKey:@"Date"];
[self setHeader:disabledCacheDateString
forKey:@"expires"];
forKey:@"Expires"];
[self setHeader:@"no-cache"
forKey:@"pragma"];
forKey:@"Pragma"];
if([[GSWApp class] _allowsCacheControlHeader])
[self setHeaders:cacheControlHeaderValues
@ -262,7 +262,7 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
NSString *value;
NSRange range;
if (aRequest && ((value = [aRequest headerForKey:@"accept-encoding"]))) {
if (aRequest && ((value = [aRequest headerForKey:GSWHTTPHeader_AcceptEncoding]))) {
range = [value rangeOfString:@"gzip" options:0];
if (range.length) {
@ -293,8 +293,8 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
// it does not make sense to compress data less than 150 bytes.
if ((dataLength > 150) && ([self _browserSupportsCompression:[aContext request]]))
{
NSString* contentType=[self headerForKey:@"content-type"];
NSString* contentEncoding=[self headerForKey:@"content-encoding"];
NSString* contentType=[self headerForKey:@"Content-Type"];
NSString* contentEncoding=[self headerForKey:@"Content-Encoding"];
if ((contentEncoding) || (!compressableContentTypesCache)) {
return;
@ -322,7 +322,7 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
[self setContent:compressedData];
dataLength=[self _contentLength];
[self setHeader:@"gzip"
forKey:@"content-encoding"];
forKey:@"Content-Encoding"];
}
}
}
@ -475,7 +475,7 @@ escapingHTMLAttributeValue:(BOOL)escape
if (httpVersion)
[aResponse setHTTPVersion:httpVersion];
[aResponse setHeader:@"text/html"
forKey:@"content-type"];
forKey:@"Content-Type"];
[aContext _setResponse:aResponse];
responseString=[NSString stringWithFormat:@"<HTML>\n<TITLE>GNUstepWeb Error</TITLE>\n</HEAD>\n<BODY bgcolor=\"white\">\n<CENTER>\n%@\n</CENTER>\n</BODY>\n</HTML>\n",
GSWResponse_stringByEscapingHTMLString(aResponse,aMessage)];
@ -553,7 +553,7 @@ escapingHTMLAttributeValue:(BOOL)escape
[self setHeader:location
forKey:@"Location"];
[self setHeader:@"text/html"
forKey:@"content-type"];
forKey:@"Content-Type"];
[self setHeader:@"YES"
forKey:@"x-gsweb-refusing-redirection"];
}

View file

@ -191,8 +191,8 @@ Returns first element of languages or nil if languages is empty
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext;
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext;
-(id <GSWActionResults>)invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext;
-(void)appendToResponse:(GSWResponse*)aResponse
inContext:(GSWContext*)aContext;

View file

@ -1339,28 +1339,28 @@ Returns first element of languages or nil if languages is empty
//--------------------------------------------------------------------
// invokeActionForRequest:inContext:
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
-(id <GSWActionResults>) invokeActionForRequest:(GSWRequest*)aRequest
inContext:(GSWContext*)aContext
{
GSWElement* element=nil;
GSWElement* pageElement=nil;
GSWComponent* pageComponent=nil;
id <GSWActionResults> results = nil;
GSWElement* pageElement=nil;
GSWComponent* pageComponent=nil;
NS_DURING
NS_DURING
pageElement = [aContext _pageElement];
pageComponent = [aContext _pageComponent];
[aContext _setCurrentComponent:pageComponent];
element=[pageElement invokeActionForRequest:aRequest
inContext:aContext];
results = [pageElement invokeActionForRequest:aRequest
inContext:aContext];
[aContext _setCurrentComponent:nil];
NS_HANDLER
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
@"In %s", __PRETTY_FUNCTION__);
[localException raise];
NS_ENDHANDLER;
NS_HANDLER
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
@"In %s", __PRETTY_FUNCTION__);
[localException raise];
NS_ENDHANDLER;
return element;
return results;
}
//--------------------------------------------------------------------

View file

@ -59,10 +59,12 @@ RCS_ID("$Id$")
NSString* documentRoot = [self _documentRoot];
[resourcePath appendString:documentRoot];
[resourcePath appendString:uri];
NSError *error = nil;
NS_DURING
{
NSDictionary* fileAttributes=[[NSFileManager defaultManager]fileAttributesAtPath:resourcePath
traverseLink:YES];
NSDictionary* fileAttributes=[[NSFileManager defaultManager] attributesOfItemAtPath:resourcePath
error:&error];
resourceLength=(unsigned long)[fileAttributes fileSize];
resourceFileHandle=[NSFileHandle fileHandleForReadingAtPath:resourcePath];

View file

@ -766,8 +766,8 @@ RCS_ID("$Id$")
}
else
{
NSTimeInterval userTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_utime);
NSTimeInterval systemTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_stime);
// NSTimeInterval userTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_utime);
// NSTimeInterval systemTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_stime);
};
};

View file

@ -120,27 +120,27 @@ RCS_ID("$Id$")
-(GSWElement*)invokeActionForRequest:(GSWRequest*)request
inContext:(GSWContext*)aContext
{
GSWElement* resultElement=nil;
GSWElement* element=nil;
NSString* elementNameInContext=nil;
id <GSWActionResults, NSObject> resultElement=nil;
GSWElement* element=nil;
NSString* elementNameInContext=nil;
GSWStartElement(aContext);
GSWAssertCorrectElementID(aContext);
elementNameInContext=[self _elementNameInContext:aContext];
GSWContext_appendElementIDComponent(aContext,elementNameInContext);
if ([elementNameInContext length]==0)
GSWStartElement(aContext);
GSWAssertCorrectElementID(aContext);
elementNameInContext=[self _elementNameInContext:aContext];
GSWContext_appendElementIDComponent(aContext,elementNameInContext);
if ([elementNameInContext length]==0)
{
ExceptionRaise(@"GSWSwitchComponent",@"ComponentName Value is null ! componentName: %@",
_componentName);
ExceptionRaise(@"GSWSwitchComponent",@"ComponentName Value is null ! componentName: %@",
_componentName);
};
element=[self _realComponentWithName:elementNameInContext
inContext:aContext];
resultElement=[element invokeActionForRequest:request
inContext:aContext];
GSWContext_deleteLastElementIDComponent(aContext);
element=[self _realComponentWithName:elementNameInContext
inContext:aContext];
resultElement = (id <GSWActionResults, NSObject>) [element invokeActionForRequest:request
inContext:aContext];
GSWContext_deleteLastElementIDComponent(aContext);
return resultElement;
};
return resultElement;
}
//--------------------------------------------------------------------
-(void)takeValuesFromRequest:(GSWRequest*)aRequest

View file

@ -454,61 +454,63 @@ Method for GSWDeclarationParserPragmaDelegate protocol
};
};
if (path)
if (path)
{
NSString* declarationsString=nil;
NSString * declarationsString=nil;
NSStringEncoding encoding;
NSError * error = nil;
[_processedDeclarationsFilePaths addObject:path];
[_processedDeclarationsFilePaths addObject:path];
//NSString* pageDefPath=[path stringByAppendingString:_declarationsPath];
//TODO use encoding !
declarationsString = [NSString stringWithContentsOfFile:path
usedEncoding:&encoding
error:&error];
declarationsString=[NSString stringWithContentsOfFile:path];
if (declarationsString)
if (declarationsString)
{
declarations=[self parseDeclarationsString:declarationsString
named:declarationFileName
inFrameworkNamed:declarationFrameworkName];
declarations = [self parseDeclarationsString:declarationsString
named:declarationFileName
inFrameworkNamed:declarationFrameworkName];
if (!declarations)
if (!declarations)
{
ExceptionRaise(@"%@ Template componentDeclaration parse failed for "
@"included file:%@ in framework:%@ (processedFiles=%@)",
[self logPrefix],
declarationFileName,
declarationFrameworkName,
_processedDeclarationsFilePaths);
ExceptionRaise(@"%@ Template componentDeclaration parse failed for "
@"included file:%@ in framework:%@ (processedFiles=%@) error=%@",
[self logPrefix],
declarationFileName,
declarationFrameworkName,
_processedDeclarationsFilePaths,
error);
};
}
else
else
{
ExceptionRaise(@"GSWTemplateParser",
@"%@ Can't load included component declaration "
@"named:%@ in framework:%@ (_processedDeclarationsFilePaths=%@)",
[self logPrefix],
declarationFileName,
declarationFrameworkName,
_processedDeclarationsFilePaths);
ExceptionRaise(@"GSWTemplateParser",
@"%@ Can't load included component declaration "
@"named:%@ in framework:%@ (_processedDeclarationsFilePaths=%@)",
[self logPrefix],
declarationFileName,
declarationFrameworkName,
_processedDeclarationsFilePaths);
};
}
else if (isPathAlreadyProcessed)
else if (isPathAlreadyProcessed)
{
// Returns an empty dictionary
declarations=[NSDictionary dictionary];
// Returns an empty dictionary
declarations=[NSDictionary dictionary];
}
else
else
{
ExceptionRaise(@"GSWTemplateParser",
@"%@ Can't find included component declaration "
@"named:%@ in framework:%@ (processedFiles=%@)",
[self logPrefix],
declarationFileName,
declarationFrameworkName,
_processedDeclarationsFilePaths);
ExceptionRaise(@"GSWTemplateParser",
@"%@ Can't find included component declaration "
@"named:%@ in framework:%@ (processedFiles=%@)",
[self logPrefix],
declarationFileName,
declarationFrameworkName,
_processedDeclarationsFilePaths);
};
return declarations;
return declarations;
};
//--------------------------------------------------------------------

View file

@ -185,7 +185,7 @@ static Class standardClass = Nil;
inContext:(GSWContext*)aContext
{
//OK
GSWElement* element=nil;
id <GSWActionResults, NSObject> element=nil;
NSString* senderID=nil;
NSString* elementID=nil;
@ -223,7 +223,7 @@ static Class standardClass = Nil;
}
else
{
element=[_children invokeActionForRequest:aRequest
element = (id <GSWActionResults, NSObject>)[_children invokeActionForRequest:aRequest
inContext:aContext];
NSDebugMLLog(@"gswdync",@"element=%@",element);
};

View file

@ -224,10 +224,10 @@ static Class NSStringClass = Nil;
else
[response setContent:data];
[response setHeader:GSWIntToNSString((int)[data length])
forKey:@"content-length"];
forKey:@"Content-Length"];
[response setHeader:_mimeType
forKey:@"content-type"];
forKey:@"Content-Type"];
};
//--------------------------------------------------------------------

View file

@ -762,7 +762,7 @@ void ValidationExceptionRaiseFn0(const char *func,
NSTimeZone* gmtTZ=[NSTimeZone timeZoneWithName:@"GMT"];
if (!gmtTZ)
NSWarnLog(@"no time zone for GMT");
return [self descriptionWithCalendarFormat:@"%A, %d-%b-%Y %H:%M:%S GMT"
return [self descriptionWithCalendarFormat:@"%a, %d %b %Y %H:%M:%S GMT"
timeZone:gmtTZ
locale:nil];
};

View file

@ -44,6 +44,7 @@
#ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#include <GNUstepBase/Additions.h>
#endif
#if GDL2

View file

@ -43,7 +43,7 @@
- (NSString*) encodeXMLPrefix
{
return [NSString stringWithFormat:@"<element type=\"%@\">\n", [self className]];
return [NSString stringWithFormat:@"<element type=\"%@\">\n", NSStringFromClass([self class])];
}
- (NSString*) encodeXMLSuffix
@ -92,7 +92,7 @@
format: @"key is missing"];
}
prefixStr = [NSString stringWithFormat:@"<%@ type=\"%@\">\n", key, [self className]];
prefixStr = [NSString stringWithFormat:@"<%@ type=\"%@\">\n", key, NSStringFromClass([self class])];
[contentStr appendString:prefixStr];
suffixStr = [NSString stringWithFormat:@"</%@>\n", key];
@ -136,7 +136,7 @@
format: @"key is missing"];
}
prefixStr = [NSString stringWithFormat:@"<%@ type=\"%@\">\n", key, [self className]];
prefixStr = [NSString stringWithFormat:@"<%@ type=\"%@\">\n", key, NSStringFromClass([self class])];
[contentStr appendString:prefixStr];
suffixStr = [NSString stringWithFormat:@"</%@>\n", key];

View file

@ -262,7 +262,7 @@ static void initNormalHTMLChars(GSWHTMLConvertingStruct* htmlConvertStruct,
};
}
static void testStringByConvertingHTML();
//static void testStringByConvertingHTML();
void NSStringHTML_Initialize()
{
@ -310,19 +310,6 @@ void NSStringHTML_Initialize()
\"&\r\n2\\U00E8\", \
\"<ee>\")"
void testStringByConvertingHTML()
{
/*
NSArray* testStrings=[HTML_TEST_STRINGS propertyList];
NSUInteger i=0;
for(i=0;i<[testStrings count];i++)
{
NSString* string=[testStrings objectAtIndex:i];
NSString* result=[string stringByConvertingToHTML];
NSString* reverse=[result stringByConvertingFromHTML];
};
*/
};
void allocOrReallocUnicharString(unichar** ptrPtr,NSUInteger* capacityPtr,NSUInteger length,NSUInteger newCapacity)
{
@ -653,9 +640,9 @@ NSString* baseStringByConvertingFromHTML(NSString* string,GSWHTMLConvertingStruc
{
NSMutableString* temp=[NSMutableString stringWithCapacity:[self length]];
const char* p=NULL;
const char* valid=[validString cString];
const char* valid=[validString cStringUsingEncoding:NSUTF8StringEncoding];
static char *digits = "0123456789ABCDEF";
for (p =[self cString]; p && *p; p++)
for (p =[self cStringUsingEncoding:NSUTF8StringEncoding]; p && *p; p++)
{
if (isdigit(*p) || isalpha(*p) || (valid && strchr(valid, *p)))
[temp appendFormat:@"%c",*p];
@ -771,7 +758,7 @@ NSString* baseStringByConvertingFromHTML(NSString* string,GSWHTMLConvertingStruc
if ([scanner scanString:@","
intoString:NULL])
{
if ([scanner scanInt:y])
if ([scanner scanInteger:y])
{
// if (y)
// {

View file

@ -37,19 +37,20 @@
-(BOOL)isANumber;
-(BOOL)isAFloatNumber;
-(BOOL)isAnIntegerNumber;
#ifdef LONG_LONG_MAX
-(BOOL)isAnIntegerNumberWithMin:(long long)min
max:(long long)max;
#else
-(BOOL)isAnIntegerNumberWithMin:(long)min
max:(long)max;
#endif
//#ifdef LONG_LONG_MAX
//-(BOOL)isAnIntegerNumberWithMin:(long long)min
// max:(long long)max;
-(BOOL) isAnIntegerNumberWithMin:(NSInteger) min
max:(NSInteger) max;
-(BOOL)isAnUnsignedIntegerNumber;
#ifdef LONG_LONG_MAX
-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max;
#else
-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long)max;
#endif
//#ifdef LONG_LONG_MAX
//-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max;
//#else
-(BOOL)isAnUnsignedIntegerNumberWithMax:(NSUInteger) max;
-(BOOL)isStartingWithNumber;
@end

View file

@ -71,18 +71,12 @@ RCS_ID("$Id$")
};
//--------------------------------------------------------------------
#ifdef LONG_LONG_MAX
-(BOOL)isAnIntegerNumberWithMin:(long long)min
max:(long long)max
#else
-(BOOL)isAnIntegerNumberWithMin:(long)min
max:(long)max
#endif
-(BOOL)isAnIntegerNumberWithMin:(NSInteger) min
max:(NSInteger) max
{
if ([self isAnIntegerNumber])
{
//TODO
long v=[self longValue];
NSInteger v=[self integerValue];
if (v>=min && v<=max)
return YES;
else
@ -106,24 +100,23 @@ RCS_ID("$Id$")
};
//--------------------------------------------------------------------
#ifdef LONG_LONG_MAX
-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max
#else
-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long)max
#endif
-(BOOL)isAnUnsignedIntegerNumberWithMax:(NSUInteger) max
{
if ([self isAnUnsignedIntegerNumber])
unsigned int v;
if ([self isAnUnsignedIntegerNumber])
{
//TODO
unsigned long v=[self ulongValue];
if (v<=max)
return YES;
else
return NO;
//TODO
sscanf([self UTF8String], "%u", &v);
// v=[self unsignedIntegerValue];
if (v<=max)
return YES;
else
return NO;
}
else
return NO;
};
else
return NO;
}
//--------------------------------------------------------------------
-(BOOL)isStartingWithNumber
@ -146,7 +139,7 @@ RCS_ID("$Id$")
+(NSString*)stringUniqueIdWithLength:(int)length
{
int i=0;
NSTimeInterval ti=[[NSDate date]timeIntervalSinceReferenceDate];
NSTimeInterval ti = [[NSDate date] timeIntervalSinceReferenceDate];
NSMutableData* data=nil;
void* pData=NULL;
NSString* dataHex=nil;
@ -201,30 +194,36 @@ RCS_ID("$Id$")
withPrefix:(NSString*)prefix
withSuffix:(NSString*)suffix
{
NSString* filename=nil;
NSFileManager* fileManager=nil;
NSArray* directoryContents=nil;
fileManager=[NSFileManager defaultManager];
directoryContents=[fileManager directoryContentsAtPath:directory];
if (!directoryContents)
NSString * filename = nil;
NSFileManager * fileManager = nil;
NSArray * directoryContents = nil;
NSError * error = nil;
fileManager = [NSFileManager defaultManager];
directoryContents = [fileManager contentsOfDirectoryAtPath:directory
error:&error];
if (!directoryContents)
{
//ERROR
//ERROR
NSDebugMLog(@"error %s %@",__PRETTY_FUNCTION__, error);
}
else
else
{
int attempts=16;
while(attempts-->0 && !filename)
int attempts=16;
while(attempts-->0 && !filename)
{
NSString* unique=[NSString stringUniqueIdWithLength:16];
filename=[NSString stringWithFormat:@"%@_%@_%@",prefix,unique,suffix];
if ([directoryContents containsObject:filename])
filename=nil;
NSString* unique=[NSString stringUniqueIdWithLength:16];
filename=[NSString stringWithFormat:@"%@_%@_%@",prefix,unique,suffix];
if ([directoryContents containsObject:filename])
filename=nil;
};
};
if (filename)
filename=[directory stringByAppendingPathComponent:filename];
return filename;
};
if (filename)
filename=[directory stringByAppendingPathComponent:filename];
return filename;
}
@end
//====================================================================

View file

@ -3,6 +3,7 @@ AFileUpload: WOFileUpload
{
filePath=aFilePath;
data=aFileData;
multiple="multiple";
};
FileName: WOString

View file

@ -3,7 +3,6 @@ ARadioButtonList: WORadioButtonList
{
list = application.bundleInfo.RadioButtonList.list;
item = anItem;
value = anItem.value;
displayString = anItem.label;
selection = selectedItem;
name = "RADIONAME";