2001-10-28 Manuel Guesdon <mguesdon@orange-concept.com>

Compilation is OK but this version hasn't been tested

        * GSWeb.framework/GSWFileUpload.m: Added Traces
                corrected bug when uploading string type data.
        * GSWExtensionsGSW.framework/GSWFileUploadFormComponent.m:
                handle nil fileInfo retrieving, added isDeleteEnabled
        * GSWExtensionsGSW.framework/GSWFileUploadFormComponent.gswc/GSWFileUploadFormComponent.html/.gswd:
                added isDeleteEnabled condition
        * GSWAdaptors/commun/GSWConfig.c/.h: added adaptorTemplatesPath handle (per application and global)
        * GSWAdaptors/commun/GSWApp.h/.c: added pszAdaptorTemplatesPath
        * GSWAdaptors/commun/GSWHTTPResponse.c added parameter to GSWTemplate_* calls
        * GSWAdaptors/commun/GSWAppRequest.c added parameter to GSWTemplate_* calls
        * GSWAdaptors/commun/GSWTemplates.h/.c: added GSWApp* parameter
                o handle per application Templates
        * GSWeb.framework/GSWResourcesManager.m: traces
        * GSWeb.framework/GSWApplication.m:
                o change trace level from "low" to "application"
                o added filterLanguages: method
        * GSWeb.framework/GSWContext.m: added filterLanguages: call in _languages
        * GSWeb.framework/GSWAssociations.m: traces
        * GSWeb.framework/GSWSession.m: Added Traces
        * GSWeb.framework/GSWUtils.m: Added warning
        * GSWeb.framework/GSWRequest.m: Added Traces
        * GSWeb.framework/GSWWOCompatibility.h/.m: added WOImageButton
        * GSWeb.framework/GSWPopUpButton.m: Added Traces
        * GSWeb.framework/GSWResponse.m: fix stringByEscapingHTMLString:
                o stringByEscapingHTMLAttributeValue:
                o stringByConvertingToHTMLEntities:
                o stringByConvertingToHTML:
        * GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added EOF access type


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@11266 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2001-10-28 10:29:17 +00:00
parent d6c8d24523
commit 1216faefec
41 changed files with 1069 additions and 402 deletions

View file

@ -1,3 +1,35 @@
2001-10-28 Manuel Guesdon <mguesdon@orange-concept.com>
Compilation is OK but this version hasn't been tested
* GSWeb.framework/GSWFileUpload.m: Added Traces
corrected bug when uploading string type data.
* GSWExtensionsGSW.framework/GSWFileUploadFormComponent.m:
handle nil fileInfo retrieving, added isDeleteEnabled
* GSWExtensionsGSW.framework/GSWFileUploadFormComponent.gswc/GSWFileUploadFormComponent.html/.gswd:
added isDeleteEnabled condition
* GSWAdaptors/commun/GSWConfig.c/.h: added adaptorTemplatesPath handle (per application and global)
* GSWAdaptors/commun/GSWApp.h/.c: added pszAdaptorTemplatesPath
* GSWAdaptors/commun/GSWHTTPResponse.c added parameter to GSWTemplate_* calls
* GSWAdaptors/commun/GSWAppRequest.c added parameter to GSWTemplate_* calls
* GSWAdaptors/commun/GSWTemplates.h/.c: added GSWApp* parameter
o handle per application Templates
* GSWeb.framework/GSWResourcesManager.m: traces
* GSWeb.framework/GSWApplication.m:
o change trace level from "low" to "application"
o added filterLanguages: method
* GSWeb.framework/GSWContext.m: added filterLanguages: call in _languages
* GSWeb.framework/GSWAssociations.m: traces
* GSWeb.framework/GSWSession.m: Added Traces
* GSWeb.framework/GSWUtils.m: Added warning
* GSWeb.framework/GSWRequest.m: Added Traces
* GSWeb.framework/GSWWOCompatibility.h/.m: added WOImageButton
* GSWeb.framework/GSWPopUpButton.m: Added Traces
* GSWeb.framework/GSWResponse.m: fix stringByEscapingHTMLString:
o stringByEscapingHTMLAttributeValue:
o stringByConvertingToHTMLEntities:
o stringByConvertingToHTML:
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added EOF access type
2001-10-27 Manuel Guesdon <mguesdon@orange-concept.com>
Applied patch from Turbocat (www.turbocat.de): gsw_26_oct_2001.patch
except

View file

@ -42,7 +42,7 @@ else
endif
endif
APACHEHEADERS := -I/usr/apache/include -I/usr/include/apache -I/usr/local/include/apache -I/usr/lib/apache/include -I/usr/local/apache/include -I/usr/local/include
APACHEHEADERS := -I/usr/apache/include -I/usr/include/apache -I/usr/local/include/apache -I/usr/lib/apache/include -I/usr/local/include -I/usr/local/apache/include
APXS := $(APXS) -lPropList -L/usr/local/lib -L/usr/pkg/lib

View file

@ -68,6 +68,8 @@ void GSWApp_Free(GSWApp* p_pApp)
free(p_pApp->pszName);
if (p_pApp->pszGSWExtensionsFrameworkWebServerResources)
free(p_pApp->pszGSWExtensionsFrameworkWebServerResources);
if (p_pApp->pszAdaptorTemplatesPath)
free(p_pApp->pszAdaptorTemplatesPath);
GSWDict_FreeElements(&p_pApp->stInstancesDict);
GSWDict_FreeElements(&p_pApp->stHeadersDict);
free(p_pApp);

View file

@ -33,6 +33,7 @@ typedef struct _GSWApp
GSWDict stHeadersDict;
char* pszGSWExtensionsFrameworkWebServerResources;
BOOL fCanDump;
char* pszAdaptorTemplatesPath;
} GSWApp;
typedef struct _GSWAppInstance

View file

@ -185,9 +185,12 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
};
if (fAppNotResponding)
{
GSWApp* pApp=(p_pAppRequest ? (p_pAppRequest->pAppInstance ? p_pAppRequest->pAppInstance->pApp : NULL) : NULL);
char* pszString=GSWTemplate_ErrorNoResponseMessage(TRUE,pApp);
pHTTPResponse = GSWHTTPResponse_BuildErrorResponse(p_pAppRequest,
GSWTemplate_ErrorNoResponseMessage(TRUE),
p_pLogServerData);
pszString,
p_pLogServerData);
free(pszString);
};
if (!pHTTPResponse)
{

View file

@ -429,6 +429,7 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
BOOL fOk=TRUE;
char pszParents[4096]="";
proplist_t pValueCanDump=NULL;
proplist_t pValueAdaptorTemplatesPath=NULL;
if (p_pApp->pszName)
free(p_pApp->pszName);
p_pApp->pszName=SafeStrdup(p_pszAppName);//We'll own the AppName
@ -446,6 +447,24 @@ BOOL GSWConfig_PropListApplicationToApplication(GSWApp* p_pApp,
CONST char* pszCanDump=PLGetString(pValueCanDump);//Do Not Free It
p_pApp->fCanDump=(strcasecmp(pszCanDump,"YES")==0);
};
//adaptorTemplates
pValueAdaptorTemplatesPath=GSWPropList_GetDictionaryEntry(p_propListApp,
"adaptorTemplatesPath",
pszParents,
FALSE,//No Error If Not Exists
GSWPropList_TestString,
p_pLogServerData);
if (p_pApp->pszAdaptorTemplatesPath)
{
free(p_pApp->pszAdaptorTemplatesPath);
p_pApp->pszAdaptorTemplatesPath=NULL;
};
if (pValueAdaptorTemplatesPath)
{
CONST char* pszPath=PLGetString(pValueAdaptorTemplatesPath);//Do Not Free It
p_pApp->pszAdaptorTemplatesPath=SafeStrdup(pszPath);
};
//GSWExtensionsFrameworkWebServerResources
{
proplist_t pValuePath=NULL;
@ -640,6 +659,27 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
g_gswConfig.fCanDumpStatus=(strcasecmp(pszCanDumpStatus,"YES")==0);
};
};
//adaptorTemplates
{
proplist_t pValueAdaptorTemplatesPath=NULL;
if (g_gswConfig.pszAdaptorTemplatesPath)
{
free(g_gswConfig.pszAdaptorTemplatesPath);
g_gswConfig.pszAdaptorTemplatesPath=NULL;
};
pValueAdaptorTemplatesPath=GSWPropList_GetDictionaryEntry(propListConfig,
"adaptorTemplatesPath",
NULL,
FALSE,//No Error If Not Exists
GSWPropList_TestString,
p_pLogServerData);
if (pValueAdaptorTemplatesPath)
{
CONST char* pszPath=PLGetString(pValueAdaptorTemplatesPath);//Do Not Free It
g_gswConfig.pszAdaptorTemplatesPath=SafeStrdup(pszPath);
};
};
//GSWExtensionsFrameworkWebServerResources
{
@ -837,8 +877,12 @@ void GSWConfig_DumpGSWAppInstanceIntern(GSWDictElem* p_pElem,void* p_pData)
char szBuffer[4096]="";
GSWAppInstance* pAppInstance=(GSWAppInstance*)p_pElem->pValue;
GSWDumpParams* pParams=(GSWDumpParams*)p_pData;
char* pszString=NULL;
//Template
GSWString_Append(pBuffer,GSWTemplate_GetDumpAppInstance(pParams->fHTML));
pszString=GSWTemplate_GetDumpAppInstance(pParams->fHTML);
GSWString_Append(pBuffer,pszString);
free(pszString);
//NUM
sprintf(szBuffer,"%d",
@ -861,7 +905,7 @@ void GSWConfig_DumpGSWAppInstanceIntern(GSWDictElem* p_pElem,void* p_pData)
//InstanceHeader
//TODO
GSWTemplate_ReplaceStd(pBuffer,pAppInstance->pApp);
//Append !
GSWString_Append(pParams->pBuffer,pBuffer->pszData);
@ -878,9 +922,12 @@ void GSWConfig_DumpGSWAppIntern(GSWDictElem* p_pElem,void* p_pData)
{
GSWString* pBuffer=GSWString_New();
char szBuffer[4096]="";
char* pszString=NULL;
//Template
GSWString_Append(pBuffer,GSWTemplate_GetDumpApp(pParams->fHTML));
pszString=GSWTemplate_GetDumpApp(pParams->fHTML);
GSWString_Append(pBuffer,pszString);
free(pszString);
//AppName
GSWString_SearchReplace(pBuffer,"##NAME##",pApp->pszName);
@ -926,6 +973,7 @@ GSWString* GSWConfig_DumpGSWApps(const char* p_pszReqApp,
{
GSWString* pBuffer=GSWString_New();
GSWDumpParams stParams;
char* pszString=NULL;
GSWLock_Lock(g_lockAppList);
stParams.pBuffer=GSWString_New();
@ -936,7 +984,9 @@ GSWString* GSWConfig_DumpGSWApps(const char* p_pszReqApp,
stParams.pLogServerData=p_pLogServerData;
//Template Head
GSWString_Append(pBuffer,GSWTemplate_GetDumpHead(p_fHTML));
pszString=GSWTemplate_GetDumpHead(p_fHTML);
GSWString_Append(pBuffer,pszString);
free(pszString);
GSWString_SearchReplace(pBuffer,"##APP_NAME##",p_pszReqApp);
GSWTemplate_ReplaceStd(pBuffer,NULL);
@ -950,7 +1000,9 @@ GSWString* GSWConfig_DumpGSWApps(const char* p_pszReqApp,
&stParams);
//Template Foot
pBuffer=GSWString_New();
GSWString_Append(pBuffer,GSWTemplate_GetDumpFoot(p_fHTML));
pszString=GSWTemplate_GetDumpFoot(p_fHTML);
GSWString_Append(pBuffer,pszString);
free(pszString);
GSWTemplate_ReplaceStd(pBuffer,NULL);
GSWString_Append(stParams.pBuffer,pBuffer->pszData);
GSWString_Free(pBuffer);

View file

@ -99,6 +99,7 @@ typedef struct _GSWConfig
char* pszConfigFilePath;
char* pszGSWExtensionsFrameworkWebServerResources;
BOOL fCanDumpStatus;
char* pszAdaptorTemplatesPath;
} GSWConfig;

View file

@ -95,6 +95,7 @@ GSWHTTPResponse* GSWHTTPResponse_BuildErrorResponse(GSWAppRequest* p_pAppRequest
GSWString* pBuffer=GSWString_New();
GSWString* pBufferMessage=GSWString_New();
GSWHTTPResponse* pHTTPResponse=calloc(1,sizeof(GSWHTTPResponse));
char* pszString=NULL;
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPResponse_BuildErrorResponse");
if (p_pAppRequest && p_pAppRequest->pAppInstance)
pApp=p_pAppRequest->pAppInstance->pApp;
@ -120,7 +121,9 @@ GSWHTTPResponse* GSWHTTPResponse_BuildErrorResponse(GSWAppRequest* p_pAppRequest
};
GSWTemplate_ReplaceStd(pBufferMessage,pApp);
GSWString_Append(pBuffer,GSWTemplate_ErrorResponseText(TRUE));
pszString=GSWTemplate_ErrorResponseText(TRUE,pApp);
GSWString_Append(pBuffer,pszString);
free(pszString);
GSWString_SearchReplace(pBuffer,"##TEXT##",pBufferMessage->pszData);
GSWTemplate_ReplaceStd(pBuffer,pApp);
@ -355,6 +358,7 @@ GSWHTTPResponse* GSWHTTPResponse_BuildStatusResponse(GSWHTTPRequest* p_pHTTPRequ
GSWString* pHeadersBuffer=GSWString_New();
const char* pszRemoteAddr=NULL;
const char* pszRemoteHost=NULL;
char* pszString=NULL;
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWHTTPResponse_BuildStatusResponse");
GSWLog(GSW_INFO,p_pLogServerData,"Build Status Page.");
GSWConfig_LoadConfiguration(p_pLogServerData);
@ -366,9 +370,11 @@ GSWHTTPResponse* GSWHTTPResponse_BuildStatusResponse(GSWHTTPRequest* p_pHTTPRequ
pRequestHeaders = (GSWDict*)(p_pHTTPRequest->pHeaders);
GSWDict_PerformForAllElem(pRequestHeaders,GSWHTTPResponse_AddHeaderToString,pHeadersBuffer);
if (GSWConfig_CanDumpStatus())
GSWString_Append(pContent,GSWTemplate_StatusAllowedResponse(TRUE));
pszString=GSWTemplate_StatusAllowedResponse(TRUE,NULL);
else
GSWString_Append(pContent,GSWTemplate_StatusDeniedResponse(TRUE));
pszString=GSWTemplate_StatusDeniedResponse(TRUE,NULL);
GSWString_Append(pContent,pszString);
free(pszString);
pszRemoteAddr=(const char*)GSWDict_ValueForKey(pRequestHeaders,"x-gsweb-remote-addr");
if (!pszRemoteAddr)
pszRemoteAddr="";

View file

@ -132,51 +132,131 @@ char* g_szDump_AppInstanceTemplate[2]={
"</TR>"};
//--------------------------------------------------------------------
CONST char* GSWTemplate_ErrorResponseText(BOOL p_fHTML)
char* GSWTemplate_GetTemplate(BOOL p_fHTML,GSWApp* pApp,CONST char* p_pszTemplateName)
{
return g_szErrorResponseTextTemplate[p_fHTML ? 1 : 0];
char* pszTemplate=NULL;
if (pApp && pApp->pszAdaptorTemplatesPath && p_pszTemplateName)
{
FILE* fd=NULL;
GSWConfig* gswConfig=GSWConfig_GetConfig();
int applen=strlen(pApp->pszAdaptorTemplatesPath)+strlen(p_pszTemplateName);
int globallen=strlen(gswConfig->pszAdaptorTemplatesPath)+strlen(p_pszTemplateName);
int maxlen=(applen > globallen ? applen : globallen)+20;
{
char* pathName=malloc(maxlen);
memset(pathName,0,maxlen);
if (p_fHTML)
sprintf(pathName,"%s/%s.html",pApp->pszAdaptorTemplatesPath,p_pszTemplateName);
else
sprintf(pathName,"%s/%s.txt",pApp->pszAdaptorTemplatesPath,p_pszTemplateName);
fd=fopen(pathName,"r");
if (!fd)
{
if (p_fHTML)
sprintf(pathName,"%s/%s.html",gswConfig->pszAdaptorTemplatesPath,p_pszTemplateName);
else
sprintf(pathName,"%s/%s.txt",gswConfig->pszAdaptorTemplatesPath,p_pszTemplateName);
fd=fopen(pathName,"r");
}
if (fd)
{
char buff[4096]="";
GSWString* pBuffer=GSWString_New();
while(fgets(buff,4096,fd))
{
GSWString_Append(pBuffer,buff);
};
fclose(fd);
pszTemplate=pBuffer->pszData;
GSWString_Detach(pBuffer);
GSWString_Free(pBuffer);
};
free(pathName);
pathName=NULL;
};
};
return pszTemplate;
};
//--------------------------------------------------------------------
char* GSWTemplate_ErrorResponseText(BOOL p_fHTML,GSWApp* pApp)
{
char* pszString=NULL;
pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"ErrorResponseText");
if (!pszString)
pszString=strdup(g_szErrorResponseTextTemplate[p_fHTML ? 1 : 0]);
return pszString;
};
//--------------------------------------------------------------------
CONST char* GSWTemplate_ErrorNoResponseMessage(BOOL p_fHTML)
char* GSWTemplate_ErrorNoResponseMessage(BOOL p_fHTML,GSWApp* pApp)
{
return g_szErrorNoResponseMessageTemplate[p_fHTML ? 1 : 0];
char* pszString=NULL;
pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"ErrorNoResponse");
if (!pszString)
pszString=strdup(g_szErrorNoResponseMessageTemplate[p_fHTML ? 1 : 0]);
return pszString;
};
//--------------------------------------------------------------------
CONST char* GSWTemplate_StatusAllowedResponse(BOOL p_fHTML)
char* GSWTemplate_StatusAllowedResponse(BOOL p_fHTML,GSWApp* pApp)
{
return g_szStatusResponseAllowedTemplate[p_fHTML ? 1 : 0];
char* pszString=NULL;
pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"StatusAllowedResponse");
if (!pszString)
pszString=strdup(g_szStatusResponseAllowedTemplate[p_fHTML ? 1 : 0]);
return pszString;
};
//--------------------------------------------------------------------
CONST char* GSWTemplate_StatusDeniedResponse(BOOL p_fHTML)
char* GSWTemplate_StatusDeniedResponse(BOOL p_fHTML,GSWApp* pApp)
{
return g_szStatusResponseDeniedTemplate[p_fHTML ? 1 : 0];
char* pszString=NULL;
pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"StatusDeniedResponse");
if (!pszString)
pszString=strdup(g_szStatusResponseDeniedTemplate[p_fHTML ? 1 : 0]);
return pszString;
};
//--------------------------------------------------------------------
CONST char* GSWTemplate_GetDumpHead(BOOL p_fHTML)
char* GSWTemplate_GetDumpHead(BOOL p_fHTML)
{
return g_szDump_HeadTemplate[p_fHTML ? 1 : 0];
char* pszString=NULL;
/* pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"DumpHead");
if (!pszString)*/
pszString=strdup(g_szDump_HeadTemplate[p_fHTML ? 1 : 0]);
return pszString;
};
//--------------------------------------------------------------------
CONST char* GSWTemplate_GetDumpFoot(BOOL p_fHTML)
char* GSWTemplate_GetDumpFoot(BOOL p_fHTML)
{
return g_szDump_FootTemplate[p_fHTML ? 1 : 0];
char* pszString=NULL;
/* pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"DumpFoot");
if (!pszString)*/
pszString=strdup(g_szDump_FootTemplate[p_fHTML ? 1 : 0]);
return pszString;
};
//--------------------------------------------------------------------
CONST char* GSWTemplate_GetDumpApp(BOOL p_fHTML)
char* GSWTemplate_GetDumpApp(BOOL p_fHTML)
{
return g_szDump_AppTemplate[p_fHTML ? 1 : 0];
char* pszString=NULL;
/* pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"DumpApp");
if (!pszString)*/
pszString=strdup(g_szDump_AppTemplate[p_fHTML ? 1 : 0]);
return pszString;
};
//--------------------------------------------------------------------
CONST char* GSWTemplate_GetDumpAppInstance(BOOL p_fHTML)
char* GSWTemplate_GetDumpAppInstance(BOOL p_fHTML)
{
return g_szDump_AppInstanceTemplate[p_fHTML ? 1 : 0];
char* pszString=NULL;
/* pszString=GSWTemplate_GetTemplate(p_fHTML,pApp,"DumpAppInstance");
if (!pszString)*/
pszString=strdup(g_szDump_AppInstanceTemplate[p_fHTML ? 1 : 0]);
return pszString;
};
//--------------------------------------------------------------------

View file

@ -26,14 +26,15 @@
#include "GSWApp.h"
CONST char* GSWTemplate_ErrorResponseText(BOOL p_fHTML);
CONST char* GSWTemplate_ErrorNoResponseMessage(BOOL p_fHTML);
CONST char* GSWTemplate_StatusAllowedResponse(BOOL p_fHTML);
CONST char* GSWTemplate_StatusDeniedResponse(BOOL p_fHTML);
CONST char* GSWTemplate_GetDumpHead(BOOL p_fHTML);
CONST char* GSWTemplate_GetDumpFoot(BOOL p_fHTML);
CONST char* GSWTemplate_GetDumpApp(BOOL p_fHTML);
CONST char* GSWTemplate_GetDumpAppInstance(BOOL p_fHTML);
//You need to free returned char
char* GSWTemplate_ErrorResponseText(BOOL p_fHTML,GSWApp* pApp);
char* GSWTemplate_ErrorNoResponseMessage(BOOL p_fHTML,GSWApp* pApp);
char* GSWTemplate_StatusAllowedResponse(BOOL p_fHTML,GSWApp* pApp);
char* GSWTemplate_StatusDeniedResponse(BOOL p_fHTML,GSWApp* pApp);
char* GSWTemplate_GetDumpHead(BOOL p_fHTML);
char* GSWTemplate_GetDumpFoot(BOOL p_fHTML);
char* GSWTemplate_GetDumpApp(BOOL p_fHTML);
char* GSWTemplate_GetDumpAppInstance(BOOL p_fHTML);
void GSWTemplate_ReplaceStd(GSWString* p_pString,GSWApp* p_pApp);
#endif //_GSWTemplates_h__

View file

@ -89,7 +89,9 @@ lft-OSarw.gif \
rt-OSarw.gif \
text.gif \
gswapp.gif \
gswappsrv.gif
gswappsrv.gif \
warning.gif \
error.gif
# Determine the bundle directory extension

View file

@ -46,7 +46,7 @@ endif
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS = -I$(GNUSTEP_SYSTEM_ROOT)/db -I../.. -I../GSWeb.framework/derived_src
ADDITIONAL_INCLUDE_DIRS = -I$(GNUSTEP_SYSTEM_ROOT)/db -I../..
# Additional LDFLAGS to pass to the linker
ifeq ($(debug), yes)

View file

@ -17,6 +17,7 @@ UploadFile: GSWFileUpload
enabled=^isUploadEnabled;
};
FileLink: GSWHyperlink
{
filename=fileInfo.filePath;
@ -34,6 +35,10 @@ SubmitButton: GSWSubmitButton
action = updateAction;
};
DeleteCondition: GSWConditional
{
condition = isDeleteEnabled;
};
DeleteButton: GSWSubmitButton
{
enabled=^isUploadEnabled;

View file

@ -1,8 +1,10 @@
<gsweb name="Form">
<gsweb name="ViewCondition">
<gsweb name="FileLink"></gsweb>
<gsweb name="FileLink"></gsweb>
</gsweb>
<gsweb name="UploadFile"></gsweb><br>
<gsweb name="SubmitButton"></gsweb>
<gsweb name="DeleteButton"></gsweb>
<gsweb name="DeleteCondition">
<gsweb name="DeleteButton"></gsweb>
</gsweb>
</gsweb>

View file

@ -74,6 +74,8 @@
if ([self hasBinding:@"fileInfo"])
{
fileInfo=[[self valueForBinding:@"fileInfo"] mutableCopy];
if (!fileInfo)
fileInfo=[NSMutableDictionary new];
};
};
LOGObjectFnStop();
@ -83,17 +85,33 @@
//--------------------------------------------------------------------
-(BOOL)isViewEnabled
{
BOOL _isViewEnabled=YES;
BOOL isViewEnabled=YES;
if ([self hasBinding:@"isViewEnabled"])
{
id _isViewEnabledObject=[self valueForBinding:@"isViewEnabled"];
_isViewEnabled=boolValueFor(_isViewEnabledObject);
id isViewEnabledObject=[self valueForBinding:@"isViewEnabled"];
isViewEnabled=boolValueFor(isViewEnabledObject);
};
if (_isViewEnabled)
if (isViewEnabled)
{
_isViewEnabled=([[self fileInfo]objectForKey:@"data"]!=nil);
isViewEnabled=([[self fileInfo]objectForKey:@"data"]!=nil);
};
return _isViewEnabled;
return isViewEnabled;
};
//--------------------------------------------------------------------
-(BOOL)isDeleteEnabled
{
BOOL isDeleteEnabled=NO;
if ([self hasBinding:@"isDeleteEnabled"])
{
id isDeleteEnabledObject=[self valueForBinding:@"isDeleteEnabled"];
isDeleteEnabled=boolValueFor(isDeleteEnabledObject);
};
if (isDeleteEnabled)
{
isDeleteEnabled=([[self fileInfo]objectForKey:@"data"]!=nil);
};
return isDeleteEnabled;
};
//--------------------------------------------------------------------

View file

@ -46,7 +46,7 @@ endif
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS = -I$(GNUSTEP_SYSTEM_ROOT)/db -I../.. -I../GSWeb.framework/derived_src
ADDITIONAL_INCLUDE_DIRS = -I$(GNUSTEP_SYSTEM_ROOT)/db -I../..
# Additional LDFLAGS to pass to the linker
ifeq ($(debug), yes)

View file

@ -55,6 +55,7 @@ extern BOOL WOStrictFlag;
NSString* instanceNumber;
NSMutableDictionary* requestHandlers;
GSWRequestHandler* defaultRequestHandler;
@public //TODO-NOW REMOVE
NSRecursiveLock* selfLock;
#ifndef NDEBUG
int selfLockn;
@ -611,6 +612,8 @@ extern BOOL WOStrictFlag;
-(NSArray*)stringsTableArrayNamed:(NSString*)tableName_
inFramework:(NSString*)frameworkName_
languages:(NSArray*)languages_;
//NDFN
-(NSArray*)filterLanguages:(NSArray*)languages;
@end
//====================================================================
/*

View file

@ -384,6 +384,8 @@ int GSWApplicationMainReal(NSString* _applicationClassName,
}
NS_ENDHANDLER;
};
NSDebugLog(@"result=%d",result);
printf("result=%d\n",result);
if (result>=0 && GSWApp)
{
[GSWApp _setPool:[NSAutoreleasePool new]];
@ -494,23 +496,23 @@ int GSWApplicationMain(NSString* applicationClassName,
[self setStatisticsStore:[[GSWStatisticsStore new]autorelease]];
if ([[self class]isMonitorEnabled])
{
NSDebugMLLog0(@"low",@"init: call self _setupForMonitoring");
NSDebugMLLog0(@"application",@"init: call self _setupForMonitoring");
[self _setupForMonitoring];
};
NSDebugMLLog0(@"low",@"init: call appGSWBundle initializeObject:...");
NSDebugMLLog0(@"application",@"init: call appGSWBundle initializeObject:...");
[[GSWResourceManager _applicationGSWBundle] initializeObject:self
fromArchiveNamed:@"Application"];
[self setPrintsHTMLParserDiagnostics:NO];
//call recordingPath
NSDebugMLLog0(@"low",@"init: call self registerRequestHandlers");
NSDebugMLLog0(@"application",@"init: call self registerRequestHandlers");
[self registerRequestHandlers];
[self _validateAPI];
NSDebugMLLog0(@"low",@"init: addObserver");
NSDebugMLLog0(@"application",@"init: addObserver");
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(_sessionDidTimeOutNotification:)
name:GSWNotification__SessionDidTimeOutNotification[GSWebNamingConv]
object:nil];
NSDebugMLLog0(@"low",@"init: addObserver called");
NSDebugMLLog0(@"application",@"init: addObserver called");
LOGObjectFnStop();
return self;
@ -619,7 +621,7 @@ int GSWApplicationMain(NSString* applicationClassName,
LOGObjectFnStart();
if (![self isConcurrentRequestHandlingEnabled])
{
/* NSDebugMLLog(@"low",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
/* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
globalLockn,(void*)
globalLock_thread_id,
(void*)objc_thread_id());
@ -627,25 +629,29 @@ int GSWApplicationMain(NSString* applicationClassName,
{
if (globalLock_thread_id!=objc_thread_id())
{
NSDebugMLLog(@"low",@"PROBLEM: owner!=thread id");
NSDebugMLLog(@"application",@"PROBLEM: owner!=thread id");
};
};
*/
NS_DURING
{
TmpLockBeforeDate(globalLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]);
printf("GLOBALLOCK lock ThreadID=%p\n",(void*)objc_thread_id());
//TODO-NOW TmpLockBeforeDate(globalLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]);
[globalLock lock];
printf("GLOBALLOCK locked ThreadID=%p\n",(void*)objc_thread_id());
#ifndef NDEBUG
globalLockn++;
globalLock_thread_id=objc_thread_id();
#endif
NSDebugMLLog(@"low",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
/* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
globalLockn,
(void*)globalLock_thread_id,
(void*)objc_thread_id());
(void*)objc_thread_id());*/
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"globalLock tmplockBeforeDate");
printf("%@ (%@)",localException,[localException reason]);
LOGException(@"%@ (%@)",localException,[localException reason]);
[localException raise];
};
@ -664,7 +670,7 @@ int GSWApplicationMain(NSString* applicationClassName,
{
NS_DURING
{
/* NSDebugMLLog(@"low",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
/* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
globalLockn,
(void*)globalLock_thread_id,
(void*)objc_thread_id());*/
@ -672,23 +678,26 @@ int GSWApplicationMain(NSString* applicationClassName,
{
if (globalLock_thread_id!=objc_thread_id())
{
NSDebugMLLog0(@"low",@"PROBLEM: owner!=thread id");
NSDebugMLLog0(@"application",@"PROBLEM: owner!=thread id");
};
};
printf("GLOBALLOCK unlock ThreadID=%p\n",(void*)objc_thread_id());
TmpUnlock(globalLock);
printf("GLOBALLOCK unlocked ThreadID=%p\n",(void*)objc_thread_id());
#ifndef NDEBUG
globalLockn--;
if (globalLockn==0)
globalLock_thread_id=NULL;
#endif
NSDebugMLLog(@"low",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
/* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
globalLockn,
(void*)globalLock_thread_id,
(void*)objc_thread_id());
(void*)objc_thread_id());*/
}
NS_HANDLER
{
NSDebugMLLog(@"low",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
printf("%@ (%@)",localException,[localException reason]);
NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
globalLockn,
(void*)globalLock_thread_id,
(void*)objc_thread_id());
@ -708,7 +717,7 @@ int GSWApplicationMain(NSString* applicationClassName,
//call adaptorsDispatchRequestsConcurrently
//OK
LOGObjectFnStart();
/* NSDebugMLLog(@"low",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
/* NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
selfLockn,
(void*)selfLock_thread_id,
(void*)objc_thread_id());
@ -716,21 +725,29 @@ int GSWApplicationMain(NSString* applicationClassName,
{
if (selfLock_thread_id!=objc_thread_id())
{
NSDebugMLLog(@"low",@"PROBLEM: owner!=thread id");
NSDebugMLLog(@"application",@"PROBLEM: owner!=thread id");
};
};
*/
NS_DURING
{
/* printf("SELFLOCK lock ThreadID=%p\n",(void*)objc_thread_id());
TmpLockBeforeDate(selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]);
printf("SELFLOCK locked ThreadID=%p\n",(void*)objc_thread_id());
#ifndef NDEBUG
selfLockn++;
selfLock_thread_id=objc_thread_id();
#endif
NSDebugMLLog(@"low",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
selfLockn,
(void*)selfLock_thread_id,
(void*)objc_thread_id());
*/
[selfLock lock];//NEW
#ifndef NDEBUG
selfLockn++;
selfLock_thread_id=objc_thread_id();
#endif
}
NS_HANDLER
{
@ -749,7 +766,7 @@ int GSWApplicationMain(NSString* applicationClassName,
//call adaptorsDispatchRequestsConcurrently
//OK
LOGObjectFnStart();
/* NSDebugMLLog(@"low",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
/* NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
selfLockn,
(void*)selfLock_thread_id,
(void*)objc_thread_id());
@ -757,26 +774,31 @@ int GSWApplicationMain(NSString* applicationClassName,
{
if (selfLock_thread_id!=objc_thread_id())
{
NSDebugMLLog(@"low",@"PROBLEM: owner!=thread id");
NSDebugMLLog(@"application",@"PROBLEM: owner!=thread id");
};
};
*/
NS_DURING
{
TmpUnlock(selfLock);
printf("SELFLOCK unlock ThreadID=%p\n",(void*)objc_thread_id());
// TmpUnlock(selfLock);
[selfLock unlock];//NEW
printf("SELFLOCK unlocked ThreadID=%p\n",(void*)objc_thread_id());
#ifndef NDEBUG
selfLockn--;
if (selfLockn==0)
selfLock_thread_id=NULL;
#endif
NSDebugMLLog(@"low",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
/* NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
selfLockn,
(void*)selfLock_thread_id,
(void*)objc_thread_id());
*/
}
NS_HANDLER
{
NSDebugMLLog(@"low",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
printf("%@ (%@)",localException,[localException reason]);
NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p",
selfLockn,
(void*)selfLock_thread_id,
(void*)objc_thread_id());
@ -816,15 +838,15 @@ int GSWApplicationMain(NSString* applicationClassName,
{*/
_processInfo=[NSProcessInfo processInfo];
_processName=[_processInfo processName];
NSDebugMLLog(@"low",@"_cmd:%p",_cmd);
NSDebugMLLog(@"low",@"_processInfo:%@",_processInfo);
NSDebugMLLog(@"low",@"_processName:%@",_processName);
NSDebugMLLog(@"application",@"_cmd:%p",_cmd);
NSDebugMLLog(@"application",@"_processInfo:%@",_processInfo);
NSDebugMLLog(@"application",@"_processName:%@",_processName);
_processName=[_processName lastPathComponent];
if ([_processName hasSuffix:GSWApplicationPSuffix[GSWebNamingConv]])
_name=[_processName stringWithoutSuffix:GSWApplicationPSuffix[GSWebNamingConv]];
else
_name=_processName;
NSDebugMLLog(@"low",@"_name:%@ %p",_name,_name);
NSDebugMLLog(@"application",@"_name:%@ %p",_name,_name);
// };
return _name;
LOGObjectFnStop();
@ -856,7 +878,7 @@ int GSWApplicationMain(NSString* applicationClassName,
LOGObjectFnStart();
NSDebugMLLog(@"bundles",@"[GSWResourceManager _applicationGSWBundle]:%@",[GSWResourceManager _applicationGSWBundle]);
_path=[[GSWResourceManager _applicationGSWBundle] path]; //return : H:\Wotests\ObjCTest3
NSDebugMLLog(@"low",@"_path:%@",_path);
NSDebugMLLog(@"application",@"_path:%@",_path);
LOGObjectFnStop();
return _path;
};
@ -886,15 +908,15 @@ int GSWApplicationMain(NSString* applicationClassName,
LOGObjectFnStart();
_componentRequestHandler=[[self class] _componentRequestHandler];
_componentRequestHandlerKey=[[self class] componentRequestHandlerKey];
NSDebugMLLog(@"low",@"_componentRequestHandlerKey:%@",_componentRequestHandlerKey);
NSDebugMLLog(@"application",@"_componentRequestHandlerKey:%@",_componentRequestHandlerKey);
_resourceRequestHandler=[GSWResourceRequestHandler handler];
_resourceRequestHandlerKey=[[self class] resourceRequestHandlerKey];
NSDebugMLLog(@"low",@"_resourceRequestHandlerKey:%@",_resourceRequestHandlerKey);
NSDebugMLLog(@"application",@"_resourceRequestHandlerKey:%@",_resourceRequestHandlerKey);
_directActionRequestHandler=[GSWDirectActionRequestHandler handler];
_directActionRequestHandlerKey=[[self class] directActionRequestHandlerKey];
NSDebugMLLog(@"low",@"_directActionRequestHandlerKey:%@",_directActionRequestHandlerKey);
NSDebugMLLog(@"application",@"_directActionRequestHandlerKey:%@",_directActionRequestHandlerKey);
[self registerRequestHandler:_componentRequestHandler
forKey:_componentRequestHandlerKey];
@ -904,7 +926,7 @@ int GSWApplicationMain(NSString* applicationClassName,
forKey:_directActionRequestHandlerKey];
[self registerRequestHandler:_directActionRequestHandler
forKey: GSWDirectActionRequestHandlerKey[GSWebNamingConvInversed]];
NSDebugMLLog(@"low",@"requestHandlers:%@",requestHandlers);
NSDebugMLLog(@"application",@"requestHandlers:%@",requestHandlers);
[self setDefaultRequestHandler:_componentRequestHandler];
LOGObjectFnStop();
};
@ -917,6 +939,7 @@ int GSWApplicationMain(NSString* applicationClassName,
LOGObjectFnStart();
NSDebugMLLog(@"options",@"_userDefault=%@",_userDefaults);
_args=[self _argsDictionaryWithUserDefaults:_userDefaults];
NSDebugMLLog(@"options",@"_args=%@",_args);
_adaptor=[self adaptorWithName:[_userDefaults objectForKey:GSWOPT_Adaptor[GSWebNamingConv]]
arguments:_args];
if (adaptors)
@ -1021,11 +1044,11 @@ int GSWApplicationMain(NSString* applicationClassName,
[self lock];
NS_DURING
{
NSDebugMLLog(@"low",@"componentDefinitionCache=%@",componentDefinitionCache);
NSDebugMLLog(@"application",@"componentDefinitionCache=%@",componentDefinitionCache);
_enum=[componentDefinitionCache objectEnumerator];
while ((_object = [_enum nextObject]))
{
NSDebugMLLog(@"low",@"_object=%@",_object);
NSDebugMLLog(@"application",@"_object=%@",_object);
if (_object!=GSNotFoundMarker && ![_object isCachingEnabled])
{
[_object _clearCache];
@ -1090,7 +1113,7 @@ int GSWApplicationMain(NSString* applicationClassName,
NSString* _language=nil;
int iLanguage=0;
LOGObjectFnStart();
NSDebugMLLog(@"low",@"_Name=%@",_name);
NSDebugMLLog(@"application",@"_Name=%@",_name);
for(iLanguage=0;iLanguage<[_languages count] && !_componentDefinition;iLanguage++)
{
_language=[_languages objectAtIndex:iLanguage];
@ -1125,7 +1148,7 @@ int GSWApplicationMain(NSString* applicationClassName,
if (!_componentDefinition)
{
_language=nil;
NSDebugMLLog0(@"low",@"trying no language");
NSDebugMLLog0(@"application",@"trying no language");
NSDebugMLLog(@"gswcomponents",@"[self isCachingEnabled]=%s",([self isCachingEnabled] ? "YES" : "NO"));
if ([self isCachingEnabled])
{
@ -1166,7 +1189,7 @@ int GSWApplicationMain(NSString* applicationClassName,
(_language ? _language : @""),
(isCachedComponent ? "" : "Not ")];
};
NSDebugMLLog(@"low",@"%s componentDefinition for %@ class=%@ %s",
NSDebugMLLog(@"application",@"%s componentDefinition for %@ class=%@ %s",
(_componentDefinition ? "FOUND" : "NOTFOUND"),
_name,
(_componentDefinition ? [[_componentDefinition class] description]: @""),
@ -1198,7 +1221,7 @@ int GSWApplicationMain(NSString* applicationClassName,
_path=[_resourceManager pathForResourceNamed:_resourceName
inFramework:nil
language:_language];
NSDebugMLLog(@"low",@"_path=%@",_path);
NSDebugMLLog(@"application",@"_path=%@",_path);
if (!_path)
{
NSArray* _frameworks=[self lockedComponentBearingFrameworks];
@ -1229,7 +1252,7 @@ int GSWApplicationMain(NSString* applicationClassName,
NSDebugMLLog(@"gswcomponents",@"_frameworkName=%@",_frameworkName);
};
};
NSDebugMLLog(@"low",@"_path=%@",_path);
NSDebugMLLog(@"application",@"_path=%@",_path);
};
};
if (_path)
@ -1367,7 +1390,7 @@ int GSWApplicationMain(NSString* applicationClassName,
if ([self isRefusingNewSessions])
{
//TODO erreur ?
NSDebugMLLog0(@"low",@"isRefusingNewSessions!");
NSDebugMLLog0(@"application",@"isRefusingNewSessions!");
}
else
*/
@ -1435,8 +1458,8 @@ int GSWApplicationMain(NSString* applicationClassName,
else
[_threadDictionary removeObjectForKey:GSWThreadKey_Context];
// ASSIGN(context,_context);
NSDebugMLLog(@"low",@"context:%p",(void*)context_);
NSDebugMLLog(@"low",@"context retain count:%p",[context_ retainCount]);
NSDebugMLLog(@"application",@"context:%p",(void*)context_);
NSDebugMLLog(@"application",@"context retain count:%p",[context_ retainCount]);
LOGObjectFnStop();
};
@ -1449,7 +1472,7 @@ int GSWApplicationMain(NSString* applicationClassName,
LOGObjectFnStart();
_threadDictionary=GSCurrentThreadDictionary();
_context=[_threadDictionary objectForKey:GSWThreadKey_Context];
NSDebugMLLog(@"low",@"context:%p",(void*)_context);
NSDebugMLLog(@"application",@"context:%p",(void*)_context);
LOGObjectFnStop();
return _context;
};
@ -1653,7 +1676,7 @@ int GSWApplicationMain(NSString* applicationClassName,
Class gswadaptorClass=nil;
Class adaptorClass=nil;
LOGObjectFnStart();
NSDebugMLLog(@"low",@"adaptor name:%@",name);
NSDebugMLLog(@"application",@"adaptor name:%@",name);
gswadaptorClass=[GSWAdaptor class];
adaptorClass=NSClassFromString(name);
NSAssert1(adaptorClass,@"No adaptor named '%@'",name);
@ -1663,7 +1686,7 @@ int GSWApplicationMain(NSString* applicationClassName,
{
adaptor=[[[adaptorClass alloc] initWithName:name
arguments:arguments] autorelease];
NSDebugMLLog(@"low",@"adaptor:%@",adaptor);
NSDebugMLLog(@"application",@"adaptor:%@",adaptor);
}
else
{
@ -1816,11 +1839,11 @@ int GSWApplicationMain(NSString* applicationClassName,
NSString* sessionPath=[self pathForResourceNamed:@"session"
ofType:nil];
Class _principalClass=[self libraryClassWithPath:sessionPath];
NSDebugMLLog(@"low",@"_principalClass=%@",_principalClass);
NSDebugMLLog(@"application",@"_principalClass=%@",_principalClass);
if (_principalClass)
{
_sessionClass=NSClassFromString(GSWClassName_Session);
NSDebugMLLog(@"low",@"sessionClass=%@",_sessionClass);
NSDebugMLLog(@"application",@"sessionClass=%@",_sessionClass);
};
};
@ -1845,10 +1868,10 @@ int GSWApplicationMain(NSString* applicationClassName,
if (!ClassIsKindOfClass(_sessionClass,_gswsessionClass))
{
//TODO exception
NSDebugMLLog(@"low",@"session class is not a kind of GSWSession\n");
NSDebugMLLog(@"application",@"session class is not a kind of GSWSession\n");
}
};
NSDebugMLLog(@"low",@"_sessionClass:%@",_sessionClass);
NSDebugMLLog(@"application",@"_sessionClass:%@",_sessionClass);
*/
LOGObjectFnStop();
return _sessionClass;
@ -1892,7 +1915,7 @@ int GSWApplicationMain(NSString* applicationClassName,
if (!_sessionClass)
{
//TODO erreur
NSDebugMLLog0(@"low",@"No Session Class");
NSDebugMLLog0(@"application",@"No Session Class");
}
else
{
@ -2002,7 +2025,7 @@ int GSWApplicationMain(NSString* applicationClassName,
_languages=[context_ languages];
_componentDefinition=[self lockedComponentDefinitionWithName:name_
languages:_languages];
NSDebugMLLog(@"low",@"_componentDefinition=%@ (%@)",_componentDefinition,[_componentDefinition class]);
NSDebugMLLog(@"application",@"_componentDefinition=%@ (%@)",_componentDefinition,[_componentDefinition class]);
}
NS_HANDLER
{
@ -2018,7 +2041,7 @@ int GSWApplicationMain(NSString* applicationClassName,
if (!_componentDefinition)
{
//TODO
NSDebugMLLog0(@"low",@"GSWApplication _pageWithName no _componentDefinition");
NSDebugMLLog0(@"application",@"GSWApplication _pageWithName no _componentDefinition");
}
else
{
@ -2086,16 +2109,16 @@ int GSWApplicationMain(NSString* applicationClassName,
if ([associations_ isAssociationDebugEnabledInComponent:nil])
[associations_ associationsSetDebugEnabled];
_elementClass=NSClassFromString(name_);
NSDebugMLLog(@"low",@"_elementClass:%@",_elementClass);
NSDebugMLLog(@"low",@"_elementClass superClass:%@",[_elementClass superClass]);
NSDebugMLLog(@"application",@"_elementClass:%@",_elementClass);
NSDebugMLLog(@"application",@"_elementClass superClass:%@",[_elementClass superClass]);
if (_elementClass && !ClassIsKindOfClass(_elementClass,NSClassFromString(@"GSWComponent")))
{
NSDebugMLLog(@"low",@"CREATE Element of Class:%@",name_);
NSDebugMLLog(@"application",@"CREATE Element of Class:%@",name_);
_element=[[[_elementClass alloc] initWithName:name_
associations:associations_
template:templateElement_]
autorelease];
NSDebugMLLog(@"low",@"Created Element: %@",_element);
NSDebugMLLog(@"application",@"Created Element: %@",_element);
}
else
{
@ -2104,10 +2127,10 @@ int GSWApplicationMain(NSString* applicationClassName,
languages:languages_];
if (_componentDefinition)
{
NSDebugMLLog(@"low",@"CREATE SubComponent:%@",name_);
NSDebugMLLog(@"application",@"CREATE SubComponent:%@",name_);
_element=[_componentDefinition componentReferenceWithAssociations:associations_
template:templateElement_];
NSDebugMLLog(@"low",@"Created SubComponent: %@",_element);
NSDebugMLLog(@"application",@"Created SubComponent: %@",_element);
}
else
{
@ -2138,23 +2161,27 @@ int GSWApplicationMain(NSString* applicationClassName,
//call [[self class]_requestWindow];
//call [[self class]_requestLimit];
//call [self resourceManager];
SEL registerForEventsSEL=@selector(registerForEvents);
SEL unregisterForEventsSEL=@selector(unregisterForEvents);
NSDebugMLLog0(@"low",@"GSWApplication run");
SEL registerForEventsSEL=NULL;
SEL unregisterForEventsSEL=NULL;
NSDebugMLLog0(@"application",@"GSWApplication run");
LOGObjectFnStart();
NSDebugMLog(@"ThreadID=%p\n",(void*)objc_thread_id());
registerForEventsSEL=@selector(registerForEvents);
unregisterForEventsSEL=@selector(unregisterForEvents);
NSDebugMLLog(@"application",@"adaptors=%@",adaptors);
[adaptors makeObjectsPerformSelector:registerForEventsSEL];
NSDebugMLLog0(@"low",@"NSRunLoop run");
NSDebugMLLog0(@"application",@"NSRunLoop run");
//call adaptor run
//call self _openInitialURL
NSDebugMLLog(@"low",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary());
NSDebugMLLog(@"low",@"[NSRunLoop currentRunLoop]=%@",[NSRunLoop currentRunLoop]);
NSDebugMLLog(@"application",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary());
NSDebugMLLog(@"application",@"[NSRunLoop currentRunLoop]=%@",[NSRunLoop currentRunLoop]);
ASSIGN(currentRunLoop,[NSRunLoop currentRunLoop]);
NSDebugMLLog(@"low",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary());
NSDebugMLLog(@"application",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary());
[NSRunLoop run];
NSDebugMLLog0(@"low",@"NSRunLoop end run");
NSDebugMLLog0(@"application",@"NSRunLoop end run");
[adaptors makeObjectsPerformSelector:unregisterForEventsSEL];
NSDebugMLLog0(@"low",@"GSWApplication end run");
NSDebugMLLog0(@"application",@"GSWApplication end run");
LOGObjectFnStop();
};
@ -2171,9 +2198,11 @@ int GSWApplicationMain(NSString* applicationClassName,
//NDFN
-(void)threadWillExit
{
GSWLogC("GC** GarbageCollector collectGarbages START");
[GarbageCollector collectGarbages];
GSWLogC("GC** GarbageCollector collectGarbages STOP");
// GSWLogC("GC** GarbageCollector collectGarbages START");
printf("GC** GarbageCollector collectGarbages START");
//TODO-NOW [GarbageCollector collectGarbages];//LAST //CLEAN
// GSWLogC("GC** GarbageCollector collectGarbages STOP");
printf("GC** GarbageCollector collectGarbages STOP");
};
//--------------------------------------------------------------------
@ -2223,12 +2252,12 @@ int GSWApplicationMain(NSString* applicationClassName,
[self lock];
NS_DURING
{
NSDebugMLLog(@"low",@"[self runLoop]=%p",(void*)[self runLoop]);
NSDebugMLLog(@"low",@"currentMode=%@",[[self runLoop]currentMode]);
NSDebugMLLog(@"low",@"NSDefaultRunLoopMode=%@",NSDefaultRunLoopMode);
NSDebugMLLog(@"application",@"[self runLoop]=%p",(void*)[self runLoop]);
NSDebugMLLog(@"application",@"currentMode=%@",[[self runLoop]currentMode]);
NSDebugMLLog(@"application",@"NSDefaultRunLoopMode=%@",NSDefaultRunLoopMode);
[[self runLoop]addTimer:timer_
forMode:NSDefaultRunLoopMode];
NSDebugMLLog(@"low",@"limitDateForMode=%@",[[self runLoop]limitDateForMode:NSDefaultRunLoopMode]);
NSDebugMLLog(@"application",@"limitDateForMode=%@",[[self runLoop]limitDateForMode:NSDefaultRunLoopMode]);
}
NS_HANDLER
{
@ -2387,7 +2416,7 @@ int GSWApplicationMain(NSString* applicationClassName,
NSDebugMLLog(@"requests",@"_requestHandler=%@",_requestHandler);
if (!_requestHandler)
{
NSDebugMLLog0(@"low",@"GSWApplication dispatchRequest: no request handler");
NSDebugMLLog0(@"application",@"GSWApplication dispatchRequest: no request handler");
//TODO error
}
else
@ -2501,7 +2530,7 @@ int GSWApplicationMain(NSString* applicationClassName,
{
GSWResponse* _response=nil;
LOGObjectFnStart();
NSDebugMLLog(@"low",@"context=%@",context_);
NSDebugMLLog(@"application",@"context=%@",context_);
NS_DURING
{
_response=[self _handleException:exception_
@ -2532,7 +2561,7 @@ int GSWApplicationMain(NSString* applicationClassName,
int iName=0;
GSWComponent* _page=nil;
LOGObjectFnStart();
NSDebugMLLog(@"low",@"context=%@",_context);
NSDebugMLLog(@"application",@"context=%@",_context);
if (_context)
[_context _putAwakeComponentsToSleep];
else
@ -2644,7 +2673,7 @@ int GSWApplicationMain(NSString* applicationClassName,
[self _setContext:_context];
};
_resourceManager=[self resourceManager];
NSDebugMLLog0(@"low",@"GSWComponentRequestHandler _dispatchWithPreparedSession no page");
NSDebugMLLog0(@"application",@"GSWComponentRequestHandler _dispatchWithPreparedSession no page");
for(iName=0;!_errorPage && iName<2;iName++)
{
@ -2796,10 +2825,13 @@ int GSWApplicationMain(NSString* applicationClassName,
LOGError0(@"");//TODO
};
};
//======>
if (_errorPage)
_response=[_errorPage generateResponse];
else
//<========
{
_response=[GSWResponse responseWithMessage:@"Session Restoration Error Handling failed."
inContext:_context
forRequest:nil];
@ -2913,13 +2945,13 @@ int GSWApplicationMain(NSString* applicationClassName,
{
Class _class=nil;
NSBundle* bundle=[NSBundle bundleWithPath:path_];
NSDebugMLLog(@"low",@"GSWApplication libraryClassWithPath:bundle=%@",bundle);
NSDebugMLLog(@"application",@"GSWApplication libraryClassWithPath:bundle=%@",bundle);
if (bundle)
{
BOOL result=[bundle load];
NSDebugMLLog(@"low",@"GSWApplication libraryClassWithPath:bundle load result=%d",result);
NSDebugMLLog(@"application",@"GSWApplication libraryClassWithPath:bundle load result=%d",result);
_class=[bundle principalClass];
NSDebugMLLog(@"low",@"GSWApplication libraryClassWithPath:bundle _class=%@",_class);
NSDebugMLLog(@"application",@"GSWApplication libraryClassWithPath:bundle _class=%@",_class);
};
return _class;
};
@ -3453,7 +3485,7 @@ int GSWApplicationMain(NSString* applicationClassName,
}
NS_HANDLER
{
NSDebugMLLog(@"low",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__);
NSDebugMLLog(@"application",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__);
//TODO
[self unlock];
[localException raise];
@ -3478,7 +3510,7 @@ int GSWApplicationMain(NSString* applicationClassName,
}
NS_HANDLER
{
NSDebugMLLog(@"low",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__);
NSDebugMLLog(@"application",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__);
//TODO
[self unlock];
[localException raise];
@ -3498,7 +3530,7 @@ int GSWApplicationMain(NSString* applicationClassName,
}
NS_HANDLER
{
NSDebugMLLog(@"low",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__);
NSDebugMLLog(@"application",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__);
//TODO
[self unlock];
[localException raise];
@ -3534,7 +3566,7 @@ int GSWApplicationMain(NSString* applicationClassName,
NSString* _requestHandlerKey=nil;
LOGObjectFnStart();
_requestHandlerKey=[request_ requestHandlerKey];
NSDebugMLLog(@"low",@"_requestHandlerKey=%@",_requestHandlerKey);
NSDebugMLLog(@"application",@"_requestHandlerKey=%@",_requestHandlerKey);
_handler=[self requestHandlerForKey:_requestHandlerKey];
LOGObjectFnStop();
return _handler;
@ -3645,7 +3677,7 @@ int GSWApplicationMain(NSString* applicationClassName,
NSString* _url=nil;
LOGClassFnStart();
_url=[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_ApplicationBaseURL[GSWebNamingConv]];
NSDebugMLLog(@"low",@"_url=%@",_url);
NSDebugMLLog(@"application",@"_url=%@",_url);
LOGClassFnStop();
return _url;
};
@ -3697,21 +3729,21 @@ int GSWApplicationMain(NSString* applicationClassName,
_mainBundle=[NSBundle mainBundle];
NSDebugMLLog(@"options",@"[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]=%@",[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);
_projectSearchPath=[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_ProjectSearchPath]; //return H:\\Wotests
NSDebugMLLog(@"low",@"_projectSearchPath:%@",_projectSearchPath);
NSDebugMLLog(@"application",@"_projectSearchPath:%@",_projectSearchPath);
if (!_projectSearchPath)
{
//TODO dirty hack here !
NSBundle* _mainBundle=[self mainBundle];
NSString* _bundlePath=[_mainBundle bundlePath];
NSString* _path_=[_bundlePath stringGoodPath];
NSDebugMLLog(@"low",@"_bundlePath:%@",_bundlePath);
NSDebugMLLog(@"low",@"_path_:%@",_path_);
NSDebugMLLog(@"low",@"_mainBundle:%@",_mainBundle);
NSDebugMLLog(@"application",@"_bundlePath:%@",_bundlePath);
NSDebugMLLog(@"application",@"_path_:%@",_path_);
NSDebugMLLog(@"application",@"_mainBundle:%@",_mainBundle);
_path_=[_path_ stringByDeletingLastPathComponent];
NSDebugMLLog(@"low",@"_path_:%@",_path_);
NSDebugMLLog(@"application",@"_path_:%@",_path_);
_projectSearchPath=[NSArray arrayWithObject:_path_];
};
NSDebugMLLog(@"low",@"_projectSearchPath:%@",_projectSearchPath);
NSDebugMLLog(@"application",@"_projectSearchPath:%@",_projectSearchPath);
LOGClassFnStop();
return _projectSearchPath;
};
@ -4168,7 +4200,7 @@ int GSWApplicationMain(NSString* applicationClassName,
_pathName=[_resourceManager pathForResourceNamed:[NSString stringWithFormat:@"%@.%@",name_,type_]
inFramework:frameworkName_
languages:languages_];
NSDebugMLLog(@"low",@"_pathName:%@",_pathName);
NSDebugMLLog(@"application",@"_pathName:%@",_pathName);
if (_pathName)
{
NSString* _propListString=[NSString stringWithContentsOfFile:_pathName];
@ -4201,14 +4233,14 @@ int GSWApplicationMain(NSString* applicationClassName,
for(i=0;i<[classes_ count];i++)
{
_className=[classes_ objectAtIndex:i];
NSDebugMLLog(@"low",@"_className:%@",_className);
NSDebugMLLog(@"application",@"_className:%@",_className);
_class=NSClassFromString(_className);
NSDebugMLLog(@"low",@"_class:%@",_class);
NSDebugMLLog(@"application",@"_class:%@",_class);
if (!_class)
{
NSString* _superClassName=nil;
_superClassName=[localDynCreateClassNames objectForKey:_className];
NSDebugMLLog(@"low",@"_superClassName=%p",(void*)_superClassName);
NSDebugMLLog(@"application",@"_superClassName=%p",(void*)_superClassName);
if (!_superClassName)
{
_superClassName=superClassName_;
@ -4219,7 +4251,7 @@ int GSWApplicationMain(NSString* applicationClassName,
_className);
};
};
NSDebugMLLog(@"low",@"Create Unknown Class: %@ (superclass: %@)",
NSDebugMLLog(@"application",@"Create Unknown Class: %@ (superclass: %@)",
_className,
superClassName_);
if (_superClassName)
@ -4227,7 +4259,7 @@ int GSWApplicationMain(NSString* applicationClassName,
_class=[NGObjCClass createClassWithName:_className
superClassName:_superClassName
iVars:nil];
NSDebugMLLog(@"low",@"_class:%p",_class);
NSDebugMLLog(@"application",@"_class:%p",_class);
if (_class)
{
_newClasses[_newClassIndex]=_class;
@ -4241,7 +4273,7 @@ int GSWApplicationMain(NSString* applicationClassName,
NSString* _moduleName=[NSString stringUniqueIdWithLength:4];//TODO
NGObjCModule* module=[NGObjCModule moduleWithName:_moduleName];
_ok=[module executeWithClassArray:_newClasses];
NSDebugMLLog(@"low",@"_ok:%d",(int)_ok);
NSDebugMLLog(@"application",@"_ok:%d",(int)_ok);
if (!_ok)
{
//TODO
@ -4347,6 +4379,13 @@ int GSWApplicationMain(NSString* applicationClassName,
languages:languages_];
};
//--------------------------------------------------------------------
//NDFN
-(NSArray*)filterLanguages:(NSArray*)languages
{
return languages;
};
@end
/*
//====================================================================
@ -4359,7 +4398,7 @@ int GSWApplicationMain(NSString* applicationClassName,
{
GSWComponent* component=nil;
Class _class=nil;
NSDebugMLLog(@"low",@"Page with Name:%@\n",name_);
NSDebugMLLog(@"application",@"Page with Name:%@\n",name_);
//No Name ==> "Main"
if (!name_ || [name_ length]==0)
name_=GSWMainPageName;
@ -4386,20 +4425,20 @@ int GSWApplicationMain(NSString* applicationClassName,
if (!_class)
{
//TODO exception
NSDebugMLLog0(@"low",@"No component class\n");
NSDebugMLLog0(@"application",@"No component class\n");
}
else
{
Class GSWComponentClass=NSClassFromString(@"GSWComponent");
if (!ClassIsKindOfClass(_class,GSWComponentClass))
{
NSDebugMLLog0(@"low",@"component class is not a kind of GSWComponent\n");
NSDebugMLLog0(@"application",@"component class is not a kind of GSWComponent\n");
//TODO exception
}
else
{
//TODOV
NSDebugMLLog0(@"low",@"Create Componnent\n");
NSDebugMLLog0(@"application",@"Create Componnent\n");
component=[[_class new] autorelease];
if (!component)
{
@ -4523,7 +4562,7 @@ int GSWApplicationMain(NSString* applicationClassName,
// NSString* elementName=[_XMLElement attributeForKey:@"NAME"];
Class _class=NSClassFromString(name_);
LOGObjectFnNotImplemented(); //TODOFN
NSDebugMLLog0(@"low",@"Begin GSWApplication:dynamicElementWithName\n");
NSDebugMLLog0(@"application",@"Begin GSWApplication:dynamicElementWithName\n");
if (!_class)
{
ExceptionRaise(@"GSWApplication",
@ -4541,11 +4580,11 @@ int GSWApplicationMain(NSString* applicationClassName,
}
else
{
NSDebugMLLog(@"low",@"Creating DynamicElement of Class:%@\n",_class);
NSDebugMLLog(@"application",@"Creating DynamicElement of Class:%@\n",_class);
element=[[[_class alloc] initWithName:name_
associations:associations_
template:templateElement_] autorelease];
NSDebugMLLog(@"low",@"Creating DynamicElement:%@\n",element);
NSDebugMLLog(@"application",@"Creating DynamicElement:%@\n",element);
};
};
return element;

View file

@ -705,6 +705,7 @@ if (retValue) {
_part=[keys objectAtIndex:0];
[keys removeObjectAtIndex:0];
NSDebugMLLog(@"associations",@"_part=%@",_part);
NSDebugMLLog(@"associations",@"_part class=%@",NSStringFromClass([_part class]));
_handlerClass=[associationsHandlerClasses objectForKey:_part];
NSDebugMLLog(@"associations",@"_handlerClass=%@",_handlerClass);
if (_handlerClass)

View file

@ -946,6 +946,7 @@ associationsKeys:(NSArray*)_associationsKeys
LOGObjectFnStart();
NSDebugMLLog(@"gswcomponents",@"ET=%@ id=%@",[self class],[context_ elementID]);
GSWSaveAppendToResponseElementID(context_);//Debug Only
_template=[self _template];
if(GSDebugSet(@"gswcomponents") == YES)
[response_ appendContentString:[NSString stringWithFormat:@"\n<!-- Start %@ -->\n",[self _templateName]]];//TODO enlever
@ -957,6 +958,7 @@ associationsKeys:(NSArray*)_associationsKeys
[_template appendToResponse:response_
inContext:context_];
[context_ deleteLastElementIDComponent];
NSDebugMLLog(@"gswcomponents",@"ET=%@ id=%@",[self class],[context_ elementID]);
#ifndef NDEBUG
if (![debugElementID isEqualToString:[context_ elementID]])
@ -967,6 +969,7 @@ associationsKeys:(NSArray*)_associationsKeys
#endif
if(GSDebugSet(@"gswcomponents") == YES)
[response_ appendContentString:[NSString stringWithFormat:@"\n<!-- Stop %@ -->\n",[self _templateName]]];//TODO enlever
LOGObjectFnStop();
};
@ -1338,6 +1341,23 @@ associationsKeys:(NSArray*)_associationsKeys
-(void)_debugWithString:(NSString*)_string
{
LOGObjectFnNotImplemented(); //TODOFN
/* Seems there's a problem with patches... Why this code is here ?
LOGObjectFnStart();
if (![self context])
{
NSDebugMLLog(@"gswcomponents",@"component sleeps, we awake it = %@",self);
[self awakeInContext:context_];
}
else
{
if ([self context] != context_)
{
NSDebugMLLog(@"gswcomponents",@"component is already awaken, but has not the current context, we awake it twice with current context = %@",self);
[self awakeInContext:context_];
};
};
LOGObjectFnStop();
*/
};
//--------------------------------------------------------------------
@ -1406,23 +1426,33 @@ associationsKeys:(NSArray*)_associationsKeys
[_response setHeader:@"text/html"
forKey:@"content-type"];
[_context _setResponse:_response];
//====>
_pageElement=[_context _pageElement];
_pageChanged=(self!=(GSWComponent*)_pageElement);
[_context _setPageChanged:_pageChanged];
//====>
if (_pageChanged)
[_context _setPageElement:self];
[_context _setCurrentComponent:self];
//====>
[self appendToResponse:_response
inContext:_context];
//----------------
//==>10
_session=[_context session];
NSDebugMLog(@"_session=%@",_session);
NSDebugMLog(@"_sessionID=%@",[_session sessionID]);
[_session appendCookieToResponse:_response];
//==>11
[_session _saveCurrentPage];
[_context _incrementContextID];
[_context deleteAllElementIDComponents];
[_context _setPageChanged:_pageChanged];
[_context _setPageReplaced:NO];
//<==========
LOGObjectFnStop();
return _response;
};

View file

@ -93,12 +93,14 @@ static char rcsId[] = "$Id$";
NSDebugMLLog(@"requests",@"AA _senderID=%@",_senderID);
[_context _setSenderID:_senderID];
[_application _setContext:_context];
//====>
NS_DURING
{
[_application awake];
_response=[self lockedDispatchWithPreparedApplication:_application
inContext:_context
elements:_requestHandlerValues];
}
NS_HANDLER
{
@ -120,7 +122,7 @@ static char rcsId[] = "$Id$";
NS_DURING
{
[_application sleep];
[_response _finalizeInContext:_context];
[_response _finalizeInContext:_context];//LAST //CLEAN
}
NS_HANDLER
{
@ -137,11 +139,12 @@ static char rcsId[] = "$Id$";
};
NS_ENDHANDLER;
};
//<===========
};
[_application _setContext:nil];
_statisticsStore=[[GSWApplication application] statisticsStore];
[_statisticsStore _applicationDidHandleComponentActionRequest];
NSDebugMLLog(@"requests",@"_response=%@",_response);
LOGObjectFnStop();
return _response;
@ -207,6 +210,7 @@ static char rcsId[] = "$Id$";
NS_ENDHANDLER;
};
};
//======LAST //CLEAN
if (_response || _errorResponse)
{
NSDebugMLLog(@"requests",@"_response=%@",_response);

View file

@ -577,6 +577,8 @@ static int dontTraceComponentActionURL=0;
LOGError0(@"No languages in session");
};
};
//Not WO: It enable application languages filtering
_languages=[GSWApp filterLanguages:_languages];
return _languages;
};

View file

@ -47,7 +47,7 @@ static char rcsId[] = "$Id$";
void GSWLogC_(CONST char* file,int line,CONST char* string)
{
int len=0;
if ([NSThread isMultiThreaded])
/* if ([NSThread isMultiThreaded])
{
NSThread* t = [NSThread currentThread];
fprintf(stderr,"TID=");
@ -57,10 +57,11 @@ void GSWLogC_(CONST char* file,int line,CONST char* string)
else
#endif
{
*/
void* tid=(void*)objc_thread_id();
fprintf(stderr,"%p [%ld] (%d) ",tid,(long)tid,(int)getpid());
};
};
/* };
};*/
fprintf(stderr,"File %s: %d. ",file,line);
fprintf(stderr,string);
len=strlen(string);

View file

@ -74,6 +74,7 @@ static char rcsId[] = "$Id$";
//--------------------------------------------------------------------
-(void)registerForEvents
{
NSDebugMLog(@"START registerForEvents - ThreadID=%p",(void*)objc_thread_id());
NSAssert(!fileHandle,@"fileHandle already exists");
NSDebugMLLog(@"info",@"registerForEvents port=%d",port);
NSDebugMLLog(@"info",@"registerForEvents host=%@",host);
@ -95,12 +96,16 @@ static char rcsId[] = "$Id$";
object:fileHandle];
*/
[fileHandle acceptConnectionInBackgroundAndNotify];
[GSWApplication statusLogWithFormat:@"Waiting for connections."];
NSDebugMLog(@"ThreadID=%p - B readInProgress=%d",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
printf("ThreadID=%p - B readInProgress=%d\n",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
[GSWApplication statusLogWithFormat:@"ThreadID %p: Waiting for connections.",(void*)objc_thread_id()];
NSDebugMLog(@"STOP registerForEvents");
};
//--------------------------------------------------------------------
-(void)unregisterForEvents
{
printf("ThreadID=%p - unregisterForEvents\n",(void*)objc_thread_id());
[[NSNotificationCenter defaultCenter] removeObserver:self
name: NSFileHandleConnectionAcceptedNotification
object:fileHandle];
@ -232,17 +237,72 @@ static char rcsId[] = "$Id$";
LOGObjectFnStart();
_listenHandle=[notification object];
requestDate=[NSCalendarDate calendarDate];
requestDateString=[NSString stringWithFormat:@"New Request %@",requestDate];
requestDateString=[NSString stringWithFormat:@"ThreadID=%p: New Request %@",(void*)objc_thread_id(),requestDate];
[GSWApplication statusLogWithFormat:@"%@",requestDateString];
NSDebugMLLog(@"info",@"_listenHandle=%p",(void*)_listenHandle);
inStream = [[notification userInfo]objectForKey:@"NSFileHandleNotificationFileHandleItem"];
NSDebugMLLog(@"info",@"announceNewConnection notification=%@\n",notification);
NSDebugMLLog(@"info",@"notification userInfo=%@\n",[notification userInfo]);
printf("ThreadID=%p announceNewConnection notification=%@ socketAddress=%@ [notification userInfo]=%p\n",
(void*)objc_thread_id(),
notification,
[inStream socketAddress],
[notification userInfo]);
NSDebugMLLog(@"info",@"notification userInfo=%@\n",
[notification userInfo]);
NSDebugMLog(@"ThreadID=%p - A1 readInProgress=%d",
(void*)objc_thread_id(),
(int)[fileHandle readInProgress]);
printf("ThreadID=%p - A1 readInProgress=%d\n",
(void*)objc_thread_id(),
(int)[fileHandle readInProgress]);
printf("NEW CONN APP selfLockn=%d selfLock_thread_id=%p globalLockn=%d globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d\n",
(int)([GSWApplication application]->selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id),
(int)([GSWApplication application]->globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id),
[threads count],
[waitingThreads count],
blocked);
printf("[waitingThreads count]=%d queueSize=%d",[waitingThreads count],queueSize);
if ([waitingThreads count]>=queueSize)
{
DESTROY(_newThread);
}
//remove expired thread
if ([self tryLock])
{
NSDebugMLog0(@"locked !");
NS_DURING
{
int i=0;
GSWDefaultAdaptorThread* thread=nil;
for(i=0;i<[waitingThreads count];)
{
thread=[waitingThreads objectAtIndex:i];
if ([thread isExpired])
{
// [GSWDefaultAdaptorThread sendRetryLasterResponseToStream:[thread stream]];
[waitingThreads removeObjectAtIndex:i];
}
else
i++;
};
}
NS_HANDLER
{
LOGException(@"%@ (%@)",
localException,[localException reason]);
//TODO
[self unlock];
[localException raise];
}
NS_ENDHANDLER;
[self unlock];
};
};
if ([waitingThreads count]>=queueSize)
{
printf("DESTROY the connection: too many conn - ThreadID=%p - A1 readInProgress=%d\n",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
[GSWDefaultAdaptorThread sendRetryLasterResponseToStream:inStream];
//[inStream closeFile];
}
else
{
//release done after lock !
@ -264,14 +324,18 @@ static char rcsId[] = "$Id$";
if ([threads count]<workerThreadCount)
{
[threads addObject:_newThread];
NSDebugMLLog(@"trace",@"isMultiThreadEnabled=%d",isMultiThreadEnabled);
if (isMultiThreadEnabled)
{
requestDate=[NSCalendarDate calendarDate];
requestDateString=[NSString stringWithFormat:@"Lauch Thread (Multi) %@",requestDate];
requestDateString=[NSString stringWithFormat:@"ThreadID=%p : Lauch Thread (Multi) %@",
(void*)objc_thread_id(),
requestDate];
[GSWApplication statusLogWithFormat:@"%@",requestDateString];
NSDebugMLLog(@"info",
@"Lauch Thread (Multi) %p",
(void*)_newThread);
@"ThreadID=%p : Lauch Thread (Multi) %p",
(void*)objc_thread_id(),
(void*)_newThread);
[NSThread detachNewThreadSelector:@selector(run:)
toTarget:_newThread
withObject:nil];
@ -332,28 +396,49 @@ static char rcsId[] = "$Id$";
NSDebugMLLog0(@"info",
requestDateString);
};
if ([self tryLock])
{
BOOL accept=[waitingThreads count]<queueSize;
NS_DURING
{
if (accept)
[_listenHandle acceptConnectionInBackgroundAndNotify];
}
NS_HANDLER
{
LOGException(@"%@ (%@)",
localException,[localException reason]);
//TODO
blocked=!accept;
[self unlock];
[localException raise];
}
NS_ENDHANDLER;
blocked=!accept;
[self unlock];
};
};
};
NSDebugMLLog(@"trace",@"Try Lock");
if ([self tryLock])
{
BOOL accept=YES;//NEW[waitingThreads count]<queueSize;
NSDebugMLLog(@"trace",@"Accept=%d",accept);
NS_DURING
{
if (accept)
{
[_listenHandle acceptConnectionInBackgroundAndNotify];
blocked=NO;
printf("ACCEPT ThreadID=%p A2 readInProgress=%d\n",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
}
else
printf("NOT ACCEPT ThreadID=%p A2 readInProgress=%d\n",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
NSDebugMLog(@"ThreadID=%p A2 readInProgress=%d",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
printf("ThreadID=%p A2 readInProgress=%d\n",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
}
NS_HANDLER
{
LOGException(@"%@ (%@)",
localException,[localException reason]);
//TODO
blocked=!accept;
[self unlock];
[localException raise];
}
NS_ENDHANDLER;
blocked=!accept;
printf("blocked=%d",blocked);
[self unlock];
};
NSDebugMLLog(@"trace",@"end announceNewConnection");
printf("END NEWCONN APP selfLockn=%d selfLock_thread_id=%p globalLockn=%d globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d acceptOK\n",
(int)([GSWApplication application]->selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id),
(int)([GSWApplication application]->globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id),
[threads count],
[waitingThreads count],
blocked);
LOGObjectFnStop();
return self;
};
@ -362,6 +447,17 @@ static char rcsId[] = "$Id$";
-(void)adaptorThreadExited:(GSWDefaultAdaptorThread*)adaptorThread_
{
LOGObjectFnStart();
// NSDebugMLLog(@"trace",@"adaptorThreadExited");
printf("adaptorThreadExited\n");
printf("EXIT APP selfLockn=%d selfLock_thread_id=%p globalLockn=%d globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d\n",
(int)([GSWApplication application]->selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id),
(int)([GSWApplication application]->globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id),
[threads count],
[waitingThreads count],
blocked);
if ([self tryLock])
{
NSAutoreleasePool* pool=nil;
@ -374,6 +470,8 @@ static char rcsId[] = "$Id$";
#endif
NS_DURING
{
[adaptorThread_ retain];
[adaptorThread_ autorelease];
[threads removeObject:adaptorThread_];
}
NS_HANDLER
@ -403,6 +501,7 @@ static char rcsId[] = "$Id$";
{
pool=[NSAutoreleasePool new];
LOGSeriousError0(@"Application RequestHandling is LOCKED !!!");
NSAssert(NO,@"Application RequestHandling is LOCKED !!!");//TODO-NOW
[[GSWApplication application] terminate];
DESTROY(pool);
};
@ -411,23 +510,36 @@ static char rcsId[] = "$Id$";
{
NS_DURING
{
GSWDefaultAdaptorThread* _thread=[waitingThreads objectAtIndex:0];
[threads addObject:_thread];
[waitingThreads removeObjectAtIndex:0];
GSWDefaultAdaptorThread* _thread=nil;
while(!_thread && [waitingThreads count]>0)
{
_thread=[waitingThreads objectAtIndex:0];
if ([_thread isExpired])
{
// [GSWDefaultAdaptorThread sendRetryLasterResponseToStream:[_thread stream]];
_thread=nil;
}
else
[threads addObject:_thread];
[waitingThreads removeObjectAtIndex:0];
};
if (_thread)
{
#ifndef NDEBUG
pool=[NSAutoreleasePool new];
[GSWApplication statusLogWithFormat:@"Lauch waiting Thread"];
NSDebugMLLog(@"info",
@"Lauch waiting Thread %p",
(void*)_thread);
DESTROY(pool);
pool=[NSAutoreleasePool new];
[GSWApplication statusLogWithFormat:@"Lauch waiting Thread"];
NSDebugMLLog(@"info",
@"Lauch waiting Thread %p",
(void*)_thread);
DESTROY(pool);
#endif
if (isMultiThreadEnabled)
if (isMultiThreadEnabled)
[NSThread detachNewThreadSelector:@selector(run:)
toTarget:_thread
withObject:nil];
else
toTarget:_thread
withObject:nil];
else
[_thread run:nil];
};
}
NS_HANDLER
{
@ -448,6 +560,7 @@ static char rcsId[] = "$Id$";
BOOL accept=[waitingThreads count]<queueSize;
if (blocked && accept)
{
printf("ACCEPT AGAIN ThreadID=%p A2 readInProgress=%d\n",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
[fileHandle acceptConnectionInBackgroundAndNotify];
blocked=NO;
};
@ -467,13 +580,31 @@ static char rcsId[] = "$Id$";
[self unlock];
};
//TODO remove
printf("END EXIT APP selfLockn=%d selfLock_thread_id=%p globalLockn=%d globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d\n",
(int)([GSWApplication application]->selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id),
(int)([GSWApplication application]->globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id),
[threads count],
[waitingThreads count],
blocked);
// (int)(((UnixFileHandle*)fileHandle)->acceptOK));
NSDebugMLog(@"ThreadID=%p B2 readInProgress=%d",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
printf("ThreadID=%p B2 readInProgress=%d\n",(void*)objc_thread_id(),(int)[fileHandle readInProgress]);
LOGObjectFnStop();
};
-(NSFileHandle*)fileHandle
{
return fileHandle;
};
//--------------------------------------------------------------------
//NDFN
-(id)announceBrokenConnection:(id)notification
{
LOGObjectFnNotImplemented(); //TODOFN
NSDebugMLLog(@"trace",@"announceBrokenConnection");
// [self shutDownConnectionWithSocket:[in_port _port_socket]];
return self;
};
@ -484,7 +615,9 @@ static char rcsId[] = "$Id$";
{
BOOL _locked=NO;
LOGObjectFnStart();
printf("self=%p ThreadID=%p TRYLOCK\n",self,(void*)objc_thread_id());
_locked=[selfLock tmptryLockBeforeDate:[NSDate dateWithTimeIntervalSinceNow:90]];
printf("self=%p ThreadID=%p TRYLOCK LOCKED ?\n",self,(void*)objc_thread_id());
LOGObjectFnStop();
return _locked;
};
@ -494,7 +627,9 @@ static char rcsId[] = "$Id$";
-(void)unlock
{
LOGObjectFnStart();
printf("self=%p ThreadID=%p UNLOCK\n",self,(void*)objc_thread_id());
[selfLock tmpunlock];
printf("self=%p ThreadID=%p UNLOCK UNLOCKED ?\n",self,(void*)objc_thread_id());
LOGObjectFnStop();
};

View file

@ -68,7 +68,8 @@
-(void)sendResponse:(GSWResponse*)response;
-(void)threadExited;
+(id)threadExited:(NSNotification*)notif_;
-(NSDate*)creationDate;
-(BOOL)isExpired;
@end
#endif

View file

@ -26,6 +26,9 @@ static char rcsId[] = "$Id$";
#include <GSWeb/GSWeb.h>
#include <unistd.h>
#include "NSNonBlockingFileHandle.h"
#include <gnustep/base/UnixFileHandle.h> //TODO-NOW remove
#define ADAPTOR_THREAD_TIME_OUT (5*60) //threads waiting for more than 5 minutes are not processed
//====================================================================
@implementation GSWDefaultAdaptorThread
@ -60,17 +63,22 @@ static char rcsId[] = "$Id$";
//--------------------------------------------------------------------
-(void)dealloc
{
GSWLogC("dealloc GSWDefaultAdaptorThread");
// GSWLogC("dealloc GSWDefaultAdaptorThread");
printf("dealloc GSWDefaultAdaptorThread");
DESTROY(stream);
GSWLogC("release dates");
printf("release dates");
// GSWLogC("release dates");
DESTROY(creationDate);
DESTROY(runDate);
DESTROY(dispatchRequestDate);
DESTROY(sendResponseDate);
GSWLogC("release pool");
// GSWLogC("release pool");
printf("release pool");
// DESTROY(pool);
printf("super dealloc");
[super dealloc];
GSWLogC("dealloc GSWDefaultAdaptorThread end");
// GSWLogC("dealloc GSWDefaultAdaptorThread end");
printf("dealloc GSWDefaultAdaptorThread end");
};
//--------------------------------------------------------------------
@ -91,7 +99,9 @@ static char rcsId[] = "$Id$";
{
if (destroy_)
{
DESTROY(pool);
printf("dealloc pool\n");
DESTROY(pool);
printf("end dealloc pool\n");
};
pool=pool_;
};
@ -202,7 +212,10 @@ static char rcsId[] = "$Id$";
}
NS_HANDLER
{
LOGException(@"GSWDefaultAdaptorThread: sendResponse Exception:%@ (%@)",localException,[localException reason]);
LOGException(@"GSWDefaultAdaptorThread: sendResponse Exception:%@ (%@)",
localException,
[localException reason],
[localException userInfo]);
}
NS_ENDHANDLER;
NSDebugMLLog(@"low",@"application:%@",application);
@ -210,7 +223,7 @@ static char rcsId[] = "$Id$";
};
};
};
NSDebugMLog0(@"GSWDefaultAdaptorThread: run end");
NSDebugMLog(@"GSWDefaultAdaptorThread: ThreadID=%p run end",(void*)objc_thread_id());
NSDebugMLLog(@"low",@"application:%@",application);
LOGObjectFnStop();
#ifdef DEBUG
@ -236,13 +249,15 @@ static char rcsId[] = "$Id$";
-(void)threadExited
{
// LOGObjectFnStart();
NSDebugMLLog(@"low",@"[_defaultAdaptorThread retainCount=%d",
(int)[self retainCount]);
// NSDebugMLLog0(@"trace",@"GSWDefaultAdaptorThread: threadExited method");
// NSDebugMLLog(@"low",@"[_defaultAdaptorThread retainCount=%d",
// (int)[self retainCount]);
[adaptor adaptorThreadExited:self];
[self setPool:nil
destroyLast:YES];
// LOGObjectFnStop();
GSWLogC("threadExited");
// GSWLogC("threadExited\n");
printf("threadExited\n");
};
//--------------------------------------------------------------------
@ -269,8 +284,10 @@ static char rcsId[] = "$Id$";
object:_thread];
*/
[_adaptorThread threadExited];
GSWLogC("Stop threadExited:");
GSWLogC("threadExited really exit");
// GSWLogC("Stop threadExited:");
printf("Stop threadExited:");
// GSWLogC("threadExited really exit");
printf("threadExited really exit");
return nil; //??
};
@ -565,21 +582,35 @@ static char rcsId[] = "$Id$";
-(void)sendResponse:(GSWResponse*)response
{
LOGObjectFnStart();
[[self class]sendResponse:response
toStream:stream
withNamingConv:requestNamingConv];
ASSIGN(stream,nil);
LOGObjectFnStop();
};
+(void)sendResponse:(GSWResponse*)response
toStream:(NSFileHandle*)aStream
withNamingConv:(int)requestNamingConv
{
BOOL ok=YES;
LOGObjectFnStart();
printf("class sendResponse: START\n");
[response willSend];
if (response)
{
int headerN=0;
int headerNForKey=0;
NSMutableData* responseData=[[NSMutableData new]autorelease];
NSArray* headerKeys=[response headerKeys];
NSArray* headersForKey=nil;
NSString* key=nil;
NSString* anHeader=nil;
NSString* head=[NSString stringWithFormat:@"HTTP/%@ %d %@%@\n",
[response httpVersion],
[response status],
GSWHTTPHeader_Response_OK,
GSWHTTPHeader_Response_HeaderLineEnd[requestNamingConv]];
{
int headerN=0;
int headerNForKey=0;
NSMutableData* responseData=[[NSMutableData new]autorelease];
NSArray* headerKeys=[response headerKeys];
NSArray* headersForKey=nil;
NSString* key=nil;
NSString* anHeader=nil;
NSString* head=[NSString stringWithFormat:@"HTTP/%@ %d %@%@\n",
[response httpVersion],
[response status],
GSWHTTPHeader_Response_OK,
GSWHTTPHeader_Response_HeaderLineEnd[requestNamingConv]];
/* NSString* cl=[NSString stringWithFormat:@"%@: %d\n",
GSWHTTPHeader_ContentLength,
[[response content] length]];
@ -605,8 +636,17 @@ static char rcsId[] = "$Id$";
// [responseData appendData:[cl dataUsingEncoding:NSASCIIStringEncoding]];
[responseData appendData:[empty dataUsingEncoding:NSASCIIStringEncoding]];
[stream writeData:responseData];
if ([[response content] length]>0)
NS_DURING
{
[stream writeData:responseData];
}
NS_HANDLER
{
ok=NO;
LOGException(@"GSWDefaultAdaptorThread: readRequestFromStream Exception:%@ (%@)",localException,[localException reason]);
}
NS_ENDHANDLER;
if (ok && [[response content] length]>0)
{
[responseData setLength:[[response content] length]];
[responseData setData:[response content]];
@ -620,12 +660,64 @@ static char rcsId[] = "$Id$";
NSDebugMLLog(@"low",@"Response content String :%@",[[[NSString alloc] initWithData:[response content]
encoding:NSISOLatin1StringEncoding]
autorelease]);
[stream writeData:responseData];
NSDebugMLog0(@"Response content Written");
NS_DURING
{
[aStream writeData:responseData];
}
NS_HANDLER
{
ok=NO;
LOGException(@"GSWDefaultAdaptorThread: readRequestFromStream Exception:%@ (%@)",localException,[localException reason]);
}
NS_ENDHANDLER;
NSDebugMLLog0(@"info",@"Response content Written");
};
[stream closeFile];
[aStream closeFile];
};
printf("class sendResponse: STOP\n");
LOGObjectFnStop();
};
-(NSDate*)creationDate
{
return creationDate;
};
-(BOOL)isExpired
{
BOOL isExpired=(fabs([creationDate timeIntervalSinceNow])>ADAPTOR_THREAD_TIME_OUT);
printf("EXPIRED %@ %f isExpired=%d\n",//connectOK=%d isExpired=%d\n",
creationDate,
[creationDate timeIntervalSinceNow],
//(int)(((UnixFileHandle*)stream)->connectOK),
isExpired);
return isExpired;
};
-(NSFileHandle*)stream
{
return stream;
};
+(void)sendRetryLasterResponseToStream:(NSFileHandle*)stream
{
/* GSWResponse* response=nil;
NSAutoreleasePool* pool=nil;
pool=[NSAutoreleasePool new];
printf("sendRetryLasterResponseToStream: START\n");
// LOGObjectFnStart();
response=[GSWResponse responseWithMessage:@"Temporary unavailable"
inContext:nil
forRequest:nil
forceFinalize:YES];
[response setStatus:503];//503=Service Unavailable
printf("sendResponse:\n");
[self sendResponse:response
toStream:stream
withNamingConv:GSWNAMES_INDEX];
// LOGObjectFnStop();
printf("sendRetryLasterResponseToStream: STOP\n");
DESTROY(pool);
*/
// [stream closeFile];
};
@end

View file

@ -143,6 +143,10 @@ static char rcsId[] = "$Id$";
//OK ?
NSString* _projectName=nil;
LOGObjectFnStart();
NSDebugMLLog(@"bundles",@"_gnustep_target_cpu=%@",[NSBundle _gnustep_target_cpu]);
NSDebugMLLog(@"bundles",@"_gnustep_target_dir=%@",[NSBundle _gnustep_target_dir]);
NSDebugMLLog(@"bundles",@"_gnustep_target_os=%@",[NSBundle _gnustep_target_os]);
NSDebugMLLog(@"bundles",@"_library_combo=%@",[NSBundle _library_combo]);
NSDebugMLLog(@"bundles",@"bundlePath=%@",bundlePath);
_projectName=[bundlePath lastPathComponent];
NSDebugMLLog(@"bundles",@"_projectName=%@",_projectName);

View file

@ -50,7 +50,9 @@ static char rcsId[] = "$Id$";
GSWContext* _context=nil;
[_application lockRequestHandling];
NS_DURING
{
{
NS_DURING
{
_statisticsStore=[[GSWApplication application]statisticsStore];
[_statisticsStore _applicationWillHandleDirectActionRequest];
_submitButtonsActionPathFromRequest=[self submitButtonsActionPathFromRequest:request_]; //So what ?
@ -58,67 +60,67 @@ static char rcsId[] = "$Id$";
_requestHandlerPathArray=[request_ requestHandlerPathArray];
NSDebugMLLog(@"requests",@"_requestHandlerPathArray=%@",_requestHandlerPathArray);
switch([_requestHandlerPathArray count])
{
case 0:
_actionName=@"default";
_className=@"DirectAction";
break;
case 1:
{
NSString* _tmpActionName=[NSString stringWithFormat:@"%@Action",
[_requestHandlerPathArray objectAtIndex:0]];
SEL _tmpActionSel=NSSelectorFromString(_tmpActionName);
Class _class = NSClassFromString(@"DirectAction");
NSDebugMLLog(@"requests",@"_tmpActionName=%@",_tmpActionName);
if (_tmpActionSel && _class)
{
if ([_class instancesRespondToSelector:_tmpActionSel])
{
_actionName=[_requestHandlerPathArray objectAtIndex:0];
_className=@"DirectAction";
};
};
if (!_actionName)
{
_className=[_requestHandlerPathArray objectAtIndex:0];
_actionName=@"default";
};
};
break;
case 2:
_className=[_requestHandlerPathArray objectAtIndex:0];
_actionName=[NSString stringWithFormat:@"%@",
[_requestHandlerPathArray objectAtIndex:1]];
break;
default:
ExceptionRaise0(@"GSWDirectActionRequestHandler",@"bad parameters count");
break;
};
{
case 0:
_actionName=@"default";
_className=@"DirectAction";
break;
case 1:
{
NSString* _tmpActionName=[NSString stringWithFormat:@"%@Action",
[_requestHandlerPathArray objectAtIndex:0]];
SEL _tmpActionSel=NSSelectorFromString(_tmpActionName);
Class _class = NSClassFromString(@"DirectAction");
NSDebugMLLog(@"requests",@"_tmpActionName=%@",_tmpActionName);
if (_tmpActionSel && _class)
{
if ([_class instancesRespondToSelector:_tmpActionSel])
{
_actionName=[_requestHandlerPathArray objectAtIndex:0];
_className=@"DirectAction";
};
};
if (!_actionName)
{
_className=[_requestHandlerPathArray objectAtIndex:0];
_actionName=@"default";
};
};
break;
case 2:
_className=[_requestHandlerPathArray objectAtIndex:0];
_actionName=[NSString stringWithFormat:@"%@",
[_requestHandlerPathArray objectAtIndex:1]];
break;
default:
ExceptionRaise0(@"GSWDirectActionRequestHandler",@"bad parameters count");
break;
};
NSDebugMLLog(@"requests",@"_className=%@",_className);
NSDebugMLLog(@"requests",@"_actionName=%@",_actionName);
if ([_application isCachingEnabled])
{
//TODO
};
{
//TODO
};
{
GSWResourceManager* _resourceManager=nil;
GSWDeployedBundle* _appBundle=nil;
GSWDirectAction* _directAction=nil;
id<GSWActionResults> _actionResult=nil;
Class _class=nil;
_resourceManager=[_application resourceManager];
_appBundle=[_resourceManager _appProjectBundle];
[_resourceManager _allFrameworkProjectBundles];//So what ?
[_application awake];
_class=NSClassFromString(_className);
NSAssert1(_class,@"No direct action class named %@",_className);
_directAction=[[_class alloc]initWithRequest:request_];
NSAssert1(_directAction,@"Direct action of class named %@ can't be created",_className);
_context=[_directAction _context];
_actionResult=[_directAction performActionNamed:_actionName];
_response=[_actionResult generateResponse];
GSWResourceManager* _resourceManager=nil;
GSWDeployedBundle* _appBundle=nil;
GSWDirectAction* _directAction=nil;
id<GSWActionResults> _actionResult=nil;
Class _class=nil;
_resourceManager=[_application resourceManager];
_appBundle=[_resourceManager _appProjectBundle];
[_resourceManager _allFrameworkProjectBundles];//So what ?
[_application awake];
_class=NSClassFromString(_className);
NSAssert1(_class,@"No direct action class named %@",_className);
_directAction=[[_class alloc]initWithRequest:request_];
NSAssert1(_directAction,@"Direct action of class named %@ can't be created",_className);
_context=[_directAction _context];
_actionResult=[_directAction performActionNamed:_actionName];
_response=[_actionResult generateResponse];
//Finir ?
//Finir ?
};
}
NS_HANDLER
@ -147,7 +149,14 @@ static char rcsId[] = "$Id$";
[_application _setContext:nil];
_statisticsStore=[[GSWApplication application] statisticsStore];
[_statisticsStore _applicationDidHandleDirectActionRequestWithActionNamed:_actionName];
}
NS_HANDLER
{
LOGException(@"%@ (%@)",localException,[localException reason]);
[_application unlockRequestHandling];
[localException raise];//TODO
};
NS_ENDHANDLER;
[_application unlockRequestHandling];
};
LOGObjectFnNotImplemented(); //TODOFN

View file

@ -136,6 +136,7 @@ static char rcsId[] = "$Id$";
if (_fileDatasCount==1) {
_data=[_fileDatas objectAtIndex:0];
NSDebugMLLog(@"gswdync",@"_data (class=%@)=%@",[_data class],_data);
if (_data)
{
if ([_data isKindOfClass:[NSData class]])

View file

@ -269,4 +269,4 @@
@end
#endif __GSWGeometricRegion_h_
#endif // __GSWGeometricRegion_h_

View file

@ -39,6 +39,9 @@
//GSWeb Additions {
GSWAssociation* handleValidationException;
// }
//GSWeb Additions {
GSWAssociation* tcEscapeHTML;
// }
};
-(id)initWithName:(NSString*)name_

View file

@ -70,6 +70,13 @@ static char rcsId[] = "$Id$";
handleValidationException = [[associations_ objectForKey:handleValidationException__Key
withDefaultObject:[handleValidationException autorelease]] retain];
NSDebugMLLog(@"gswdync",@"GSWInput: handleValidationException=%@",handleValidationException);
// Turbocat Additions
// [_attributedAssociations removeObjectForKey: escapeHTML__Key];
if ([associations_ objectForKey: escapeHTML__Key])
{
tcEscapeHTML = [[associations_ objectForKey:escapeHTML__Key withDefaultObject:nil] retain];
};
};
};
LOGObjectFnStopC("GSWInput");
@ -84,6 +91,7 @@ static char rcsId[] = "$Id$";
DESTROY(name);
DESTROY(value);
DESTROY(handleValidationException);//GSWeb Only
DESTROY(tcEscapeHTML);//GSWeb Only
[super dealloc];
};
@ -254,7 +262,14 @@ static int countAutoValue = 0;
[response_ _appendContentAsciiString:@"value"];
[response_ appendContentCharacter:'='];
[response_ appendContentCharacter:'"'];
[response_ appendContentHTMLAttributeValue:_value];
if (tcEscapeHTML && [self evaluateCondition:tcEscapeHTML inContext:context_] == NO)
{
[response_ appendContentString:_value];
}
else
{
[response_ appendContentHTMLAttributeValue:_value];
};
[response_ appendContentCharacter:'"'];
};
};

View file

@ -620,6 +620,7 @@ method=%@, uri=%@, httpVersion=%@, headers=%@, content=%@, userInfo=%@, defaultF
object=[cookie objectForKey:key_];
if (object && [object count]>0)
_cookieValueForKey=[object objectAtIndex:0];
NSDebugMLLog(@"requests",@"cookieValueForKey:%@=%@",key_,_cookieValueForKey);
LOGObjectFnStop();
return _cookieValueForKey;
};
@ -1621,6 +1622,7 @@ into
NSMutableDictionary* _uriElements=nil;
LOGObjectFnStart();
_uriElements=[self uriElements];
NSDebugMLLog(@"requests",@"_uriElements=%@",_uriElements);
if (![_uriElements objectForKey:GSWKey_SessionID[GSWebNamingConv]])
{
_tmp=[_uriElements objectForKey:GSWKey_SessionID[GSWebNamingConvInversed]];
@ -1752,6 +1754,7 @@ into
[_uriElements setObject:_tmp
forKey:GSWKey_Data[GSWebNamingConv]];
};
NSDebugMLLog(@"requests",@"_uriElements=%@",_uriElements);
LOGObjectFnStop();
return _uriElements;
};
@ -1775,6 +1778,7 @@ into
_dict=[[NSMutableDictionary new] autorelease];
//NEW//TODO
_requestHandlerKey=[((GSWDynamicURLString*)[self uri]) urlRequestHandlerKey];
NSDebugMLLog(@"requests",@"_requestHandlerKey=%@",_requestHandlerKey);
if (!_requestHandlerKey
|| (![_requestHandlerKey isEqualToString:GSWDirectActionRequestHandlerKey[GSWebNamingConv]]
&&![_requestHandlerKey isEqualToString:GSWDirectActionRequestHandlerKey[GSWebNamingConvInversed]]))

View file

@ -49,13 +49,14 @@ NSString* globalLanguagesPListPathName=nil;
{
NSString* _bundlePath=nil;
_mainBundle=[GSWApplication mainBundle];
// NSDebugFLog(@"_mainBundle:%@",_mainBundle);
NSDebugMLLog(@"resmanager",@"_mainBundle:%@",_mainBundle);
_bundlePath=[_mainBundle bundlePath];
NSDebugMLLog(@"resmanager",@"_bundlePath:%@",_bundlePath);
_deployedBundle=[GSWDeployedBundle bundleWithPath:_bundlePath];
// NSDebugFLog(@"_deployedBundle:%@",_deployedBundle);
NSDebugMLLog(@"resmanager",@"_deployedBundle:%@",_deployedBundle);
globalAppProjectBundle=[[_deployedBundle projectBundle] retain];
// NSDebugFLog(@"globalAppProjectBundle=%@",globalAppProjectBundle);
NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
NSAssert(globalAppProjectBundle,@"no globalAppProjectBundle");
// LOGDumpObject(globalAppProjectBundle,2);
//call _deployedBundle bundlePath

View file

@ -52,21 +52,21 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
//--------------------------------------------------------------------
-(void)dealloc
{
GSWLogAssertGood(self);
NSDebugFLog(@"dealloc Response %p",self);
NSDebugFLog0(@"Release Response httpVersion");
// GSWLogAssertGood(self);
// NSDebugFLog(@"dealloc Response %p",self);
// NSDebugFLog0(@"Release Response httpVersion");
DESTROY(httpVersion);
NSDebugFLog0(@"Release Response headers");
// NSDebugFLog0(@"Release Response headers");
DESTROY(headers);
NSDebugFLog0(@"Release Response contentFaults");
// NSDebugFLog0(@"Release Response contentFaults");
DESTROY(contentFaults);
NSDebugFLog0(@"Release Response contentData");
// NSDebugFLog0(@"Release Response contentData");
DESTROY(contentData);
NSDebugFLog0(@"Release Response userInfo");
// NSDebugFLog0(@"Release Response userInfo");
DESTROY(userInfo);
NSDebugFLog0(@"Release Response cookies");
//NSDebugFLog0(@"Release Response cookies");
DESTROY(cookies);
NSDebugFLog0(@"Release Response");
// NSDebugFLog0(@"Release Response");
[super dealloc];
};
@ -107,6 +107,10 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
NSAssert(isFinalizeInContextHasBeenCalled,@"GSWResponse _finalizeInContext: not called");
};
-(void)forceFinalizeInContext
{
isFinalizeInContextHasBeenCalled=YES;
};
//--------------------------------------------------------------------
// headerForKey:
@ -203,33 +207,32 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
//--------------------------------------------------------------------
// setHeaders:
-(void)setHeaders:(NSDictionary*)headerDictionary
{
if (!headers)
headers=[NSMutableDictionary new];
if (headerDictionary)
if (headerDictionary)
{
NSEnumerator *keyEnum;
id headerName;
NSEnumerator* keyEnum=nil;
id headerName=nil;
keyEnum = [headerDictionary keyEnumerator];
while (headerName = [keyEnum nextObject])
while ((headerName = [keyEnum nextObject]))
{
[self setHeaders:[NSArray arrayWithObject:[headerDictionary objectForKey:headerName]]
forKey:headerName];
}
}
}
[self setHeaders:[NSArray arrayWithObject:[headerDictionary objectForKey:headerName]] forKey:headerName];
};
};
};
//--------------------------------------------------------------------
// headers
-(NSMutableDictionary*)headers
{
return headers;
}
};
//--------------------------------------------------------------------
// setHTTPVersion:
@ -280,17 +283,22 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
//OK
NSString* _dateString=nil;
LOGObjectFnStart();
_dateString=[[NSCalendarDate date] htmlDescription];
NSDebugMLLog(@"low",@"_dateString:%@",_dateString);
[self setHeader:_dateString
forKey:@"date"];
[self setHeader:_dateString
forKey:@"expires"];
[self setHeader:@"no-cache"
forKey:@"pragma"];
[self setHeaders:[NSArray arrayWithObjects:@"private",@"no-cache",@"max-age=0",nil]
forKey:@"cache-control"];
isClientCachingDisabled=YES;
if (!isClientCachingDisabled)
{
_dateString=[[NSCalendarDate date] htmlDescription];
NSDebugMLLog(@"low",@"_dateString:%@",_dateString);
[self setHeader:_dateString
forKey:@"date"];
[self setHeader:_dateString
forKey:@"expires"];
[self setHeader:@"no-cache"
forKey:@"pragma"];
[self setHeaders:[NSArray arrayWithObjects:@"private",@"no-cache",@"max-age=0",nil]
forKey:@"cache-control"];
isClientCachingDisabled=YES;
};
LOGObjectFnStop();
};
@ -445,25 +453,29 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
//--------------------------------------------------------------------
+(NSString*)stringByEscapingHTMLString:(NSString*)string_
{
return [string_ stringByEscapingHTMLString];
NSString* _string=[NSString stringWithObject:string_];
return [_string stringByEscapingHTMLString];
};
//--------------------------------------------------------------------
+(NSString*)stringByEscapingHTMLAttributeValue:(NSString*)string_
{
return [string_ stringByEscapingHTMLAttributeValue];
NSString* _string=[NSString stringWithObject:string_];
return [_string stringByEscapingHTMLAttributeValue];
};
//--------------------------------------------------------------------
+(NSString*)stringByConvertingToHTMLEntities:(NSString*)string_
{
return [string_ stringByConvertingToHTMLEntities];
NSString* _string=[NSString stringWithObject:string_];
return [_string stringByConvertingToHTMLEntities];
};
//--------------------------------------------------------------------
+(NSString*)stringByConvertingToHTML:(NSString*)string_
{
return [string_ stringByConvertingToHTML];
NSString* _string=[NSString stringWithObject:string_];
return [_string stringByConvertingToHTML];
};
@end
@ -703,9 +715,21 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
//--------------------------------------------------------------------
//NDFN
//Last cHance Response
+(GSWResponse*)responseWithMessage:(NSString*)message_
inContext:(GSWContext*)context_
forRequest:(GSWRequest*)request_
{
return [self responseWithMessage:message_
inContext:context_
forRequest:request_
forceFinalize:NO];
};
+(GSWResponse*)responseWithMessage:(NSString*)message_
inContext:(GSWContext*)context_
forRequest:(GSWRequest*)request_
forceFinalize:(BOOL)forceFinalize
{
GSWResponse* _response=nil;
NSString* _httpVersion=nil;
@ -725,6 +749,8 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
_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",
[[_response class]stringByEscapingHTMLString:message_]];
[_response appendContentString:_responseString];
if (forceFinalize)
[_response forceFinalizeInContext];
};
LOGClassFnStop();
return _response;

View file

@ -195,12 +195,15 @@ static char rcsId[] = "$Id$";
_context=[self context];
_request=[_context request];
_applicationName=[_request applicationName];
NSDebugMLLog(@"sessions",@"_applicationName=%@",_applicationName);
_adaptorPrefix=[_request adaptorPrefix];
NSDebugMLLog(@"sessions",@"_adaptorPrefix=%@",_adaptorPrefix);
[[GSWApplication application]unlock];
_domain=[NSString stringWithFormat:@"%@/%@.%@",
_adaptorPrefix,
_applicationName,
GSWApplicationSuffix[GSWebNamingConv]];
NSDebugMLLog(@"sessions",@"_domain=%@",_domain);
LOGObjectFnStop();
return _domain;
};
@ -222,7 +225,13 @@ static char rcsId[] = "$Id$";
//--------------------------------------------------------------------
-(NSDate*)expirationDateForIDCookies
{
return [NSDate dateWithTimeIntervalSinceNow:timeOut];
NSDate* expirationDateForIDCookies=nil;
NSDebugMLLog(@"sessions",@"timeOut=%f",(double)timeOut);
expirationDateForIDCookies=[NSDate dateWithTimeIntervalSinceNow:timeOut];
NSDebugMLLog(@"sessions",@"expirationDateForIDCookies=%@ (HTML: %@)",
expirationDateForIDCookies,
[expirationDateForIDCookies htmlDescription]);
return expirationDateForIDCookies;
};
//--------------------------------------------------------------------
@ -318,6 +327,8 @@ static char rcsId[] = "$Id$";
[self setTimeOut:(NSTimeInterval) 1]; // forces to call removeSessionWithID in GSWServerSessionStore to dealloc it
[[NSNotificationCenter defaultCenter] postNotificationName:GSWNotification__SessionDidTimeOutNotification[GSWebNamingConv]
object:_sessionID];
//TODO: VERIFY
[self setTimeOut:(NSTimeInterval) 1]; // forces to call removeSessionWithID in GSWServerSessionStore to dealloc it
//goto => GSWApp _sessionDidTimeOutNotification:
//call GSWApp _discountTerminatedSession
//call GSWApp statisticsStore
@ -606,8 +617,14 @@ extern id gcObjectsToBeVisited;
{
//OK
LOGObjectFnStart();
[GarbageCollector collectGarbages];
printf("session %p _releaseAutoreleasePool START",self);
fprintf(stderr,"session %p _releaseAutoreleasePool START",self);
//TODO-NOW remettre [GarbageCollector collectGarbages];
printf("session %p _releaseAutoreleasePool after garbage",self);
fprintf(stderr,"session %p _releaseAutoreleasePool after garbage",self);
DESTROY(autoreleasePool);
printf("session %p _releaseAutoreleasePool STOP",self);
fprintf(stderr,"session %p _releaseAutoreleasePool STOP",self);
LOGObjectFnStop();
};

View file

@ -103,6 +103,7 @@ static char rcsId[] = "$Id$";
{
NSLog(@"### exception from ... addTimer... %@", [localException reason]);
LOGException(@"%@ (%@)",localException,[localException reason]);
NSLog(@"### exception ... %@", [localException reason]);
//TODO
[target unlock];
[self unlock];

View file

@ -137,6 +137,7 @@ static char rcsId[] = "$Id$";
else
{
_formattedValue=[_formatter stringForObjectValue:_valueValue];
NSDebugMLog(@"_valueValue=%@ _formattedValue=%@",_valueValue,_formattedValue);
};
if (!WOStrictFlag && convertHTML)
@ -223,6 +224,7 @@ static char rcsId[] = "$Id$";
NSDebugMLog0(@"Formatter");
_formatter=[formatter valueInComponent:_component];
};
NSDebugMLog(@"_formatter=%@",_formatter);
LOGObjectFnStopC("GSWString");
return _formatter;
};

View file

@ -416,7 +416,7 @@ extern NSData* HexStringToData(NSString* _string);
-(void)deleteFirstBytesCount:(unsigned int)bytesCount_;
-(void)deleteLastBytesCount:(unsigned int)bytesCount_;
@end
/*
//====================================================================
typedef enum _NSNumFmtType
{
@ -425,7 +425,7 @@ typedef enum _NSNumFmtType
NSNumFmtType__Float = 2,
} NSNumFmtType;
@interface NSNumberFormatter : NSFormatter <NSCoding, NSCopying>
@interface NSFooNumberFormatter : NSFormatter <NSCoding, NSCopying>
{
NSNumFmtType type;
};
@ -436,5 +436,5 @@ typedef enum _NSNumFmtType
forString:(NSString*)string
errorDescription:(NSString**)error;
@end
*/
#endif // _GSWebUtils_h__

View file

@ -453,123 +453,153 @@ void ValidationExceptionRaiseFn0(const char *func,
};
-(NSException*)exceptionByAddingToUserInfoKey:(id)key_
format:(NSString*)format_,...
format:(NSString*)format_,...
{
NSException* exception=nil;
NSString* _userInfoString=nil;
NSMutableDictionary* _userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]];
NSMutableDictionary* _userInfo=nil;
va_list args;
LOGObjectFnStart();
_userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]];
va_start(args,format_);
_userInfoString = [NSString stringWithFormat:format_
arguments:args];
arguments:args];
va_end(args);
{
id curArray = [_userInfo objectForKey:key_];
id newArray=[NSMutableArray arrayWithObject:_userInfoString];
if (!curArray) {
curArray = [NSMutableArray array];
}
if (![curArray isKindOf:[NSMutableArray class]]) {
id tempObject = curArray;
curArray = [NSMutableArray array];
[curArray addObject:tempObject];
}
if (!curArray)
{
curArray = [NSMutableArray array];
}
if (![curArray isKindOf:[NSMutableArray class]])
{
id tempObject = curArray;
curArray = [NSMutableArray array];
[curArray addObject:tempObject];
}
[newArray addObjectsFromArray:curArray];
[_userInfo setObject:newArray forKey:key_];
}
return [[self class]exceptionWithName:[self name]
reason:[self reason]
userInfo:_userInfo];
exception=[[self class]exceptionWithName:[self name]
reason:[self reason]
userInfo:_userInfo];
LOGObjectFnStop();
return exception;
};
-(NSException*)exceptionByAddingUserInfoKey:(id)key_
format:(NSString*)format_,...
format:(NSString*)format_,...
{
NSException* exception=nil;
NSString* _userInfoString=nil;
NSMutableDictionary* _userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]];
NSMutableDictionary* _userInfo=nil;
va_list args;
LOGObjectFnStart();
_userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]];
va_start(args,format_);
_userInfoString = [NSString stringWithFormat:format_
arguments:args];
arguments:args];
va_end(args);
[_userInfo setObject:_userInfoString
forKey:key_];
return [[self class]exceptionWithName:[self name]
reason:[self reason]
userInfo:_userInfo];
exception=[[self class]exceptionWithName:[self name]
reason:[self reason]
userInfo:_userInfo];
LOGObjectFnStop();
return exception;
};
-(NSException*)exceptionByAddingUserInfoFrameInfo:(NSString*)frameInfo_
{
NSMutableDictionary* _userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]];
NSArray* _frameInfoArray=[_userInfo objectForKey:@"FrameInfo"];
NSException* exception=nil;
NSMutableDictionary* _userInfo=nil;
NSArray* _frameInfoArray=nil;
LOGObjectFnStart();
_userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]];
_frameInfoArray=[_userInfo objectForKey:@"FrameInfo"];
if (_frameInfoArray)
_frameInfoArray=[_frameInfoArray arrayByAddingObject:frameInfo_];
_frameInfoArray=[_frameInfoArray arrayByAddingObject:frameInfo_];
else
_frameInfoArray=[NSArray arrayWithObject:frameInfo_];
_frameInfoArray=[NSArray arrayWithObject:frameInfo_];
[_userInfo setObject:_frameInfoArray
forKey:@"FrameInfo"];
return [[self class]exceptionWithName:[self name]
reason:[self reason]
userInfo:_userInfo];
forKey:@"FrameInfo"];
exception=[[self class]exceptionWithName:[self name]
reason:[self reason]
userInfo:_userInfo];
LOGObjectFnStop();
return exception;
};
-(NSException*)exceptionByAddingUserInfoFrameInfoFormat:(NSString*)format_,...
{
NSException* exception=nil;
NSString* _frameInfo=nil;
va_list args;
LOGObjectFnStart();
va_start(args,format_);
_frameInfo = [NSString stringWithFormat:format_
arguments:args];
arguments:args];
va_end(args);
return [self exceptionByAddingUserInfoFrameInfo:_frameInfo];
exception=[self exceptionByAddingUserInfoFrameInfo:_frameInfo];
LOGObjectFnStop();
return exception;
};
-(NSException*)exceptionByAddingUserInfoFrameInfoObject:(id)obj_
sel:(SEL)sel_
file:(const char*)file_
line:(int)line_
format:(NSString*)format_,...
sel:(SEL)sel_
file:(const char*)file_
line:(int)line_
format:(NSString*)format_,...
{
NSException* exception=nil;
Class cls = (Class)obj_;
char c = '+';
NSString* fmt=nil;
NSString* string= nil;
va_list args;
LOGObjectFnStart();
if ([obj_ isInstance] == YES)
{
c = '-';
cls = [obj_ class];
};
fmt = [NSString stringWithFormat: @"%s: %d. In [%@ %c%@] %@",
file_,
line_,
NSStringFromClass(cls),
c,
NSStringFromSelector(sel_),
format_];
file_,
line_,
NSStringFromClass(cls),
c,
NSStringFromSelector(sel_),
format_];
va_start(args,format_);
string=[NSString stringWithFormat:fmt
arguments:args];
arguments:args];
va_end(args);
return [self exceptionByAddingUserInfoFrameInfo:string];
exception=[self exceptionByAddingUserInfoFrameInfo:string];
LOGObjectFnStop();
return exception;
};
-(NSException*)exceptionByAddingUserInfoFrameInfoFunction:(const char*)fn_
file:(const char*)file_
line:(int)line_
format:(NSString*)format_,...
file:(const char*)file_
line:(int)line_
format:(NSString*)format_,...
{
NSString* fmt = [NSString stringWithFormat:@"%s: %d. In %s %@: %@",
file_,line_,fn_,format_];
NSException* exception=nil;
NSString* fmt =nil;
NSString* string= nil;
va_list args;
LOGObjectFnStart();
va_start(args,format_);
fmt = [NSString stringWithFormat:@"%s: %d. In %s %@: %@",
file_,line_,fn_,format_];
string=[NSString stringWithFormat:fmt
arguments:args];
arguments:args];
va_end(args);
return [self exceptionByAddingUserInfoFrameInfo:string];
exception=[self exceptionByAddingUserInfoFrameInfo:string];
LOGObjectFnStop();
return exception;
};
-(BOOL)isValidationException
@ -585,10 +615,13 @@ void ValidationExceptionRaiseFn0(const char *func,
//------------------------------------------------------------------------------
-(NSString*)htmlDescription
{
NSTimeZone* gmtTZ=[NSTimeZone timeZoneWithName:@"GMT"];
LOGObjectFnNotImplemented(); //TODOFN
if (!gmtTZ)
NSWarnLog(@"no time zone for GMT");
//TODO English day...
return [self descriptionWithCalendarFormat:@"%A, %d-%b-%Y %H:%M:%S GMT"
timeZone:[NSTimeZone timeZoneWithName:@"GMT"]
timeZone:gmtTZ
locale:nil];
};
@end
@ -822,10 +855,16 @@ NSString *NSLockException = @"NSLockException";
{
BOOL _isLocked=YES;
if ([self tmptryLock])
{
_isLocked=NO;
[self tmpunlock];
};
{
_isLocked=NO;
[self tmpunlock];
}
else
{
NSDebugMLog(@"Locked by _mutex->owner=%p (our ThreadID=%p)",
(void*)_mutex->owner,
(void*)objc_thread_id());
};
return _isLocked;
};
@ -2008,9 +2047,9 @@ NSData* HexStringToData(NSString* _string)
};
@end
/*
//====================================================================
@implementation NSNumberFormatter
@implementation NSFooNumberFormatter
//--------------------------------------------------------------------
-(id)initType:(NSNumFmtType)type_
@ -2134,4 +2173,4 @@ NSData* HexStringToData(NSString* _string)
};
@end
*/

View file

@ -41,7 +41,8 @@ typedef enum
NSObjectIVarsAccessType_Dictionary,
NSObjectIVarsAccessType_DictionaryWithRemoveObject,
NSObjectIVarsAccessType_DictionaryWithoutRemoveObject
NSObjectIVarsAccessType_DictionaryWithoutRemoveObject,
NSObjectIVarsAccessType_EO
} NSObjectIVarsAccessType;
@ -179,7 +180,7 @@ const char* GSGetInstanceVariableType(id obj,
- (id)getIVarNamed:(NSString *)name_
{
id value;
SEL sel = NSSelectorFromString(@"valueForKey:");
SEL sel = @selector(valueForKey:);//NEW NSSelectorFromString(@"valueForKey:");
id (*imp)(id, SEL, id) = (id (*)(id, SEL, id))[NSObject instanceMethodForSelector: sel];
//NSLog(@"%@",name_);
@ -197,6 +198,14 @@ const char* GSGetInstanceVariableType(id obj,
value=nil;
}
} else {
LOGException(@"==> %@ (%@) gvfk from string=%p gvfk sel=%p initWithCapacity from string:=%p initWithCapacity sel:=%p NSStringFromSelector(sel)",
localException,
[localException reason],
NSSelectorFromString(@"valueForKey:"),
@selector(valueForKey:),
NSSelectorFromString(@"initWithCapacity:"),
@selector(initWithCapacity:),
NSStringFromSelector(sel));
[localException raise];
}
}
@ -205,12 +214,11 @@ const char* GSGetInstanceVariableType(id obj,
return value;
}
//--------------------------------------------------------------------
- (void)setIVarNamed:(NSString *)name_
withValue:(id)value_
{
SEL sel = NSSelectorFromString(@"takeValue:forKey:");
SEL sel = @selector(takeValue:forKey:);//NEW NSSelectorFromString(@"takeValue:forKey:");
id (*imp)(id, SEL, id, id) = (id (*)(id, SEL, id, id))[NSObject instanceMethodForSelector: sel];
//NSLog(@"sel (takeValue:forKey: <NSObject>) : %d", (int)sel);
@ -424,6 +432,9 @@ void IdToPData(const char* retType,id _value,void* pdata)
case NSObjectIVarsAccessType_Dictionary:
_value=[self objectForKey:name_];
break;
case NSObjectIVarsAccessType_EO:
_value=[self valueForKey:name_];
break;
default:
break;
};
@ -540,6 +551,10 @@ void IdToPData(const char* retType,id _value,void* pdata)
{
_ivarAccess->accessType=NSObjectIVarsAccessType_Dictionary;
}
else if ([self respondsToSelector:@selector(valueForKey:)])
{
_ivarAccess->accessType=NSObjectIVarsAccessType_EO;
}
else
{
_exception=[NSException exceptionWithName:@"NSObject IVar"
@ -665,6 +680,17 @@ void IdToPData(const char* retType,id _value,void* pdata)
[self removeObjectForKey:name_];
};
break;
case NSObjectIVarsAccessType_EO:
NSDebugMLLog(@"low",
@"setIVarNamed %@ in %@ %p (superClass:%@) with takeValue:forKey:",
name_,
[self class],
self,
[self superclass]);
// keyvalue coding
[self takeValue:value_
forKey:name_];
break;
default:
break;
};
@ -793,7 +819,12 @@ void IdToPData(const char* retType,id _value,void* pdata)
else
_ivarAccess->accessType=NSObjectIVarsAccessType_DictionaryWithoutRemoveObject;
}
else
else
{
BOOL _respondsToTakeValue=[self respondsToSelector:@selector(takeValue:forKey:)];
if (_respondsToTakeValue)
_ivarAccess->accessType=NSObjectIVarsAccessType_EO;
else
{
_exception=[NSException exceptionWithName:@"NSObject IVar"
format:@"Can't set Variable named %@ in %@ %p (superClass:%@) value=%@",
@ -803,6 +834,7 @@ void IdToPData(const char* retType,id _value,void* pdata)
[self superclass],
value_];
};
};
};
};