mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-19 01:51:22 +00:00
2001-10-25 Manuel Guesdon <mguesdon@orange-concept.com>
Applied patch from Turbocat (www.turbocat.de): GSWPatch_04-JUL_2001.diff except GSWeb.framework/GSWInput.m/.h one (have to verify coherence of it) * GSWAdaptors/common/GSWApp.c/.h: Added GSWAppInfo * GSWAdaptors/common/GSWAppConnectNSSocket.c: Changes on includes * GSWAdaptors/common/GSWLoadBalancing.h: Added parameter to GSWLoadBalancing_Find* * GSWAdaptors/common/GSWLoadBalancing.c: added p_pURLComponents parameter, o management of AppInfo * GSWAdaptors/common/GSWAppRequest.c: managing refused connections * GSWExtensions.framework/GSWStatsPage.gswc/GSWStatsPage.gswd: misspelling correction * GSWExtensions.framework/GSWStatsPage.gswc/GSWStatsPage.html: Various Changes * GSWExtensions.framework/GSWStatsPage.m: changes in login/password validation o -awake added * GSWeb.framework/GSWApplication.m/.h: Manage refusing new sessions * GSWeb.framework/GSWBundle.m: debug traces commented * GSWeb.framework/GSWComponent.m: implementation of ensureAwakeInContext: * GSWeb.framework/GSWAssociation.m: special case for returned value of type GSMutableArray (Why ?) * GSWeb.framework/GSWComponentRequestHandler.m: comments added * GSWeb.framework/GSWDefaultAdaptorThread.m: added debug traces * GSWeb.framework/GSWDirectActionRequestHandler.m: replaced GSWDirectAction by DirectAction * GSWeb.framework/GSWDisplayGroup.m: initialize _baseIndex, o correct misspelled names, o added -description, o use delegate in _changedInEditingContext:, _invalidatedAllObjectsInStore:, o changes in -deleteObjectAtIndex:, * GSWeb.framework/GSWFileUpload.m: different handling of _fileDatasCount, handle bug in omniweb-browser * GSWeb.framework/GSWHyperlink.m: added ensureAwakeInContext: call * GSWeb.framework/GSWImageButton.m: added ensureAwakeInContext: call * GSWeb.framework/GSWPopUpButton.m: o use [response_ appendContentString:_noSelectionStringValue] instead of [response_ appendContentHTMLString:_noSelectionStringValue] o handle no displayString case o use [response_ appendContentString:_displayStringValue] instead of [response_ appendContentHTMLString:_displayStringValue] * GSWeb.framework/GSWConfig.h: set GSWOPTVALUE_AutoOpenInBrowser to NO * GSWeb.framework/GSWElementIDString.m: comment some debug traces * GSWeb.framework/GSWHTMLStaticGroup.m/.h: added support of documentType * GSWeb.framework/GSWHTMLURLValuedElement.m: addeded debug trace * GSWeb.framework/GSWKeyValueAssociation.m: use NSStringFromClass([retValue class]) instead of [retValue class] for log * GSWeb.framework/GSWRequest.m/.h: added -(NSDictionary*)headers; o added test on _contentType in _contentType o autorelease _dict in -uriElements * GSWeb.framework/GSWResponse.m/.h: added -setHeaders: and -headers o Added GSWResponse (GSWResponseRefused) o return self in -generateResponse * GSWeb.framework/GSWServerSessionStore.m/.h: added @interface GSWServerSessionStore (GSWServerSessionStoreInfo) o added refusing session management * GSWeb.framework/GSWSession.m: o in -terminate forces to call removeSessionWithID in GSWServerSessionStore to dealloc it * GSWeb.framework/GSWSessionTimeOutManager.m/.h: replace NSMutableOrderedArray* sessionOrderedTimeOuts; by NSMutableArray* sessionOrderedTimeOuts; o added traces o added GSWSessionTimeOutManager (GSWSessionRefused) * GSWeb.framework/GSWSubmitButton.m: raise exception if no element is returned * GSWeb.framework/GSWTemplateParser.m: added doctype management * GSWeb.framework/GSWUtils.h: added if defined for __NetBSD__ * GSWeb.framework/GSWWOCompatibility.m/.h: added WOGenericContainer, WOImageButton, WOHyperlink * GSWeb.framework/attach.m: added if defined for __NetBSD__ * GSWeb.framework/stacktrace.m: added if defined for __NetBSD__ * GSWeb.framework/GSWTemplateParserXML.m: traces commented o test XML node content before adding it * GSWeb.framework/NSObject+IVarAccess+PerformSel.m o changes in -getIVarNamed: and in setIVarNamed:withValue: (use of sel+imp, tests on parameters) * GSWAdaptors/common/GSWHTTPResponse.c: change in GSWHTTPResponse_GetResponse() o debug traces removed git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@11251 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6b85738709
commit
ee56247d12
51 changed files with 1505 additions and 438 deletions
69
ChangeLog
69
ChangeLog
|
@ -1,3 +1,72 @@
|
|||
2001-10-25 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
Applied patch from Turbocat (www.turbocat.de): GSWPatch_04-JUL_2001.diff
|
||||
except GSWeb.framework/GSWInput.m/.h one (have to verify coherence of it)
|
||||
|
||||
* GSWAdaptors/common/GSWApp.c/.h: Added GSWAppInfo
|
||||
* GSWAdaptors/common/GSWAppConnectNSSocket.c: Changes on includes
|
||||
* GSWAdaptors/common/GSWLoadBalancing.h: Added parameter to GSWLoadBalancing_Find*
|
||||
* GSWAdaptors/common/GSWLoadBalancing.c: added p_pURLComponents parameter,
|
||||
o management of AppInfo
|
||||
* GSWAdaptors/common/GSWAppRequest.c: managing refused connections
|
||||
* GSWExtensions.framework/GSWStatsPage.gswc/GSWStatsPage.gswd: misspelling correction
|
||||
* GSWExtensions.framework/GSWStatsPage.gswc/GSWStatsPage.html: Various Changes
|
||||
* GSWExtensions.framework/GSWStatsPage.m: changes in login/password validation
|
||||
o -awake added
|
||||
* GSWeb.framework/GSWApplication.m/.h: Manage refusing new sessions
|
||||
* GSWeb.framework/GSWBundle.m: debug traces commented
|
||||
* GSWeb.framework/GSWComponent.m: implementation of ensureAwakeInContext:
|
||||
* GSWeb.framework/GSWAssociation.m: special case for returned value of type GSMutableArray (Why ?)
|
||||
* GSWeb.framework/GSWComponentRequestHandler.m: comments added
|
||||
* GSWeb.framework/GSWDefaultAdaptorThread.m: added debug traces
|
||||
* GSWeb.framework/GSWDirectActionRequestHandler.m: replaced GSWDirectAction by DirectAction
|
||||
* GSWeb.framework/GSWDisplayGroup.m: initialize _baseIndex,
|
||||
o correct misspelled names,
|
||||
o added -description,
|
||||
o use delegate in _changedInEditingContext:, _invalidatedAllObjectsInStore:,
|
||||
o changes in -deleteObjectAtIndex:,
|
||||
* GSWeb.framework/GSWFileUpload.m: different handling of _fileDatasCount,
|
||||
handle bug in omniweb-browser
|
||||
* GSWeb.framework/GSWHyperlink.m: added ensureAwakeInContext: call
|
||||
* GSWeb.framework/GSWImageButton.m: added ensureAwakeInContext: call
|
||||
* GSWeb.framework/GSWPopUpButton.m:
|
||||
o use [response_ appendContentString:_noSelectionStringValue] instead of
|
||||
[response_ appendContentHTMLString:_noSelectionStringValue]
|
||||
o handle no displayString case
|
||||
o use [response_ appendContentString:_displayStringValue] instead of
|
||||
[response_ appendContentHTMLString:_displayStringValue]
|
||||
* GSWeb.framework/GSWConfig.h: set GSWOPTVALUE_AutoOpenInBrowser to NO
|
||||
* GSWeb.framework/GSWElementIDString.m: comment some debug traces
|
||||
* GSWeb.framework/GSWHTMLStaticGroup.m/.h: added support of documentType
|
||||
* GSWeb.framework/GSWHTMLURLValuedElement.m: addeded debug trace
|
||||
* GSWeb.framework/GSWKeyValueAssociation.m: use NSStringFromClass([retValue class])
|
||||
instead of [retValue class] for log
|
||||
* GSWeb.framework/GSWRequest.m/.h: added -(NSDictionary*)headers;
|
||||
o added test on _contentType in _contentType
|
||||
o autorelease _dict in -uriElements
|
||||
* GSWeb.framework/GSWResponse.m/.h: added -setHeaders: and -headers
|
||||
o Added GSWResponse (GSWResponseRefused)
|
||||
o return self in -generateResponse
|
||||
* GSWeb.framework/GSWServerSessionStore.m/.h: added @interface GSWServerSessionStore (GSWServerSessionStoreInfo)
|
||||
o added refusing session management
|
||||
* GSWeb.framework/GSWSession.m:
|
||||
o in -terminate forces to call removeSessionWithID in GSWServerSessionStore to dealloc it
|
||||
* GSWeb.framework/GSWSessionTimeOutManager.m/.h: replace NSMutableOrderedArray* sessionOrderedTimeOuts;
|
||||
by NSMutableArray* sessionOrderedTimeOuts;
|
||||
o added traces
|
||||
o added GSWSessionTimeOutManager (GSWSessionRefused)
|
||||
* GSWeb.framework/GSWSubmitButton.m: raise exception if no element is returned
|
||||
* GSWeb.framework/GSWTemplateParser.m: added doctype management
|
||||
* GSWeb.framework/GSWUtils.h: added if defined for __NetBSD__
|
||||
* GSWeb.framework/GSWWOCompatibility.m/.h: added WOGenericContainer, WOImageButton, WOHyperlink
|
||||
* GSWeb.framework/attach.m: added if defined for __NetBSD__
|
||||
* GSWeb.framework/stacktrace.m: added if defined for __NetBSD__
|
||||
* GSWeb.framework/GSWTemplateParserXML.m: traces commented
|
||||
o test XML node content before adding it
|
||||
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m
|
||||
o changes in -getIVarNamed: and in setIVarNamed:withValue: (use of sel+imp, tests on parameters)
|
||||
* GSWAdaptors/common/GSWHTTPResponse.c: change in GSWHTTPResponse_GetResponse()
|
||||
o debug traces removed
|
||||
|
||||
2001-08-28 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* GSWExtensions.framework/Makefile.preamble: Add GSWeb framework
|
||||
|
|
|
@ -191,4 +191,91 @@ void GSWAppInstance_InternClear(GSWDictElem* p_pElem,void* p_pData)
|
|||
pInstance->fValid=FALSE;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
void GSWAppInfo_Init()
|
||||
{
|
||||
if (_gswAppInfoDict == NULL) {
|
||||
_gswAppInfoDict = GSWDict_New(50); // allows 50 different instances of apps
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
char* GSWAppInfo_MakeDictKeyName(char* pszName, int iInstance)
|
||||
{
|
||||
char *name = NULL;
|
||||
|
||||
if (name = calloc(1,30)) {
|
||||
if (pszName) {
|
||||
strcpy(name, pszName);
|
||||
}
|
||||
sprintf(name + strlen(name), "%d", iInstance);
|
||||
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWAppInfo* GSWAppInfo_Find(char* pszName, int iInstance)
|
||||
{
|
||||
char *name;
|
||||
GSWAppInfo* newInfo = NULL;
|
||||
|
||||
if (_gswAppInfoDict == NULL) {
|
||||
GSWAppInfo_Init();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name = GSWAppInfo_MakeDictKeyName(pszName, iInstance);
|
||||
if (name) {
|
||||
newInfo = GSWDict_ValueForKey(_gswAppInfoDict, name);
|
||||
free(name); name = NULL;
|
||||
}
|
||||
|
||||
return newInfo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWAppInfo_Add(GSWAppInfo* appInfoDict, CONST char* keyName)
|
||||
{
|
||||
if (appInfoDict) {
|
||||
GSWDict_Add(_gswAppInfoDict, keyName, appInfoDict, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWAppInfo_Set(char* pszName, int iInstance, BOOL isRefused)
|
||||
{
|
||||
char *name;
|
||||
GSWAppInfo* newInfo = GSWAppInfo_Find(pszName, iInstance);
|
||||
time_t curTime = (time_t)0;
|
||||
BOOL addDict = FALSE;
|
||||
|
||||
if (newInfo == NULL) {
|
||||
newInfo=(GSWAppInfo*)calloc(1,sizeof(GSWAppInfo));
|
||||
addDict = TRUE;
|
||||
}
|
||||
|
||||
if (newInfo && (name = GSWAppInfo_MakeDictKeyName(pszName, iInstance) )) {
|
||||
newInfo->isRefused = isRefused;
|
||||
time(&curTime);
|
||||
newInfo->timeNextRetryTime = curTime + 10; // + 10 sec
|
||||
|
||||
if (addDict == TRUE) {
|
||||
GSWAppInfo_Add(newInfo, name);
|
||||
}
|
||||
free(name); name = NULL;
|
||||
} else {
|
||||
if (newInfo) {
|
||||
free(newInfo); newInfo = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void GSWAppInfo_Remove(GSWAppInfo* _appInfo)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,5 +58,21 @@ GSWAppInstance* GSWAppInstance_New(GSWApp* p_pApp);
|
|||
void GSWAppInstance_Free(GSWAppInstance* p_pInstance);
|
||||
BOOL GSWAppInstance_FreeIFND(GSWAppInstance* p_pInstance);
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
typedef struct _GSWAppInfo
|
||||
{
|
||||
BOOL isRefused;
|
||||
time_t timeNextRetryTime; // next try to look, if it is not refused
|
||||
} GSWAppInfo;
|
||||
|
||||
static GSWDict* _gswAppInfoDict = NULL;
|
||||
|
||||
void GSWAppInfo_Init();
|
||||
GSWAppInfo* GSWAppInfo_Find(char* pszName, int iInstance);
|
||||
void GSWAppInfo_Add(GSWAppInfo* appInfoDict, CONST char* keyName);
|
||||
void GSWAppInfo_Set(char* pszName, int iInstance, BOOL isRefused);
|
||||
void GSWAppInfo_Remove(GSWAppInfo* _appInfo);
|
||||
|
||||
|
||||
#endif // _GSWApp_h__
|
||||
|
||||
|
|
|
@ -25,12 +25,18 @@
|
|||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "GSWUtil.h"
|
||||
#include "GSWDict.h"
|
||||
#include "GSWURLUtil.h"
|
||||
#include "GSWAppRequest.h"
|
||||
//#include "GSWAppRequest.h"
|
||||
#include "GSWAppRequestStruct.h"
|
||||
#include "GSWAppConnect.h"
|
||||
|
||||
typedef SYS_NETFD AppConnectNSSocketHandle;
|
||||
|
|
|
@ -45,6 +45,20 @@
|
|||
unsigned long glbRequestsNb = 0;
|
||||
unsigned long glbResponsesNb = 0;
|
||||
|
||||
/*
|
||||
|
||||
HTTP/1.0 302 Apple WebObjects
|
||||
x-webobjects-refusenewsessions: 900
|
||||
Location: /cgi-bin/WebObjects/cancer.woa
|
||||
x-webobjects-refusing-redirection: YES
|
||||
x-webobjects-loadaverage: 1
|
||||
Content-Length: 152
|
||||
|
||||
Sorry, your request could not immediately be processed. Please try this URL: <a href="/cgi-bin/WebObjects/cancer.woa">/cgi-bin/WebObjects/cancer.woa</a>
|
||||
Connection closed by foreign host.
|
||||
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequest,
|
||||
GSWURLComponents* p_pURLComponents,
|
||||
|
@ -57,12 +71,15 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
BOOL fAppNotResponding=FALSE;
|
||||
int iAttemptsRemaining=APP_CONNECT_RETRIES_NB;
|
||||
AppConnectHandle hConnect=NULL;
|
||||
char *appName = NULL;
|
||||
int appInstance = 0;
|
||||
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWAppRequest_SendAppRequestToApp");
|
||||
|
||||
if (p_pAppRequest->iInstance>0) //-1 or 0 mean any instance
|
||||
fAppFound = GSWLoadBalancing_FindInstance(p_pAppRequest,p_pLogServerData);
|
||||
fAppFound = GSWLoadBalancing_FindInstance(p_pAppRequest,p_pLogServerData, p_pURLComponents);
|
||||
else
|
||||
fAppFound = GSWLoadBalancing_FindApp(p_pAppRequest,p_pLogServerData);
|
||||
fAppFound = GSWLoadBalancing_FindApp(p_pAppRequest,p_pLogServerData, p_pURLComponents);
|
||||
|
||||
if (!fAppFound)
|
||||
{
|
||||
|
@ -112,6 +129,9 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
"Request %s sent, awaiting response",
|
||||
(*p_ppHTTPRequest)->pszRequest);
|
||||
|
||||
appName = strdup(p_pAppRequest->pszName);
|
||||
appInstance = p_pAppRequest->iInstance;
|
||||
|
||||
p_pAppRequest->pRequest = NULL;
|
||||
pHTTPResponse = GSWHTTPResponse_GetResponse(hConnect,p_pLogServerData);
|
||||
p_pAppRequest->pResponse = pHTTPResponse;
|
||||
|
@ -125,11 +145,21 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
glbResponsesNb++;
|
||||
if (pHTTPResponse)
|
||||
{
|
||||
char *value = GSWDict_ValueForKey(pHTTPResponse->pHeaders,"x-gsweb-refusing-redirection");
|
||||
if (value && (strncmp(value,"YES",3)==0)) {
|
||||
// refuseNewSessions == YES in app
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"### This app (%s / %d) is refusing all new sessions ###", appName, appInstance);
|
||||
GSWAppInfo_Set(appName, appInstance, TRUE);
|
||||
}
|
||||
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"received: %d %s",
|
||||
pHTTPResponse->uStatus,
|
||||
pHTTPResponse->pszStatusMessage);
|
||||
};
|
||||
if (appName) {
|
||||
free(appName); appName = NULL;
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
|
@ -149,7 +179,7 @@ GSWHTTPResponse* GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest** p_ppHTTPRequ
|
|||
{
|
||||
GSWLoadBalancing_MarkNotRespondingApp(p_pAppRequest,p_pLogServerData);
|
||||
if (iAttemptsRemaining-->0)
|
||||
fAppFound=GSWLoadBalancing_FindApp(p_pAppRequest,p_pLogServerData);
|
||||
fAppFound=GSWLoadBalancing_FindApp(p_pAppRequest,p_pLogServerData, p_pURLComponents);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -246,18 +246,23 @@ GSWHTTPResponse* GSWHTTPResponse_GetResponse(AppConnectHandle p_socket,void* p_p
|
|||
#endif
|
||||
if (iReceivedCount!= pHTTPResponse->uContentLength)
|
||||
{
|
||||
pHTTPResponse->pContent = pszBuffer;//TODO: Verify this (Turbocat patch)
|
||||
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,
|
||||
"Content received doesn't equal to ContentLength. Too bad, same player shoot again !");
|
||||
|
||||
free(pszBuffer);
|
||||
pszBuffer=NULL;
|
||||
GSWHTTPResponse_Free(pHTTPResponse,p_pLogServerData);
|
||||
pHTTPResponse=NULL;
|
||||
pHTTPResponse = GSWHTTPResponse_BuildErrorResponse(NULL,"Invalid Response",p_pLogServerData);
|
||||
|
||||
}
|
||||
else
|
||||
pHTTPResponse->pContent = pszBuffer;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
if (pHTTPResponse->pContent)
|
||||
{
|
||||
char szTraceBuffer[pHTTPResponse->uContentLength+1];
|
||||
|
@ -271,6 +276,7 @@ GSWHTTPResponse* GSWHTTPResponse_GetResponse(AppConnectHandle p_socket,void* p_p
|
|||
szTraceBuffer);
|
||||
// GSWLog(GSW_INFO,p_pLogServerData,"\nEND\n");
|
||||
};
|
||||
*/
|
||||
#endif
|
||||
};
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Stop GSWHTTPResponse_GetResponse");
|
||||
|
|
|
@ -42,10 +42,11 @@
|
|||
#include "GSWHTTPHeaders.h"
|
||||
#include "GSWLoadBalancing.h"
|
||||
#include "GSWLock.h"
|
||||
#include "GSWApp.h"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,
|
||||
void* p_pLogServerData)
|
||||
void* p_pLogServerData, GSWURLComponents* p_pURLComponents)
|
||||
{
|
||||
BOOL fFound=FALSE;
|
||||
GSWApp* pApp=NULL;
|
||||
|
@ -93,14 +94,32 @@ BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,
|
|||
};
|
||||
if (pAppInstance->timeNextRetryTime==0 && pAppInstance->fValid)
|
||||
{
|
||||
fFound = TRUE;
|
||||
strcpy(p_pAppRequest->pszName,pApp->pszName);
|
||||
p_pAppRequest->iInstance = pAppInstance->iInstance;
|
||||
p_pAppRequest->pszHost = pAppInstance->pszHostName;
|
||||
p_pAppRequest->iPort = pAppInstance->iPort;
|
||||
p_pAppRequest->eType = EAppType_LoadBalanced;
|
||||
p_pAppRequest->pAppInstance = pAppInstance;
|
||||
pAppInstance->uOpenedRequestsNb++;
|
||||
BOOL okay = TRUE;
|
||||
// check if refused, time to try again ?
|
||||
if (p_pURLComponents->stRequestHandlerKey.iLength==0 || p_pURLComponents->stRequestHandlerKey.pszStart==NULL) {
|
||||
GSWAppInfo *thisAppInfo = GSWAppInfo_Find(p_pAppRequest->pszName, pAppInstance->iInstance);
|
||||
if (thisAppInfo && thisAppInfo->isRefused) {
|
||||
time_t actTime = (time_t)0;
|
||||
// this instance refuses new sessions
|
||||
time(&actTime);
|
||||
if (actTime > thisAppInfo->timeNextRetryTime) {
|
||||
thisAppInfo->isRefused = FALSE; // try it again
|
||||
} else {
|
||||
okay = FALSE; // try an other instance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (okay == TRUE) {
|
||||
fFound = TRUE;
|
||||
strcpy(p_pAppRequest->pszName,pApp->pszName);
|
||||
p_pAppRequest->iInstance = pAppInstance->iInstance;
|
||||
p_pAppRequest->pszHost = pAppInstance->pszHostName;
|
||||
p_pAppRequest->iPort = pAppInstance->iPort;
|
||||
p_pAppRequest->eType = EAppType_LoadBalanced;
|
||||
p_pAppRequest->pAppInstance = pAppInstance;
|
||||
pAppInstance->uOpenedRequestsNb++;
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -122,7 +141,7 @@ BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BOOL GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,void* p_pLogServerData)
|
||||
BOOL GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,void* p_pLogServerData, GSWURLComponents* p_pURLComponents)
|
||||
{
|
||||
BOOL fFound=FALSE;
|
||||
GSWApp* pApp=NULL;
|
||||
|
@ -142,14 +161,33 @@ BOOL GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,void* p_pLogServ
|
|||
GSWLog(GSW_DEBUG,p_pLogServerData,"Instance Found");
|
||||
if (pAppInstance->fValid)
|
||||
{
|
||||
fFound=TRUE;
|
||||
p_pAppRequest->iInstance = pAppInstance->iInstance;
|
||||
p_pAppRequest->pszHost = pAppInstance->pszHostName;
|
||||
p_pAppRequest->iPort = pAppInstance->iPort;
|
||||
p_pAppRequest->eType = EAppType_LoadBalanced;
|
||||
p_pAppRequest->pAppInstance = pAppInstance;
|
||||
pAppInstance->uOpenedRequestsNb++;
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Instance is valid");
|
||||
BOOL okay = TRUE;
|
||||
// check if refused, time to try again ?
|
||||
if (p_pURLComponents->stRequestHandlerKey.iLength==0 || p_pURLComponents->stRequestHandlerKey.pszStart==NULL) {
|
||||
GSWAppInfo *thisAppInfo = GSWAppInfo_Find(p_pAppRequest->pszName, pAppInstance->iInstance);
|
||||
if (thisAppInfo && thisAppInfo->isRefused) {
|
||||
time_t actTime = (time_t)0;
|
||||
// this instance refuses new sessions
|
||||
time(&actTime);
|
||||
if (actTime > thisAppInfo->timeNextRetryTime) {
|
||||
thisAppInfo->isRefused = FALSE; // try it again
|
||||
} else {
|
||||
okay = FALSE; // try an other instance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (okay == TRUE) {
|
||||
|
||||
fFound=TRUE;
|
||||
p_pAppRequest->iInstance = pAppInstance->iInstance;
|
||||
p_pAppRequest->pszHost = pAppInstance->pszHostName;
|
||||
p_pAppRequest->iPort = pAppInstance->iPort;
|
||||
p_pAppRequest->eType = EAppType_LoadBalanced;
|
||||
p_pAppRequest->pAppInstance = pAppInstance;
|
||||
pAppInstance->uOpenedRequestsNb++;
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Instance is valid");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#ifndef _GSWLoadBalancing_h__
|
||||
#define _GSWLoadBalancing_h__
|
||||
|
||||
BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,void* p_pLogServerData);
|
||||
BOOL GSWLoadBalancing_FindInstance(GSWAppRequest* p_pAppRequest,void* p_pLogServerData);
|
||||
BOOL GSWLoadBalancing_FindApp(GSWAppRequest* p_pAppRequest,void* p_pLogServerData, GSWURLComponents* p_pURLComponents);
|
||||
BOOL GSWLoadBalancing_FindInstance(GSWAppRequest* p_pAppRequest,void* p_pLogServerData, GSWURLComponents* p_pURLComponents);
|
||||
void GSWLoadBalancing_MarkNotRespondingApp(GSWAppRequest* p_pAppRequest,void* p_pLogServerData);
|
||||
void GSWLoadBalancing_StartAppRequest(GSWAppRequest* p_pAppRequest,void* p_pLogServerData);
|
||||
void GSWLoadBalancing_StopAppRequest(GSWAppRequest* p_pAppRequest,void* p_pLogServerData);
|
||||
|
|
|
@ -182,7 +182,7 @@ MovingAvgTransactionTime: GSWString
|
|||
value = transactions."Moving Avg. Transaction Time";
|
||||
}
|
||||
|
||||
PASSGSWRD: GSWPasswordField
|
||||
PASSWORD: GSWPasswordField
|
||||
{
|
||||
WIDTH = 12;
|
||||
value = password;
|
||||
|
|
|
@ -1,288 +1,272 @@
|
|||
<html>
|
||||
<head><title></title>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body BGcolor="#FFFFFF">
|
||||
|
||||
<gsweb name="REFUSED">
|
||||
<center>
|
||||
<h2><font color="#FF0000">This Request Requires A User Login</font></h2>
|
||||
<br>
|
||||
<!-- ****
|
||||
<gsweb name="Form1">
|
||||
<table border="1" cellPadding="2" cellSpacing="0" bgcolor="#f6ffff">
|
||||
<table border="0" width="80%">
|
||||
<TR align="CENTER">
|
||||
<td>
|
||||
User
|
||||
</td>
|
||||
<td>
|
||||
<gsweb name="USERNAME"></gsweb>
|
||||
</td>
|
||||
</tr>
|
||||
<TR align="CENTER">
|
||||
<td>
|
||||
Password
|
||||
</td>
|
||||
<td>
|
||||
<gsweb name="PASSWORD"></gsweb>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<gsweb name="SUBMIT"></gsweb>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br>
|
||||
</gsweb>
|
||||
********** -->
|
||||
</center>
|
||||
</gsweb><gsweb name="ALLOWED">
|
||||
|
||||
<gsweb name="Form4"><table border="0" width="100%">
|
||||
<tr>
|
||||
<td align="CENTER" COLSPAN="2">
|
||||
<h2>Statistics For <font color="#FF0000">
|
||||
<gsweb name="String2"></gsweb>
|
||||
<gsweb name="Conditional2">
|
||||
#<font color="#FF0000">
|
||||
<gsweb name="String6"></gsweb>
|
||||
</font>
|
||||
</gsweb>
|
||||
</font>On Host <font color="#FF0000">
|
||||
<gsweb name="String11"></gsweb>
|
||||
</font>
|
||||
</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="CENTER">
|
||||
<gsweb name="REFRESH"></gsweb>
|
||||
</td>
|
||||
</tr>
|
||||
</table></gsweb><hr>
|
||||
|
||||
<br>
|
||||
|
||||
<center>
|
||||
<table border="2" CELLPADDING="4" CELLSPACING="2" bgcolor="#d0d0d0">
|
||||
<TR align="CENTER" bgcolor="#b0b0b0">
|
||||
<TD COLSPAN="6"><font SIZE="+1"><b>Application Statistics</b></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>   </td>
|
||||
<td align="CENTER"><font SIZE="-1">Transactions</font></td>
|
||||
<td align="CENTER"><font SIZE="-1">Average Transaction<br>Time</font></td>
|
||||
<td align="CENTER"><font SIZE="-1">Average Idle<br>Time</font></td>
|
||||
<td align="CENTER"><font SIZE="-1">Moving Average*<br>Transaction Time</font></td>
|
||||
<td align="CENTER"><font SIZE="-1">Moving Average*<br>Idle Time</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Overall</td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="Transactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="AvgTransactionTime"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="AvgIdleTime"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="MovingAvgTransactionTime"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="MovingAvgIdleTime"></gsweb></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Component Actions</td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="ComponentActionTransactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="AvgComponentActionTransactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font size="-1">NA</font></td>
|
||||
<td align="CENTER">   </td>
|
||||
<td align="CENTER"><font size="-1">NA</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Direct Actions</td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="DirectActionTransactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="AvgDirectActionTransactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font size="-1">NA</font></td>
|
||||
<td align="CENTER">   </td>
|
||||
<td align="CENTER"><font size="-1">NA</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Started at</td>
|
||||
<TD COLSPAN="5">
|
||||
<font color="#0000FF"><gsweb name="String21"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Running time</td>
|
||||
<TD COLSPAN="5">
|
||||
<font color="#0000FF"><gsweb name="RunningTime"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<font SIZE="-1">
|
||||
* The sample size for Moving Averages is <font color="#0000FF"><gsweb name="MovingAvgSampleSize"></gsweb></font> transactions.
|
||||
</font>
|
||||
</center>
|
||||
|
||||
<hr>
|
||||
<center>
|
||||
<table border="2" CELLPADDING="4" CELLSPACING="2" bgcolor="#d0d0d0">
|
||||
<TR align="CENTER" bgcolor="#b0b0b0">
|
||||
<TD COLSPAN="2"><font SIZE="+1"><b>Sessions Statistics</b></font></td>
|
||||
</tr>
|
||||
<gsweb name="SessionsRepetition">
|
||||
<tr>
|
||||
<td>
|
||||
<gsweb name="SessionsKeyCell"></gsweb>
|
||||
</td>
|
||||
<td>
|
||||
<font color="#0000FF"><gsweb name="SessionsValueCell"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
<gsweb name="ISMAXSESSIONS">
|
||||
<tr>
|
||||
<TD COLSPAN="2">Peak Concurrent Sessions at<br><font color="#0000FF"><gsweb name="MaxSessions"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</center>
|
||||
<br>
|
||||
<center>
|
||||
<table border=0 width="100%"> <!-- spacer table - invisible -->
|
||||
<tr><td align="CENTER">
|
||||
<table border="2" CELLPADDING="4" CELLSPACING="2" bgcolor="#d0d0d0">
|
||||
<TR align="CENTER" bgcolor="#b0b0b0">
|
||||
<TD COLSPAN="2"><b>Memory Usage (bytes)</b>
|
||||
</td>
|
||||
</tr>
|
||||
<gsweb name="MemoryRepetition">
|
||||
<tr>
|
||||
<td>
|
||||
<gsweb name="MemoryKeyCell"></gsweb>
|
||||
</td>
|
||||
<td align="RIGHT">
|
||||
<font color="#0000FF"><gsweb name="MemoryValueCell"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</td><td align="CENTER">
|
||||
<table border="2" CELLPADDING="4" CELLSPACING="2" bgcolor="#d0d0d0">
|
||||
<TR align="CENTER" bgcolor="#b0b0b0">
|
||||
<TD COLSPAN="2"><b>Avg. Memory Usage Per Session (bytes)</b>
|
||||
</td>
|
||||
</tr>
|
||||
<gsweb name="SessionMemoryRepetition">
|
||||
<tr>
|
||||
<td>
|
||||
<gsweb name="SessionMemoryKeyCell">
|
||||
</gsweb>
|
||||
</td>
|
||||
<td align="RIGHT">
|
||||
<font color="#0000FF"><gsweb name="SessionMemoryValueCell"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</td></tr></table>
|
||||
</center>
|
||||
|
||||
<br>
|
||||
|
||||
<gsweb name="ISLASTUSER">
|
||||
Response Descriptions For Last User :
|
||||
<br>
|
||||
<center>
|
||||
<table border="2" cellpadding="4" cellspacing="2" bgcolor="#d0d0d0" width="80%">
|
||||
<gsweb name="SessionStatsRepetition">
|
||||
<tr>
|
||||
<td>
|
||||
<font color="#0000FF"><gsweb name="SessionStatsField"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</center>
|
||||
</gsweb><hr>
|
||||
|
||||
<center>
|
||||
<table border="2" cellpadding="4" cellspacing="2" width="80%" bgcolor="#d0d0d0">
|
||||
<tr><TD COLSPAN="5" align="CENTER" BGcolor="#b0b0b0">
|
||||
<font SIZE="+1"><b> Component Action Statistics </b></font>
|
||||
</td></tr>
|
||||
<TR align="CENTER" bgcolor="#d6d8df">
|
||||
<TD WIDTH = "20%">Name</td>
|
||||
<TD WIDTH = "50%">Served</td>
|
||||
<TD WIDTH = "10%">Min</td>
|
||||
<TD WIDTH = "10%">Avg</td>
|
||||
<TD WIDTH = "10%">Max</td>
|
||||
</tr>
|
||||
<gsweb name="PagesRepetition">
|
||||
<tr>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="PageName"></gsweb></font></td>
|
||||
<td align=left><gsweb name="PageCountBar"></gsweb></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="PageMin"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><b><gsweb name="PageAvg"></gsweb></b></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="PageMax"></gsweb></font></td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<hr>
|
||||
|
||||
<center>
|
||||
<table border="2" cellpadding="4" cellspacing="2" width="80%" bgcolor="#d0d0d0">
|
||||
<tr><TD COLSPAN="5" align="CENTER" BGcolor="#b0b0b0">
|
||||
<font SIZE="+1"><b> Direct Action Statistics </b></font>
|
||||
</td></tr>
|
||||
<TR align="CENTER" bgcolor="#d6d8df">
|
||||
<TD width="20%">Name</td>
|
||||
<TD width="50%">Served</td>
|
||||
<TD width="10%">Min</td>
|
||||
<TD width="10%">Avg</td>
|
||||
<TD width="10%">Max</td>
|
||||
</tr>
|
||||
<gsweb name="ActionsRepetition">
|
||||
<tr>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="ActionName"></gsweb></font></td>
|
||||
<td align=left><gsweb name="ActionBar"></gsweb></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="ActionMin"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><b><gsweb name="ActionAvg"></gsweb></b></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="ActionMax"></gsweb></font></td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<hr>
|
||||
|
||||
<center>
|
||||
<table border="2" cellPadding="4" cellspacing="2" width="80%" bgcolor="#d0d0d0">
|
||||
<tr><TD COLSPAN="3" align="CENTER" BGcolor="#b0b0b0">
|
||||
<font SIZE="+1"><b>Detailed Statistics</b></font>
|
||||
</td></tr>
|
||||
<TR align="CENTER" bgcolor="#d6d8df">
|
||||
<TD width="40%">Response Description</td>
|
||||
<TD width="50%">Percent Of Total</td>
|
||||
<TD width="10%">Served</td>
|
||||
</tr>
|
||||
<gsweb name="DetailsRepetition">
|
||||
<tr>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="DetailName"></gsweb></font></td>
|
||||
<td align=left><gsweb name="BAR_DETAILS"></gsweb></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="DetailCount"></gsweb></font></td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
<br>
|
||||
<gsweb name="ISLOGPATH">
|
||||
<hr>
|
||||
<br>
|
||||
Statistics Details Saved In Common Log Format In File <font color="#0000FF"><gsweb name="LOGPATH"></gsweb></font></gsweb>
|
||||
|
||||
<hr>
|
||||
<br>
|
||||
<A HREF="http://www.gnustepweb.org"><gsweb name="PoweredByImage"></gsweb></A>
|
||||
</center>
|
||||
</gsweb>
|
||||
</body>
|
||||
</html>
|
||||
<gsweb name="REFUSED">
|
||||
<center>
|
||||
<h2><font color="#FF0000">This Request Requires A User Login</font></h2>
|
||||
<br>
|
||||
<!-- **** -->
|
||||
<gsweb name="Form1">
|
||||
<table border="1" cellPadding="2" cellSpacing="0" bgcolor="#f6ffff">
|
||||
<table border="0" width="80%">
|
||||
<TR align="CENTER">
|
||||
<td>
|
||||
User
|
||||
</td>
|
||||
<td>
|
||||
<gsweb name="USERNAME"></gsweb>
|
||||
</td>
|
||||
</tr>
|
||||
<TR align="CENTER">
|
||||
<td>
|
||||
Password
|
||||
</td>
|
||||
<td>
|
||||
<gsweb name="PASSWORD"></gsweb>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<gsweb name="SUBMIT"></gsweb>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br>
|
||||
</gsweb>
|
||||
<!-- ********** -->
|
||||
</center>
|
||||
</gsweb><gsweb name="ALLOWED">
|
||||
<gsweb name="Form4"><table border="0" width="100%">
|
||||
<tr>
|
||||
<td align="CENTER" COLSPAN="2">
|
||||
<h2>Statistics For <font color="#FF0000">
|
||||
<gsweb name="String2"></gsweb>
|
||||
<gsweb name="Conditional2">
|
||||
#<font color="#FF0000">
|
||||
<gsweb name="String6"></gsweb> </font>
|
||||
</gsweb> </font>On Host <font color="#FF0000">
|
||||
<gsweb name="String11"></gsweb> </font>
|
||||
</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="CENTER">
|
||||
<gsweb name="REFRESH"></gsweb>
|
||||
</td>
|
||||
</tr> </table></gsweb>
|
||||
<hr>
|
||||
<br>
|
||||
<center>
|
||||
<table border="2" CELLPADDING="4" CELLSPACING="2" bgcolor="#d0d0d0">
|
||||
<TR align="CENTER" bgcolor="#b0b0b0">
|
||||
<TD COLSPAN="6"><font SIZE="+1"><b>Application Statistics</b></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
 
|
||||
</td>
|
||||
<td align="CENTER"><font SIZE="-1">Transactions</font></td>
|
||||
<td align="CENTER"><font SIZE="-1">Average Transaction<br>
|
||||
Time</font></td>
|
||||
<td align="CENTER"><font SIZE="-1">Average Idle<br>
|
||||
Time</font></td>
|
||||
<td align="CENTER"><font SIZE="-1">Moving Average*<br>
|
||||
Transaction Time</font></td>
|
||||
<td align="CENTER"><font SIZE="-1">Moving Average*<br>
|
||||
Idle Time</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Overall</td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="Transactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="AvgTransactionTime"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="AvgIdleTime"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="MovingAvgTransactionTime"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="MovingAvgIdleTime"></gsweb></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Component Actions</td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="ComponentActionTransactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="AvgComponentActionTransactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font size="-1">NA</font></td>
|
||||
<td align="CENTER">
|
||||
 
|
||||
</td>
|
||||
<td align="CENTER"><font size="-1">NA</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Direct Actions</td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="DirectActionTransactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="AvgDirectActionTransactions"></gsweb></font></td>
|
||||
<td align="CENTER"><font size="-1">NA</font></td>
|
||||
<td align="CENTER">
|
||||
 
|
||||
</td>
|
||||
<td align="CENTER"><font size="-1">NA</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Started at</td>
|
||||
<TD COLSPAN="5">
|
||||
<font color="#0000FF"><gsweb name="String21"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Running time</td>
|
||||
<TD COLSPAN="5">
|
||||
<font color="#0000FF"><gsweb name="RunningTime"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<font SIZE="-1"> * The sample size for Moving Averages is <font color="#0000FF"><gsweb name="MovingAvgSampleSize"></gsweb></font> transactions. </font>
|
||||
</center>
|
||||
<hr>
|
||||
<center>
|
||||
<table border="2" CELLPADDING="4" CELLSPACING="2" bgcolor="#d0d0d0">
|
||||
<TR align="CENTER" bgcolor="#b0b0b0">
|
||||
<TD COLSPAN="2"><font SIZE="+1"><b>Sessions Statistics</b></font></td>
|
||||
</tr>
|
||||
<gsweb name="SessionsRepetition">
|
||||
<tr>
|
||||
<td>
|
||||
<gsweb name="SessionsKeyCell"></gsweb>
|
||||
</td>
|
||||
<td>
|
||||
<font color="#0000FF"><gsweb name="SessionsValueCell"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
<gsweb name="ISMAXSESSIONS">
|
||||
<tr>
|
||||
<TD COLSPAN="2">Peak Concurrent Sessions at<br>
|
||||
<font color="#0000FF"><gsweb name="MaxSessions"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</center>
|
||||
<br>
|
||||
<center>
|
||||
<table border=0 width="100%">
|
||||
<!-- spacer table - invisible -->
|
||||
<tr><td align="CENTER">
|
||||
<table border="2" CELLPADDING="4" CELLSPACING="2" bgcolor="#d0d0d0">
|
||||
<TR align="CENTER" bgcolor="#b0b0b0">
|
||||
<TD COLSPAN="2"><b>Memory Usage (bytes)</b>
|
||||
</td>
|
||||
</tr>
|
||||
<gsweb name="MemoryRepetition">
|
||||
<tr>
|
||||
<td>
|
||||
<gsweb name="MemoryKeyCell"></gsweb>
|
||||
</td>
|
||||
<td align="RIGHT">
|
||||
<font color="#0000FF"><gsweb name="MemoryValueCell"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table> </td><td align="CENTER">
|
||||
<table border="2" CELLPADDING="4" CELLSPACING="2" bgcolor="#d0d0d0">
|
||||
<TR align="CENTER" bgcolor="#b0b0b0">
|
||||
<TD COLSPAN="2"><b>Avg. Memory Usage Per Session (bytes)</b>
|
||||
</td>
|
||||
</tr>
|
||||
<gsweb name="SessionMemoryRepetition">
|
||||
<tr>
|
||||
<td>
|
||||
<gsweb name="SessionMemoryKeyCell">
|
||||
</gsweb>
|
||||
</td>
|
||||
<td align="RIGHT">
|
||||
<font color="#0000FF"><gsweb name="SessionMemoryValueCell"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table> </td></tr></table>
|
||||
</center>
|
||||
<br>
|
||||
<gsweb name="ISLASTUSER">
|
||||
Response Descriptions For Last User : <br>
|
||||
<center>
|
||||
<table border="2" cellpadding="4" cellspacing="2" bgcolor="#d0d0d0" width="80%">
|
||||
<gsweb name="SessionStatsRepetition">
|
||||
<tr>
|
||||
<td>
|
||||
<font color="#0000FF"><gsweb name="SessionStatsField"></gsweb></font>
|
||||
</td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</center>
|
||||
</gsweb>
|
||||
<hr>
|
||||
<center>
|
||||
<table border="2" cellpadding="4" cellspacing="2" width="80%" bgcolor="#d0d0d0">
|
||||
<tr><TD COLSPAN="5" align="CENTER" BGcolor="#b0b0b0"> <font SIZE="+1"><b> Component Action Statistics </b></font> </td></tr>
|
||||
<TR align="CENTER" bgcolor="#d6d8df">
|
||||
<TD WIDTH = "20%">Name</td>
|
||||
<TD WIDTH = "50%">Served</td>
|
||||
<TD WIDTH = "10%">Min</td>
|
||||
<TD WIDTH = "10%">Avg</td>
|
||||
<TD WIDTH = "10%">Max</td>
|
||||
</tr>
|
||||
<gsweb name="PagesRepetition">
|
||||
<tr>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="PageName"></gsweb></font></td>
|
||||
<td align=left><gsweb name="PageCountBar"></gsweb></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="PageMin"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><b><gsweb name="PageAvg"></gsweb></b></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="PageMax"></gsweb></font></td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</center>
|
||||
<hr>
|
||||
<center>
|
||||
<table border="2" cellpadding="4" cellspacing="2" width="80%" bgcolor="#d0d0d0">
|
||||
<tr><TD COLSPAN="5" align="CENTER" BGcolor="#b0b0b0"> <font SIZE="+1"><b> Direct Action Statistics </b></font> </td></tr>
|
||||
<TR align="CENTER" bgcolor="#d6d8df">
|
||||
<TD width="20%">Name</td>
|
||||
<TD width="50%">Served</td>
|
||||
<TD width="10%">Min</td>
|
||||
<TD width="10%">Avg</td>
|
||||
<TD width="10%">Max</td>
|
||||
</tr>
|
||||
<gsweb name="ActionsRepetition">
|
||||
<tr>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="ActionName"></gsweb></font></td>
|
||||
<td align=left><gsweb name="ActionBar"></gsweb></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="ActionMin"></gsweb></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><b><gsweb name="ActionAvg"></gsweb></b></font></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="ActionMax"></gsweb></font></td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
</center>
|
||||
<hr>
|
||||
<center>
|
||||
<table border="2" cellPadding="4" cellspacing="2" width="80%" bgcolor="#d0d0d0">
|
||||
<tr><TD COLSPAN="3" align="CENTER" BGcolor="#b0b0b0"> <font SIZE="+1"><b>Detailed Statistics</b></font> </td></tr>
|
||||
<TR align="CENTER" bgcolor="#d6d8df">
|
||||
<TD width="40%">Response Description</td>
|
||||
<TD width="50%">Percent Of Total</td>
|
||||
<TD width="10%">Served</td>
|
||||
</tr>
|
||||
<gsweb name="DetailsRepetition">
|
||||
<tr>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="DetailName"></gsweb></font></td>
|
||||
<td align=left><gsweb name="BAR_DETAILS"></gsweb></td>
|
||||
<td align="CENTER"><font color="#0000FF"><gsweb name="DetailCount"></gsweb></font></td>
|
||||
</tr>
|
||||
</gsweb>
|
||||
</table>
|
||||
<br>
|
||||
<gsweb name="ISLOGPATH">
|
||||
<hr>
|
||||
<br>
|
||||
Statistics Details Saved In Common Log Format In File <font color="#0000FF"><gsweb name="LOGPATH"></gsweb></font></gsweb>
|
||||
<hr>
|
||||
<br>
|
||||
<A HREF="http://www.gnustepweb.org"><gsweb name="PoweredByImage"></gsweb></A>
|
||||
</center> </gsweb>
|
||||
</body> </html>
|
|
@ -30,7 +30,8 @@
|
|||
GSWStatisticsStore* _statisticsStore = [[self application] statisticsStore];
|
||||
if (_statisticsStore)
|
||||
{
|
||||
[_statisticsStore validateLogin:password];
|
||||
//[_statisticsStore validateLogin:password];
|
||||
[[self session] _allowToViewStatistics];
|
||||
};
|
||||
return self;
|
||||
};
|
||||
|
@ -40,6 +41,50 @@
|
|||
return [[NSHost currentHost] name];
|
||||
}
|
||||
|
||||
- (void) awake
|
||||
{
|
||||
/*
|
||||
NSString* tmpKey;
|
||||
NSString* tmpItem;
|
||||
|
||||
NSDictionary* detailsDict;
|
||||
NSDictionary* pagesDict;
|
||||
NSDictionary* directActionsDict;
|
||||
NSDictionary* sessionMemoryDict;
|
||||
NSDictionary* transactions;
|
||||
NSDictionary* statsDict;
|
||||
NSDictionary* memoryDict;
|
||||
NSArray* sessionStats;
|
||||
NSMutableDictionary* sessionsDict;
|
||||
NSNumber* maxPageCount;
|
||||
NSNumber* maxActionCount;
|
||||
NSDate* maxSessionsDate;
|
||||
NSString* userName;
|
||||
NSString* password;
|
||||
|
||||
*/
|
||||
NSLog(@"detailsDict");
|
||||
NSLog([detailsDict description]);
|
||||
NSLog(@"pagesDict");
|
||||
NSLog([pagesDict description]);
|
||||
NSLog(@"directActionsDict");
|
||||
NSLog([directActionsDict description]);
|
||||
NSLog(@"sessionMemoryDict");
|
||||
NSLog([sessionMemoryDict description]);
|
||||
|
||||
NSLog(@"transactions");
|
||||
/*NSLog(transactions);
|
||||
NSLog(@"statsDict");
|
||||
NSLog(statsDict);
|
||||
NSLog(@"memoryDict");
|
||||
NSLog(memoryDict);
|
||||
NSLog(@"sessionStats");
|
||||
NSLog(sessionStats);
|
||||
NSLog(@"sessionsDict");
|
||||
NSLog(sessionsDict);
|
||||
*/
|
||||
}
|
||||
|
||||
-(id)instance
|
||||
{
|
||||
id _instance=nil;
|
||||
|
|
|
@ -75,6 +75,7 @@ extern BOOL WOStrictFlag;
|
|||
BOOL terminating;
|
||||
BOOL dynamicLoadingEnabled;
|
||||
BOOL printsHTMLParserDiagnostics;
|
||||
BOOL refusingNewSessions;
|
||||
BOOL shouldDieWhenRefusing;
|
||||
BOOL refusingNewClients;
|
||||
BOOL refuseThisRequest;
|
||||
|
|
|
@ -467,6 +467,8 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
permanentPageCacheSize=30;
|
||||
pageRecreationEnabled=YES;
|
||||
pageRefreshOnBacktrackEnabled=YES;
|
||||
refusingNewSessions = NO;
|
||||
minimumActiveSessionsCount = 0; // 0 is default
|
||||
dynamicLoadingEnabled=YES;
|
||||
printsHTMLParserDiagnostics=YES;
|
||||
[[self class] _setApplication:self];
|
||||
|
@ -511,6 +513,7 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
name:GSWNotification__SessionDidTimeOutNotification[GSWebNamingConv]
|
||||
object:nil];
|
||||
NSDebugMLLog0(@"low",@"init: addObserver called");
|
||||
|
||||
LOGObjectFnStop();
|
||||
return self;
|
||||
};
|
||||
|
@ -901,6 +904,8 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
forKey:_resourceRequestHandlerKey];
|
||||
[self registerRequestHandler:_directActionRequestHandler
|
||||
forKey:_directActionRequestHandlerKey];
|
||||
[self registerRequestHandler:_directActionRequestHandler
|
||||
forKey: GSWDirectActionRequestHandlerKey[GSWebNamingConvInversed]];
|
||||
NSDebugMLLog(@"low",@"requestHandlers:%@",requestHandlers);
|
||||
[self setDefaultRequestHandler:_componentRequestHandler];
|
||||
LOGObjectFnStop();
|
||||
|
@ -1307,10 +1312,12 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
NS_DURING
|
||||
{
|
||||
[self lockedDecrementActiveSessionCount];
|
||||
/*
|
||||
if ([self isRefusingNewSessions])
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
*/
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
@ -1358,20 +1365,22 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
[self lock];
|
||||
NS_DURING
|
||||
{
|
||||
/*
|
||||
if ([self isRefusingNewSessions])
|
||||
{
|
||||
//TODO erreur ?
|
||||
NSDebugMLLog0(@"low",@"isRefusingNewSessions!");
|
||||
}
|
||||
else
|
||||
{
|
||||
*/
|
||||
// {
|
||||
[self lockedIncrementActiveSessionCount];
|
||||
_session=[self createSessionForRequest:[context_ request]];
|
||||
NSDebugMLLog(@"sessions",@"_session:%@",_session);
|
||||
NSDebugMLLog(@"sessions",@"_session ID:%@",[_session sessionID]);
|
||||
[context_ _setSession:_session];
|
||||
[_session awakeInContext:context_];
|
||||
};
|
||||
// };
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
@ -2302,6 +2311,61 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
|
||||
//====================================================================
|
||||
@implementation GSWApplication (GSWRequestHandling)
|
||||
|
||||
-(GSWResponse*)checkAppIfRefused:(GSWRequest*)request_
|
||||
{
|
||||
NSDictionary* _requestHandlerValues=nil;
|
||||
GSWResponse* _response=nil;
|
||||
NSString* _sessionID=nil;
|
||||
BOOL _refuseRequest = NO;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
NSLog(@"Application : checkAppIfRefused");
|
||||
NSLog(@"Application : allSessionIDs = %@", [sessionStore allSessionIDs]);
|
||||
_requestHandlerValues=[GSWComponentRequestHandler _requestHandlerValuesForRequest:request_];
|
||||
if (_requestHandlerValues) {
|
||||
NSLog(@"Application : _requestHandlerValues is set");
|
||||
|
||||
_sessionID=[_requestHandlerValues objectForKey:GSWKey_SessionID[GSWebNamingConv]];
|
||||
if (!_sessionID) {
|
||||
NSLog(@"Application : _sessionID is nil");
|
||||
|
||||
if ([self isRefusingNewSessions] == YES) {
|
||||
_refuseRequest = YES;
|
||||
}
|
||||
} else {
|
||||
NSLog(@"Application : _sessionID found : %@", _sessionID);
|
||||
NSLog(@"Application : allSessionIDs = %@", [sessionStore allSessionIDs]);
|
||||
// check for existing session ID
|
||||
if ([sessionStore containsSessionID:_sessionID] == NO) {
|
||||
NSLog(@"Application : sessionStore does not contain _sessionID");
|
||||
if ([self isRefusingNewSessions] == YES) {
|
||||
_refuseRequest = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_refuseRequest == YES) {
|
||||
NSLog(@"Application : _refuseRequest == YES ,generate Response");
|
||||
// generate response, to refuse the request
|
||||
_response=[GSWResponse generateRefusingResponseInContext:nil forRequest:request_];
|
||||
if (_response) {
|
||||
[_response _finalizeInContext:nil]; //DO Call _finalizeInContext: !
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
|
||||
NS_ENDHANDLER;
|
||||
|
||||
LOGObjectFnStop();
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
-(GSWResponse*)dispatchRequest:(GSWRequest*)request_
|
||||
{
|
||||
//OK
|
||||
|
@ -2313,29 +2377,34 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
GSWApplicationDebugSetChange();
|
||||
[self unlock];
|
||||
#endif
|
||||
NSDebugMLLog(@"requests",@"request_=%@",request_);
|
||||
_requestHandler=[self handlerForRequest:request_];
|
||||
NSDebugMLLog(@"requests",@"_requestHandler=%@",_requestHandler);
|
||||
if (!_requestHandler)
|
||||
_requestHandler=[self defaultRequestHandler];
|
||||
NSDebugMLLog(@"requests",@"_requestHandler=%@",_requestHandler);
|
||||
if (!_requestHandler)
|
||||
{
|
||||
NSDebugMLLog0(@"low",@"GSWApplication dispatchRequest: no request handler");
|
||||
//TODO error
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore);
|
||||
_response=[_requestHandler handleRequest:request_];
|
||||
NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore);
|
||||
[self _resetCache];
|
||||
NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore);
|
||||
};
|
||||
if (!_response)
|
||||
{
|
||||
//TODO RESPONSE_PB
|
||||
};
|
||||
|
||||
_response = [self checkAppIfRefused:request_];
|
||||
if (_response == nil) {
|
||||
|
||||
NSDebugMLLog(@"requests",@"request_=%@",request_);
|
||||
_requestHandler=[self handlerForRequest:request_];
|
||||
NSDebugMLLog(@"requests",@"_requestHandler=%@",_requestHandler);
|
||||
if (!_requestHandler)
|
||||
_requestHandler=[self defaultRequestHandler];
|
||||
NSDebugMLLog(@"requests",@"_requestHandler=%@",_requestHandler);
|
||||
if (!_requestHandler)
|
||||
{
|
||||
NSDebugMLLog0(@"low",@"GSWApplication dispatchRequest: no request handler");
|
||||
//TODO error
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore);
|
||||
_response=[_requestHandler handleRequest:request_];
|
||||
NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore);
|
||||
[self _resetCache];
|
||||
NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore);
|
||||
};
|
||||
if (!_response)
|
||||
{
|
||||
//TODO RESPONSE_PB
|
||||
}
|
||||
}
|
||||
LOGObjectFnStop();
|
||||
return _response;
|
||||
};
|
||||
|
@ -3287,7 +3356,8 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
//TODO return (Vv12@0:4i8)
|
||||
-(void)setMinimumActiveSessionsCount:(int)count_
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
//LOGObjectFnNotImplemented(); //TODOFN
|
||||
minimumActiveSessionsCount = count_;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -3301,8 +3371,8 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
//isRefusingNewSessions
|
||||
-(BOOL)isRefusingNewSessions
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return NO;
|
||||
//LOGObjectFnNotImplemented(); //TODOFN
|
||||
return refusingNewSessions;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -3310,7 +3380,8 @@ int GSWApplicationMain(NSString* applicationClassName,
|
|||
//TODO return: (Vv9@0:4c8)
|
||||
-(void)refuseNewSessions:(BOOL)flag
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
refusingNewSessions = flag;
|
||||
//LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -25,6 +25,7 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
#include <GSWeb/GSWeb.h>
|
||||
#include <math.h>
|
||||
#include <values.h>
|
||||
|
||||
static NSDictionary* localMinMaxDictionary=nil;
|
||||
static NSMutableDictionary* associationsHandlerClasses=nil;
|
||||
|
@ -610,6 +611,9 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
|
|||
{
|
||||
_part=[keys objectAtIndex:0];
|
||||
[keys removeObjectAtIndex:0];
|
||||
if (retValue) {
|
||||
NSDebugMLLog(@"associations",@"object_get_class_name(retValue object)=%s", object_get_class_name(retValue));
|
||||
}
|
||||
NSDebugMLLog(@"associations",@"_part=%@",_part);
|
||||
_handlerClass=[associationsHandlerClasses objectForKey:_part];
|
||||
NSDebugMLLog(@"associations",@"_handlerClass=%@",_handlerClass);
|
||||
|
@ -651,8 +655,49 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
BOOL skipping = NO;
|
||||
NS_DURING
|
||||
retValue=[retValue getIVarNamed:_part];
|
||||
/*
|
||||
//NSLog(@"#getIVarNamed");
|
||||
if (retValue) {
|
||||
//NSLog(@"class retValue before getIVarNamed : %s", object_get_class_name(retValue));
|
||||
//NSLog(@"description retValue : %@", [retValue description]);
|
||||
}
|
||||
|
||||
if ((retValue) && (strstr(object_get_class_name(retValue),"GSMutableArray") != NULL)) {
|
||||
|
||||
int counter;
|
||||
if ([_part isEqual:@"count"]) {
|
||||
SEL sel=0;
|
||||
NSMethodSignature *sig ;
|
||||
|
||||
NSLog(@"### retValue class is GSMutableArray (%@)", NSStringFromClass([retValue class]));
|
||||
sel = NSSelectorFromString(_part);
|
||||
NSLog(@"### selector = %d", (int)sel);
|
||||
NSLog(@"### %@", NSStringFromSelector(sel));
|
||||
if ([retValue respondsToSelector: sel] == NO) {
|
||||
NSLog(@"### GSMutableArray does not respond to '%@'", _part);
|
||||
} else {
|
||||
NSLog(@"### GSMutableArray responds to '%@'", _part);
|
||||
}
|
||||
sig = [retValue methodSignatureForSelector: sel];
|
||||
NSLog(@"### [sig numberOfArguments] = %d", [sig numberOfArguments]);
|
||||
|
||||
counter = [retValue count];
|
||||
NSLog(@"### count = %d", counter);
|
||||
skipping = YES;
|
||||
//retValue = [NSNumber numberWithInt:counter];
|
||||
}
|
||||
}
|
||||
|
||||
//if (!skipping)
|
||||
*/
|
||||
retValue=[retValue getIVarNamed:_part];
|
||||
/*
|
||||
if (retValue) {
|
||||
NSLog(@"class retValue after getIVarNamed : %s", object_get_class_name(retValue));
|
||||
}
|
||||
*/
|
||||
NS_HANDLER
|
||||
NSLog(@"Attempt to get %@/%@ raised an exception (%@)",[retValue class],_part,localException);
|
||||
localException = [localException exceptionByAddingToUserInfoKey:@"Invalid Ivars/Methods" format:@"-[%@ %@]",[retValue class],_part];
|
||||
|
@ -663,7 +708,11 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
|
|||
retValue=nil;
|
||||
};
|
||||
};
|
||||
if (retValue) {
|
||||
NSDebugMLLog(@"associations",@"retValue=%@",retValue);
|
||||
} else {
|
||||
NSLog(@"retValue=nil");
|
||||
}
|
||||
LOGClassFnStop();
|
||||
return retValue;
|
||||
};
|
||||
|
@ -677,6 +726,7 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
|
|||
NSDebugMLLog(@"associations",@"GSWAssociation: setValue:%@",value_);
|
||||
NSDebugMLLog(@"associations",@"value_ class:%@",[value_ class]);
|
||||
NSDebugMLLog(@"associations",@"value_ String class:%@",NSStringFromClass([value_ class]));
|
||||
NSDebugMLLog(@"associations",@"object_ String class:%@",NSStringFromClass([object_ class]));
|
||||
if (keyPath_)
|
||||
{
|
||||
NSMutableArray* keys=[[keyPath_ componentsSeparatedByString:@"."] mutableCopy];
|
||||
|
@ -705,6 +755,7 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
|
|||
if ([_part isEqualToString:GSASK_Class])
|
||||
{
|
||||
Class _class=Nil;
|
||||
NSLog(@"in GSASK_Class");
|
||||
NSAssert2([keys count]>0,@"No class name for handler %@ in %@",
|
||||
GSASK_Class,
|
||||
keyPath_);
|
||||
|
@ -721,8 +772,10 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
|
|||
else
|
||||
_object=nil;
|
||||
}
|
||||
else
|
||||
else {
|
||||
//NSLog(@"before called getIVarNamed with _part = %@",_part);
|
||||
_object=[_object getIVarNamed:_part];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -372,24 +372,24 @@ objectForReference:(NSString*)keyPath
|
|||
NSDictionary* variables=nil;
|
||||
NSEnumerator* variablesEnum=nil;
|
||||
id variableName=nil;
|
||||
NSDebugMLLog(@"bundles",@"archive_:%@",archive_);
|
||||
//NSDebugMLLog(@"bundles",@"archive_:%@",archive_);
|
||||
unarchiver=[[[EOKeyValueUnarchiver alloc] initWithDictionary:archive_]
|
||||
autorelease];
|
||||
NSDebugMLLog(@"bundles",@"unarchiver:%@",unarchiver);
|
||||
//NSDebugMLLog(@"bundles",@"unarchiver:%@",unarchiver);
|
||||
bundleDelegate=[[[GSWBundleUnarchiverDelegate alloc] initWithObject:object_]
|
||||
autorelease];
|
||||
NSDebugMLLog(@"bundles",@"bundleDelegate:%@",bundleDelegate);
|
||||
//NSDebugMLLog(@"bundles",@"bundleDelegate:%@",bundleDelegate);
|
||||
[unarchiver setDelegate:bundleDelegate];
|
||||
NSDebugMLLog(@"bundles",@"decodevar");
|
||||
//NSDebugMLLog(@"bundles",@"decodevar");
|
||||
variables=[unarchiver decodeObjectForKey:@"variables"];
|
||||
NSDebugMLLog(@"bundles",@"variables:%@",variables);
|
||||
//NSDebugMLLog(@"bundles",@"variables:%@",variables);
|
||||
[unarchiver finishInitializationOfObjects];
|
||||
[unarchiver awakeObjects];
|
||||
variablesEnum=[variables keyEnumerator];
|
||||
while ((variableName = [variablesEnum nextObject]))
|
||||
{
|
||||
id variableValue=[variables objectForKey:variableName];
|
||||
NSDebugMLLog(@"bundles",@"variableName:%@ variableValue:%@",variableName,variableValue);
|
||||
//NSDebugMLLog(@"bundles",@"variableName:%@ variableValue:%@",variableName,variableValue);
|
||||
[object_ takeValue:variableValue
|
||||
forKey:variableName];
|
||||
};
|
||||
|
|
|
@ -1125,7 +1125,18 @@ associationsKeys:(NSArray*)_associationsKeys
|
|||
//--------------------------------------------------------------------
|
||||
-(void)ensureAwakeInContext:(GSWContext*)context_
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
//LOGObjectFnNotImplemented(); //TODOFN
|
||||
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();
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -168,11 +168,15 @@ static char rcsId[] = "$Id$";
|
|||
inContext:_context];
|
||||
if (!_session)
|
||||
{
|
||||
// check for refuseNewSessions
|
||||
_errorResponse=[_application handleSessionRestorationErrorInContext:_context];
|
||||
};
|
||||
}
|
||||
else
|
||||
_session=[_application _initializeSessionInContext:_context];
|
||||
{
|
||||
// check for refuseNewSessions
|
||||
_session=[_application _initializeSessionInContext:_context];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define GSWEB_DEFAULT_HTML_PARSER_CLASS_NAME @"GSWTemplateParserXMLHTML"
|
||||
#define GSWOPTVALUE_ApplicationBaseURL_WO @"/WebObjects"
|
||||
#define GSWOPTVALUE_ApplicationBaseURL_GSWEB @"/GSWeb"
|
||||
#define GSWOPTVALUE_AutoOpenInBrowser @"YES"
|
||||
#define GSWOPTVALUE_AutoOpenInBrowser @"NO"
|
||||
#define GSWOPTVALUE_CGIAdaptorURL_WO @"/cgi/WebObjects"
|
||||
#define GSWOPTVALUE_CGIAdaptorURL_GSWEB @"/cgi/GSWeb"
|
||||
//or @"http://host.com/cgi/GSWeb"
|
||||
|
|
|
@ -594,15 +594,16 @@ static char rcsId[] = "$Id$";
|
|||
NSDebugMLLog(@"low",@"empty:%@",empty);
|
||||
// [responseData appendData:[cl dataUsingEncoding:NSASCIIStringEncoding]];
|
||||
[responseData appendData:[empty dataUsingEncoding:NSASCIIStringEncoding]];
|
||||
|
||||
|
||||
[stream writeData:responseData];
|
||||
if ([[response content] length]>0)
|
||||
{
|
||||
[responseData setLength:[[response content] length]];
|
||||
[responseData setData:[response content]];
|
||||
|
||||
|
||||
NSDebugMLLog(@"low",@"[response content]:%@",[response content]);
|
||||
NSDebugMLLog(@"low",@"[[response content] length]=%d",[[response content] length]);
|
||||
NSDebugMLLog(@"[[response content] length]=%d",[[response content] length]);
|
||||
NSDebugMLLog(@"low",@"Response content String NSASCIIStringEncoding:%@",[[[NSString alloc] initWithData:[response content]
|
||||
encoding:NSASCIIStringEncoding]
|
||||
autorelease]);
|
||||
|
|
|
@ -37,7 +37,7 @@ static char rcsId[] = "$Id$";
|
|||
GSWApplication* _application=nil;
|
||||
LOGObjectFnStart();
|
||||
_application=[GSWApplication application];
|
||||
if ([_application isRefusingNewSessions])
|
||||
if (0/*[_application isRefusingNewSessions]*/)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
@ -61,20 +61,21 @@ static char rcsId[] = "$Id$";
|
|||
{
|
||||
case 0:
|
||||
_actionName=@"default";
|
||||
_className=@"GSWDirectAction";
|
||||
_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)
|
||||
if (_tmpActionSel && _class)
|
||||
{
|
||||
if ([GSWDirectAction instancesRespondToSelector:_tmpActionSel])
|
||||
if ([_class instancesRespondToSelector:_tmpActionSel])
|
||||
{
|
||||
_actionName=[_requestHandlerPathArray objectAtIndex:0];
|
||||
_className=@"GSWDirectAction";
|
||||
_className=@"DirectAction";
|
||||
};
|
||||
};
|
||||
if (!_actionName)
|
||||
|
|
|
@ -51,6 +51,7 @@ static char rcsId[] = "$Id$";
|
|||
_queryBindings = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
|
||||
// _selection = 1; //????
|
||||
_batchIndex = 1;
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
|
@ -100,7 +101,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
*/
|
||||
if ((self=[self init]))
|
||||
{
|
||||
LOGObjectFnStop();
|
||||
LOGObjectFnStart();
|
||||
[self setNumberOfObjectsPerBatch:
|
||||
[unarchiver decodeIntForKey:@"numberOfObjectsPerBatch"]];
|
||||
[self setFetchesOnLoad:
|
||||
|
@ -114,7 +115,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
//Don't call setDataSource: because we're not ready !
|
||||
ASSIGN(_dataSource,[unarchiver decodeObjectForKey:@"dataSource"]);
|
||||
[self setSortOrderings:
|
||||
[unarchiver decodeObjectForKey:@"sortOrderings"]];
|
||||
[unarchiver decodeObjectForKey:@"sortOrdering"]];
|
||||
[self setQualifier:
|
||||
[unarchiver decodeObjectForKey:@"qualifier"]];
|
||||
[self setDefaultStringMatchFormat:
|
||||
|
@ -128,6 +129,39 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
return self;
|
||||
};
|
||||
|
||||
-(NSString*)description
|
||||
{
|
||||
NSString* _dscr=nil;
|
||||
GSWLogAssertGood(self);
|
||||
NSDebugMLLog(@"gswdisplaygroup",@"GSWDisplayGroup description Self=%p",self);
|
||||
_dscr=[NSString stringWithFormat:@"<%s %p - \n",
|
||||
object_get_class_name(self),
|
||||
(void*)self];
|
||||
|
||||
_dscr=[_dscr stringByAppendingFormat:@"numberOfObjectsPerBatch:[%d]\n",
|
||||
_numberOfObjectsPerBatch];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"fetchesOnLoad:[%s]\n",
|
||||
_flags.autoFetch ? "YES" : "NO"];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"validatesChangesImmediately:[%s]\n",
|
||||
_flags.validateImmediately ? "YES" : "NO"];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"selectsFirstObjectAfterFetch:[%s]\n",
|
||||
_flags.selectFirstObject ? "YES" : "NO"];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"localKeys:[%@]\n",
|
||||
_localKeys];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"dataSource:[%@]\n",
|
||||
_dataSource];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"sortOrdering:[%@]\n",
|
||||
_sortOrdering];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"qualifier:[%@]\n",
|
||||
_qualifier];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"formatForLikeQualifier:[%@]\n",
|
||||
_defaultStringMatchFormat];
|
||||
_dscr=[_dscr stringByAppendingFormat:@"insertedObjectDefaultValues:[%@]\n",
|
||||
_insertedObjectDefaultValues];
|
||||
|
||||
return _dscr;
|
||||
};
|
||||
|
||||
|
||||
-(void)awakeFromKeyValueUnarchiver:(EOKeyValueUnarchiver*)unarchiver
|
||||
{
|
||||
|
@ -136,6 +170,8 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
[unarchiver ensureObjectAwake:_dataSource];
|
||||
if ([self fetchesOnLoad])
|
||||
{
|
||||
NSLog(@"***** awakeFromKeyValueUnarchiver in GSWDisplayGroup is called *****");
|
||||
[self fetch];
|
||||
// [self fetch];//?? NO: fetch "each time it is loaded in web browser"
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
|
@ -147,6 +183,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
LOGObjectFnStart();
|
||||
[self _setUpForNewDataSource];
|
||||
//Finished ?
|
||||
|
||||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
|
@ -301,7 +338,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
LOGObjectFnStart();
|
||||
|
||||
if(_delegateRespondsTo.shouldRedisplay == YES)
|
||||
redisplay = [self displayGroup:self
|
||||
redisplay = [delegate displayGroup:self
|
||||
shouldRedisplayForEditingContextChangeNotification:notification];
|
||||
|
||||
if(redisplay == YES)
|
||||
|
@ -315,7 +352,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
LOGObjectFnStart();
|
||||
|
||||
if(_delegateRespondsTo.shouldRefetchObjects == YES)
|
||||
refetch = [self displayGroup:self
|
||||
refetch = [delegate displayGroup:self
|
||||
shouldRefetchForInvalidatedAllObjectsNotification:
|
||||
notification];
|
||||
|
||||
|
@ -554,17 +591,36 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
object = [_allObjects objectAtIndex:index];
|
||||
|
||||
if(_delegateRespondsTo.shouldDeleteObject == YES)
|
||||
delete = [delegate displayGroup:self
|
||||
shouldDeleteObject:object];
|
||||
delete = [delegate displayGroup:self shouldDeleteObject:object];
|
||||
|
||||
if(delete)
|
||||
{
|
||||
[_dataSource deleteObject:object];
|
||||
NS_DURING
|
||||
{
|
||||
[_dataSource deleteObject:object];
|
||||
|
||||
[_displayedObjects removeObjectIdenticalTo:object];
|
||||
[_allObjects removeObjectIdenticalTo:object];
|
||||
|
||||
if(_delegateRespondsTo.didDeleteObject == YES)
|
||||
[delegate displayGroup:self
|
||||
didDeleteObject:object];
|
||||
if(_delegateRespondsTo.didDeleteObject == YES)
|
||||
[delegate displayGroup:self didDeleteObject:object];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"GSWDisplayGroup (deleteObjectAtIndex:) Can't delete object at index : %d", index);
|
||||
NSLog(@"object : %@", object);
|
||||
NSLog(@"Exception : %@ %@ Name:%@ Reason:%@\n",
|
||||
localException,
|
||||
[localException description],
|
||||
[localException name],
|
||||
[localException reason]);
|
||||
delete = NO;
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
|
||||
[self clearSelection];
|
||||
|
||||
LOGObjectFnStop();
|
||||
return delete;
|
||||
}
|
||||
|
@ -592,17 +648,37 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
}
|
||||
if (result)
|
||||
{
|
||||
enumerator = [_selectedObjects objectEnumerator];
|
||||
while((object = [enumerator nextObject]))
|
||||
{
|
||||
[_dataSource deleteObject:object];
|
||||
NS_DURING
|
||||
{
|
||||
enumerator = [_selectedObjects objectEnumerator];
|
||||
while((object = [enumerator nextObject]))
|
||||
{
|
||||
[_dataSource deleteObject:object];
|
||||
|
||||
[_displayedObjects removeObjectIdenticalTo:object];
|
||||
[_allObjects removeObjectIdenticalTo:object];
|
||||
|
||||
if(_delegateRespondsTo.didDeleteObject == YES)
|
||||
[delegate displayGroup:self
|
||||
didDeleteObject:object];
|
||||
}
|
||||
if(_delegateRespondsTo.didDeleteObject == YES)
|
||||
[delegate displayGroup:self
|
||||
didDeleteObject:object];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"GSWDisplayGroup (deleteSelection:) Can't delete object");
|
||||
NSLog(@"object : %@", object);
|
||||
NSLog(@"Exception : %@ %@ Name:%@ Reason:%@\n",
|
||||
localException,
|
||||
[localException description],
|
||||
[localException name],
|
||||
[localException reason]);
|
||||
delete = NO;
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
};
|
||||
|
||||
[self clearSelection];
|
||||
|
||||
LOGObjectFnStop();
|
||||
return result;
|
||||
}
|
||||
|
@ -757,16 +833,11 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
if(_delegateRespondsTo.shouldFetchObjects == YES)
|
||||
fetch = [delegate displayGroupShouldFetch:self];
|
||||
|
||||
NSDebugMLog(@"fetch=%d",(int)fetch);
|
||||
|
||||
if(fetch)
|
||||
{
|
||||
NSArray *objects=nil;
|
||||
|
||||
NSDebugMLog(@"_dataSource=%@",_dataSource);
|
||||
|
||||
objects = [_dataSource fetchObjects];
|
||||
NSDebugMLog(@"objects=%@",objects);
|
||||
[self setObjectArray:objects];
|
||||
|
||||
if(_delegateRespondsTo.didFetchObjects == YES)
|
||||
|
@ -875,7 +946,7 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
|
||||
if(!count)
|
||||
index = 0;
|
||||
if(count <= index)
|
||||
if((count <= index) && count>0)
|
||||
index = count - 1;
|
||||
|
||||
[self insertObjectAtIndex:index];
|
||||
|
@ -1422,18 +1493,23 @@ Description: <EOKeyValueUnarchiver: 0x1a84d20>
|
|||
[_displayedObjects removeAllObjects];
|
||||
|
||||
batchCount = [self batchCount];
|
||||
NSLog(@"setCurrentBatchIndex : [self batchCount] = %d", [self batchCount]);
|
||||
if(index_ > batchCount)
|
||||
index_ = 1;
|
||||
|
||||
num = [_allObjects count];
|
||||
NSLog(@"setCurrentBatchIndex : [_allObjects count] = %d", [_allObjects count]);
|
||||
|
||||
if(_numberOfObjectsPerBatch && _numberOfObjectsPerBatch < num)
|
||||
num = _numberOfObjectsPerBatch;
|
||||
|
||||
if(num)
|
||||
{
|
||||
NSLog(@"setCurrentBatchIndex : index_ = %d", index_);
|
||||
NSLog(@"setCurrentBatchIndex : num = %d", num);
|
||||
|
||||
for( i = (index_-1) * num;
|
||||
i < index_ * num;
|
||||
((i < index_ * num) && (i < [_allObjects count]));
|
||||
i++)
|
||||
[_displayedObjects addObject:[_allObjects objectAtIndex:i]];
|
||||
|
||||
|
|
|
@ -108,11 +108,11 @@ static char rcsId[] = "$Id$";
|
|||
LOGObjectFnStart();
|
||||
GSWLogAssertGood(self);
|
||||
GSWLogAssertGood(_string);
|
||||
GSWLogC("_string deallocate");
|
||||
//GSWLogC("_string deallocate");
|
||||
DESTROY(_string);
|
||||
GSWLogC("_string deallocated");
|
||||
//GSWLogC("_string deallocated");
|
||||
[super dealloc];
|
||||
GSWLogC("GSWElementIDString end of dealloc");
|
||||
//GSWLogC("GSWElementIDString end of dealloc");
|
||||
};
|
||||
|
||||
-(void)getCString:(char*)buffer
|
||||
|
|
|
@ -125,12 +125,16 @@ static char rcsId[] = "$Id$";
|
|||
_fileDatas=[request_ formValuesForKey:_nameInContext];
|
||||
NSDebugMLLog(@"gswdync",@"_value=%@",_fileDatas);
|
||||
_fileDatasCount=[_fileDatas count];
|
||||
/*
|
||||
if (_fileDatasCount!=1)
|
||||
{
|
||||
ExceptionRaise(@"GSWFileUpload",
|
||||
@"GSWFileUpload: File Data Nb != 1 :%d",
|
||||
_fileDatasCount);
|
||||
};
|
||||
*/
|
||||
if (_fileDatasCount==1) {
|
||||
|
||||
_data=[_fileDatas objectAtIndex:0];
|
||||
if (_data)
|
||||
{
|
||||
|
@ -150,10 +154,14 @@ static char rcsId[] = "$Id$";
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"content type request : %@",[request_ _contentType]);
|
||||
NSLog(@"data class = %@",NSStringFromClass([_data class]));
|
||||
/*if (![_data isMemberOfClass:[NSString class]]) {
|
||||
ExceptionRaise(@"GSWFileUpload",
|
||||
@"GSWFileUpload: bad data :%@",
|
||||
_data);
|
||||
_data=nil;
|
||||
}*/
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -173,6 +181,14 @@ static char rcsId[] = "$Id$";
|
|||
inComponent:_component];
|
||||
[data setValue:_data
|
||||
inComponent:_component];
|
||||
} else {
|
||||
// bug in omniweb-browser if you click cancel in FileOpenPanel, it transmits incorrect datas
|
||||
|
||||
[filepath setValue:nil
|
||||
inComponent:_component];
|
||||
[data setValue:nil
|
||||
inComponent:_component];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
|
|
@ -28,7 +28,16 @@
|
|||
|
||||
//====================================================================
|
||||
@interface GSWHTMLStaticGroup: GSWHTMLStaticElement
|
||||
{
|
||||
NSString* _documentTypeString;
|
||||
}
|
||||
-(id)initWithContentElements:(NSArray*)elements_;
|
||||
-(void)setDocumentTypeString:(NSString *)documentType_;
|
||||
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_;
|
||||
|
||||
-(void)dealloc;
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -44,4 +44,37 @@ static char rcsId[] = "$Id$";
|
|||
return self;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setDocumentTypeString:(NSString *)documentType_
|
||||
{
|
||||
[_documentTypeString release];
|
||||
_documentTypeString = [documentType_ retain];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)appendToResponse:(GSWResponse*)response_
|
||||
inContext:(GSWContext*)context_
|
||||
{
|
||||
if (_documentTypeString)
|
||||
{
|
||||
NSStringEncoding _encoding=[response_ contentEncoding];
|
||||
|
||||
NSDebugMLLog(@"gswdync",@"added _documentTypeString = %@", _documentTypeString);
|
||||
|
||||
[response_ appendContentData:[_documentTypeString
|
||||
dataUsingEncoding:_encoding]];
|
||||
};
|
||||
|
||||
[super appendToResponse:response_ inContext:context_];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
{
|
||||
[_documentTypeString release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -327,6 +327,7 @@ static char rcsId[] = "$Id$";
|
|||
}
|
||||
else if (filename)
|
||||
{
|
||||
NSDebugMLLog(@"gswdync",@"_url = %@",_url);
|
||||
[response_ appendContentString:_url];
|
||||
}
|
||||
else
|
||||
|
|
|
@ -563,7 +563,16 @@ static char rcsId[] = "$Id$";
|
|||
if (![_element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ?
|
||||
{
|
||||
ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element");
|
||||
};
|
||||
} else {
|
||||
// call awakeInContext when _element is sleeping deeply
|
||||
[_element ensureAwakeInContext:context_];
|
||||
/*
|
||||
if (![_element context]) {
|
||||
NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element);
|
||||
[_element awakeInContext:context_];
|
||||
}
|
||||
*/
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (pageName)
|
||||
|
|
|
@ -403,6 +403,22 @@ static char rcsId[] = "$Id$";
|
|||
{
|
||||
[context_ _setActionInvoked:YES];
|
||||
_element=[_actionAssociation valueInComponent:_component];
|
||||
if (_element)
|
||||
{
|
||||
if (![_element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ?
|
||||
{
|
||||
ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element");
|
||||
} else {
|
||||
// call awakeInContext when _element is sleeping deeply
|
||||
[_element ensureAwakeInContext:context_];
|
||||
/*
|
||||
if (![_element context]) {
|
||||
NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element);
|
||||
[_element awakeInContext:context_];
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ static char rcsId[] = "$Id$";
|
|||
NSDebugMLLog(@"associations",@"retValue=%@ (%p) (class=%@)",
|
||||
retValue,
|
||||
retValue,
|
||||
[retValue class]);
|
||||
NSStringFromClass([retValue class]));
|
||||
[self logTakeValue:retValue];
|
||||
LOGObjectFnStop();
|
||||
return retValue;
|
||||
|
@ -77,7 +77,7 @@ static char rcsId[] = "$Id$";
|
|||
{
|
||||
LOGObjectFnStart();
|
||||
NSDebugMLLog(@"associations",@"GSWAssociation: setValue:%@ (self=%@)",value_,self);
|
||||
NSDebugMLLog(@"associations",@"value_ class:%@",[value_ class]);
|
||||
NSDebugMLLog(@"associations",@"value_ class:%@",NSStringFromClass([value_ class]));
|
||||
NSDebugMLLog(@"associations",@"value_ String class:%@",NSStringFromClass([value_ class]));
|
||||
//TODO (return something!)
|
||||
[object_ validateValue:&value_
|
||||
|
|
|
@ -179,7 +179,8 @@ static char rcsId[] = "$Id$";
|
|||
_noSelectionStringValue=[noSelectionString valueInComponent:_component];
|
||||
if (_escapeHTML)
|
||||
_noSelectionStringValue=[GSWResponse stringByEscapingHTMLString:_noSelectionStringValue];
|
||||
[response_ appendContentHTMLString:_noSelectionStringValue];
|
||||
[response_ appendContentString:_noSelectionStringValue];
|
||||
//[response_ appendContentHTMLString:_noSelectionStringValue];
|
||||
// There is no close tag on OPTION
|
||||
//[response_ _appendContentAsciiString:@"</OPTION>"];
|
||||
};
|
||||
|
@ -244,7 +245,11 @@ static char rcsId[] = "$Id$";
|
|||
NSDebugMLLog(@"gswdync",@"displayString=%@",displayString);
|
||||
_displayStringValue=[displayString valueInComponent:_component];
|
||||
NSDebugMLLog(@"gswdync",@"_displayStringValue=%@",_displayStringValue);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
_displayStringValue = _itemValue;
|
||||
}
|
||||
|
||||
if (_displayStringValue)
|
||||
{
|
||||
|
@ -283,7 +288,8 @@ static char rcsId[] = "$Id$";
|
|||
_displayStringValue=[NSString stringWithFormat:@"%@ --",_displayStringValue];
|
||||
};
|
||||
#endif
|
||||
[response_ appendContentHTMLString:_displayStringValue];
|
||||
[response_ appendContentString:_displayStringValue];
|
||||
//[response_ appendContentHTMLString:_displayStringValue];
|
||||
};
|
||||
if (_valueValue)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
-(id)copyWithZone:(NSZone*)zone_;
|
||||
|
||||
-(NSData*)content;
|
||||
-(NSDictionary*)headers;
|
||||
-(NSString*)headerForKey:(NSString*)key_;
|
||||
-(NSArray*)headerKeys;
|
||||
-(NSArray*)headersForKey:(NSString*)key_;
|
||||
|
|
|
@ -171,6 +171,14 @@ static char rcsId[] = "$Id$";
|
|||
return [headers objectForKey:key_];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// headers
|
||||
|
||||
-(NSDictionary*)headers
|
||||
{
|
||||
return headers;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// httpVersion
|
||||
|
||||
|
@ -853,12 +861,15 @@ method=%@, uri=%@, httpVersion=%@, headers=%@, content=%@, userInfo=%@, defaultF
|
|||
//We can get something like
|
||||
// multipart/form-data; boundary=---------------------------1810101926251
|
||||
// In this case, return only multipart/form-data
|
||||
_range=[_contentType rangeOfString:@";"];
|
||||
if (_range.length>0)
|
||||
{
|
||||
_contentType=[_contentType substringToIndex:_range.location];
|
||||
NSDebugMLLog(@"requests",@"_contentType=%@",_contentType);
|
||||
};
|
||||
if (_contentType)
|
||||
{
|
||||
_range=[_contentType rangeOfString:@";"];
|
||||
if (_range.length>0)
|
||||
{
|
||||
_contentType=[_contentType substringToIndex:_range.location];
|
||||
NSDebugMLLog(@"requests",@"_contentType=%@",_contentType);
|
||||
};
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
return _contentType;
|
||||
};
|
||||
|
@ -1761,7 +1772,7 @@ into
|
|||
NSString* _requestHandlerKey=nil;
|
||||
int _applicationNumber;
|
||||
LOGObjectFnStart();
|
||||
_dict=[NSMutableDictionary new];
|
||||
_dict=[[NSMutableDictionary new] autorelease];
|
||||
//NEW//TODO
|
||||
_requestHandlerKey=[((GSWDynamicURLString*)[self uri]) urlRequestHandlerKey];
|
||||
if (!_requestHandlerKey
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
forKey:(NSString*)key_;
|
||||
-(void)setHeaders:(NSArray*)headerList_
|
||||
forKey:(NSString*)key_;
|
||||
-(void)setHeaders:(NSDictionary*)headerList_;
|
||||
-(NSMutableDictionary*)headers;
|
||||
-(void)setHTTPVersion:(NSString*)version_;
|
||||
-(void)setStatus:(unsigned int)status_;
|
||||
-(void)setUserInfo:(NSDictionary*)userInfo_;
|
||||
|
@ -159,4 +161,16 @@
|
|||
inContext:(GSWContext*)context_
|
||||
forRequest:(GSWRequest*)request_;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWResponse (GSWResponseRefused)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
//Refuse Response
|
||||
+(GSWResponse*)generateRefusingResponseInContext:(GSWContext*)context_
|
||||
forRequest:(GSWRequest*)request_;
|
||||
@end
|
||||
|
||||
|
||||
#endif //_GSWResponse_h__
|
||||
|
|
|
@ -201,6 +201,36 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
|
|||
forKey:key_];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// setHeaders:
|
||||
|
||||
-(void)setHeaders:(NSDictionary*)headerDictionary
|
||||
{
|
||||
if (!headers)
|
||||
headers=[NSMutableDictionary new];
|
||||
|
||||
if (headerDictionary)
|
||||
{
|
||||
NSEnumerator *keyEnum;
|
||||
id headerName;
|
||||
|
||||
keyEnum = [headerDictionary keyEnumerator];
|
||||
while (headerName = [keyEnum nextObject])
|
||||
{
|
||||
[self setHeaders:[NSArray arrayWithObject:[headerDictionary objectForKey:headerName]]
|
||||
forKey:headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// headers
|
||||
|
||||
-(NSMutableDictionary*)headers
|
||||
{
|
||||
return headers;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// setHTTPVersion:
|
||||
|
||||
|
@ -643,8 +673,9 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
|
|||
//--------------------------------------------------------------------
|
||||
-(GSWResponse*)generateResponse
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
return nil;
|
||||
//LOGObjectFnNotImplemented(); //TODOFN
|
||||
//return nil;
|
||||
return self;
|
||||
};
|
||||
|
||||
@end
|
||||
|
@ -701,3 +732,62 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
|
|||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@implementation GSWResponse (GSWResponseRefused)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
//Refuse Response
|
||||
+(GSWResponse*)generateRefusingResponseInContext:(GSWContext*)context_
|
||||
forRequest:(GSWRequest*)request_
|
||||
{
|
||||
GSWResponse* _response=nil;
|
||||
NSString* _httpVersion=nil;
|
||||
LOGClassFnStart();
|
||||
_response=[[self new]autorelease];
|
||||
if (_response)
|
||||
{
|
||||
NSString* _responseString=nil;
|
||||
NSString* _locationURLString=nil;
|
||||
NSString* _message=nil;
|
||||
|
||||
if (context_ && [context_ request])
|
||||
{
|
||||
request_=[context_ request];
|
||||
}
|
||||
_httpVersion=[request_ httpVersion];
|
||||
if (_httpVersion)
|
||||
{
|
||||
[_response setHTTPVersion:_httpVersion];
|
||||
}
|
||||
|
||||
[_response setStatus:302];
|
||||
_locationURLString = [NSString stringWithFormat:@"%@/%@.gswa",[request_ adaptorPrefix], [request_ applicationName]];
|
||||
if (_locationURLString)
|
||||
{
|
||||
[_response setHeader: _locationURLString forKey:@"location"];
|
||||
}
|
||||
[_response setHeader:@"text/html" forKey:@"content-type"];
|
||||
[_response setHeader:@"YES" forKey:@"x-gsweb-refusing-redirection"];
|
||||
|
||||
if (context_)
|
||||
{
|
||||
[context_ _setResponse:_response];
|
||||
}
|
||||
|
||||
_message = [NSString stringWithFormat:@"Sorry, your request could not immediately be processed. Please try this URL: <a href=\"%@\">%@</a>\nConnection closed by foreign host.",
|
||||
_locationURLString, _locationURLString];
|
||||
|
||||
_responseString=[NSString stringWithFormat:@"<HTML>\n<TITLE>GNUstepWeb</TITLE>\n</HEAD>\n<BODY bgcolor=\"white\">\n<CENTER>\n%@\n</CENTER>\n</BODY>\n</HTML>\n",
|
||||
_message];
|
||||
//[[_response class]stringByEscapingHTMLString:_message]];
|
||||
[_response appendContentString:_responseString];
|
||||
|
||||
[_response setHeader:[NSString stringWithFormat:@"%d", [[_response content] length]] forKey:@"content-length"];
|
||||
};
|
||||
LOGClassFnStop();
|
||||
return _response;
|
||||
};
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -44,4 +44,10 @@
|
|||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWServerSessionStore (GSWServerSessionStoreInfo)
|
||||
-(BOOL)containsSessionID:(NSString*)sessionID_;
|
||||
-(NSArray *)allSessionIDs;
|
||||
@end
|
||||
|
||||
#endif //_GSWServerSessionStore_h__
|
||||
|
|
|
@ -37,6 +37,7 @@ static char rcsId[] = "$Id$";
|
|||
sessions=[NSMutableDictionary new];
|
||||
[timeOut_manager setCallBack:@selector(removeSessionWithID:)
|
||||
target:self];
|
||||
[timeOut_manager startHandleTimerRefusingSessions];
|
||||
};
|
||||
LOGObjectFnStop();
|
||||
return self;
|
||||
|
@ -128,3 +129,25 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@implementation GSWServerSessionStore (GSWServerSessionStoreInfo)
|
||||
-(BOOL)containsSessionID:(NSString*)sessionID_
|
||||
{
|
||||
BOOL contain = NO;
|
||||
//OK
|
||||
LOGObjectFnStart();
|
||||
if([sessions objectForKey:sessionID_])
|
||||
{
|
||||
contain = YES;
|
||||
}
|
||||
LOGObjectFnStop();
|
||||
return contain;
|
||||
};
|
||||
|
||||
-(NSArray *)allSessionIDs
|
||||
{
|
||||
return [sessions allKeys];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -315,6 +315,7 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
isTerminating=YES;
|
||||
_sessionID=[self sessionID];
|
||||
[self setTimeOut:(NSTimeInterval) 1]; // forces to call removeSessionWithID in GSWServerSessionStore to dealloc it
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:GSWNotification__SessionDidTimeOutNotification[GSWebNamingConv]
|
||||
object:_sessionID];
|
||||
//goto => GSWApp _sessionDidTimeOutNotification:
|
||||
|
|
|
@ -86,5 +86,4 @@
|
|||
-(void)_validateAPI;
|
||||
@end
|
||||
|
||||
|
||||
#endif //_GSWSessionStore_h__
|
||||
|
|
|
@ -388,9 +388,3 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
//====================================================================
|
||||
@interface GSWSessionTimeOutManager : NSObject
|
||||
{
|
||||
NSMutableOrderedArray* sessionOrderedTimeOuts;
|
||||
//NSMutableOrderedArray* sessionOrderedTimeOuts;
|
||||
NSMutableArray* sessionOrderedTimeOuts;
|
||||
NSMutableDictionary* sessionTimeOuts;
|
||||
id target;
|
||||
SEL callback;
|
||||
|
@ -56,4 +57,12 @@
|
|||
-(void)unlock;
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@interface GSWSessionTimeOutManager (GSWSessionRefused)
|
||||
|
||||
-(void)startHandleTimerRefusingSessions;
|
||||
-(void)handleTimerKillingApplication:(id)timer_;
|
||||
-(void)handleTimerRefusingSessions:(id)timer_;
|
||||
|
||||
@end
|
||||
#endif //_GSWSessionTimeOutManager_h__
|
||||
|
|
|
@ -33,7 +33,8 @@ static char rcsId[] = "$Id$";
|
|||
//OK
|
||||
if ((self=[super init]))
|
||||
{
|
||||
sessionOrderedTimeOuts=[[NSMutableOrderedArray alloc]initWithCompareSelector:@selector(compareTimeOutDate:)];
|
||||
//sessionOrderedTimeOuts=[[NSMutableOrderedArray alloc]initWithCompareSelector:@selector(compareTimeOutDate:)];
|
||||
sessionOrderedTimeOuts=[NSMutableArray new];
|
||||
sessionTimeOuts=[NSMutableDictionary new];
|
||||
// selfLock=[NSRecursiveLock new];
|
||||
selfLock=[NSLock new];
|
||||
|
@ -100,6 +101,7 @@ static char rcsId[] = "$Id$";
|
|||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"### exception from ... addTimer... %@", [localException reason]);
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
//TODO
|
||||
[target unlock];
|
||||
|
@ -114,6 +116,7 @@ static char rcsId[] = "$Id$";
|
|||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"### exception ... %@", [localException reason]);
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
//TODO
|
||||
[self unlock];
|
||||
|
@ -136,14 +139,24 @@ static char rcsId[] = "$Id$";
|
|||
[self lock];
|
||||
NS_DURING
|
||||
{
|
||||
NSEnumerator *_sessionTimeOutEnum = nil;
|
||||
GSWSessionTimeOut* _sessionTimeOut=nil;
|
||||
NSTimeInterval _now=[NSDate timeIntervalSinceReferenceDate];
|
||||
NSTimer* _timer=nil;
|
||||
int _removedNb=0;
|
||||
|
||||
/*
|
||||
if ([sessionOrderedTimeOuts count]>0)
|
||||
_sessionTimeOut=[sessionOrderedTimeOuts objectAtIndex:0];
|
||||
while (/*_removedNb<20 && */_sessionTimeOut && [_sessionTimeOut timeOutTime]<_now)
|
||||
*/
|
||||
|
||||
_sessionTimeOutEnum = [sessionOrderedTimeOuts objectEnumerator];
|
||||
|
||||
while (/*_removedNb<20 && *//*_sessionTimeOut && [_sessionTimeOut timeOutTime]<_now*/
|
||||
_sessionTimeOut = [_sessionTimeOutEnum nextObject])
|
||||
{
|
||||
if ([_sessionTimeOut timeOutTime]<_now)
|
||||
{
|
||||
id _session=nil;
|
||||
[target lock];
|
||||
NS_DURING
|
||||
|
@ -174,16 +187,25 @@ static char rcsId[] = "$Id$";
|
|||
NSDebugMLLog(@"sessions",@"sessionOrderedTimeOuts=%@",sessionOrderedTimeOuts);
|
||||
[_session terminate];
|
||||
NSDebugMLLog(@"sessions",@"sessionOrderedTimeOuts=%@",sessionOrderedTimeOuts);
|
||||
[sessionOrderedTimeOuts removeObjectAtIndex:0];
|
||||
|
||||
NSLog(@"GSWSessionTimeOutMananger : removeObject = %@", _sessionTimeOut);
|
||||
|
||||
/* [sessionOrderedTimeOuts removeObjectAtIndex:0]; */
|
||||
[sessionOrderedTimeOuts removeObject:_sessionTimeOut];
|
||||
[sessionTimeOuts removeObjectForKey:[_session sessionID]];
|
||||
|
||||
NSDebugMLLog(@"sessions",@"sessionOrderedTimeOuts=%@",sessionOrderedTimeOuts);
|
||||
_removedNb++;
|
||||
/*
|
||||
if ([sessionOrderedTimeOuts count]>0)
|
||||
_sessionTimeOut=[sessionOrderedTimeOuts objectAtIndex:0];
|
||||
else
|
||||
_sessionTimeOut=nil;
|
||||
*/
|
||||
}
|
||||
else
|
||||
_sessionTimeOut=nil;
|
||||
};
|
||||
};
|
||||
|
||||
_timer=[self resetTimer];
|
||||
|
@ -230,20 +252,46 @@ static char rcsId[] = "$Id$";
|
|||
NSDebugMLLog(@"sessions",@"sessionOrderedTimeOuts=%@",sessionOrderedTimeOuts);
|
||||
if ([sessionOrderedTimeOuts count]>0)
|
||||
{
|
||||
_sessionTimeOut=[sessionOrderedTimeOuts objectAtIndex:0];
|
||||
NSEnumerator * sessionOrderedTimeOutsEnum = [sessionOrderedTimeOuts objectEnumerator];
|
||||
GSWSessionTimeOut* sessionTimeOutObject=nil;
|
||||
NSTimeInterval _minTimeOut;
|
||||
|
||||
_sessionTimeOut = [sessionOrderedTimeOuts objectAtIndex:0];
|
||||
_minTimeOut = [_sessionTimeOut timeOutTime];
|
||||
while (sessionTimeOutObject = [sessionOrderedTimeOutsEnum nextObject]) {
|
||||
if ([sessionTimeOutObject timeOutTime] < _minTimeOut) {
|
||||
_sessionTimeOut = sessionTimeOutObject;
|
||||
_minTimeOut = [_sessionTimeOut timeOutTime];
|
||||
}
|
||||
}
|
||||
|
||||
//_sessionTimeOut=[sessionOrderedTimeOuts objectAtIndex:0];
|
||||
|
||||
// search for minimum timeouts
|
||||
|
||||
NSDebugMLLog(@"sessions",@"_sessionTimeOut=%@",_sessionTimeOut);
|
||||
NSDebugMLLog(@"sessions",@"[timer fireDate]=%@",[timer fireDate]);
|
||||
NSDebugMLLog(@"sessions",@"[old timer isValide]=%s",
|
||||
[timer isValid] ? "YES" : "NO");
|
||||
/*
|
||||
NSLog(@"_sessionTimeOut=%@",_sessionTimeOut);
|
||||
NSLog(@"[old timer isValide]=%s", [timer isValid] ? "YES" : "NO");
|
||||
NSLog(@"[_sessionTimeOut timeOutTime] = %ld",(long)[_sessionTimeOut timeOutTime]);
|
||||
NSLog(@"_timerFireTimeInterval = %ld",(long) _timerFireTimeInterval);
|
||||
NSLog(@"_now = %ld",(long) _now);
|
||||
*/
|
||||
if (_sessionTimeOut
|
||||
&& (![timer isValid]
|
||||
|| [_sessionTimeOut timeOutTime]<_timerFireTimeInterval
|
||||
|| _timerFireTimeInterval<_now))
|
||||
{
|
||||
NSTimeInterval _timerTimeInterval=[_sessionTimeOut timeOutTime]-_now;
|
||||
|
||||
NSDebugMLLog(@"sessions",@"_timerTimeInterval=%ld",(long)_timerTimeInterval);
|
||||
_timerTimeInterval=max(_timerTimeInterval,1);//20s minimum
|
||||
NSDebugMLLog(@"sessions",@"_timerTimeInterval=%ld",(long)_timerTimeInterval);
|
||||
_timerTimeInterval=max(_timerTimeInterval,10);//20s minimum
|
||||
NSDebugMLLog(@"sessions",@"_timerTimeInterval=%ld",(long)_timerTimeInterval);
|
||||
NSLog(@"new _timerTimeInterval=%ld",(long)_timerTimeInterval);
|
||||
|
||||
_newTimer=[NSTimer timerWithTimeInterval:_timerTimeInterval
|
||||
target:self
|
||||
selector:@selector(handleTimer:)
|
||||
|
@ -330,4 +378,168 @@ static char rcsId[] = "$Id$";
|
|||
LOGObjectFnStop();
|
||||
};
|
||||
|
||||
@end
|
||||
|
||||
//====================================================================
|
||||
@implementation GSWSessionTimeOutManager (GSWSessionRefused)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)startHandleTimerRefusingSessions
|
||||
{
|
||||
NSTimer* _newTimer = nil;
|
||||
|
||||
NSLog(@"---Start startHandleTimerRefusingSessions");
|
||||
//[GSWApplication statusLogWithFormat:@"Start startHandleTimerRefusingSessions"];
|
||||
//LOGObjectFnStart();
|
||||
[self lock];
|
||||
/*
|
||||
_newTimer=[NSTimer timerWithTimeInterval:5 // first time after 5 seconds
|
||||
target:self
|
||||
selector:@selector(handleTimerRefusingSessions:)
|
||||
userInfo:nil
|
||||
repeats:NO];
|
||||
|
||||
if (_newTimer) {
|
||||
[GSWApp addTimer:_newTimer];
|
||||
}
|
||||
*/
|
||||
|
||||
_newTimer = [NSTimer scheduledTimerWithTimeInterval:5
|
||||
target:self
|
||||
selector:@selector(handleTimerRefusingSessions:)
|
||||
userInfo:nil
|
||||
repeats:NO];
|
||||
|
||||
[self unlock];
|
||||
//LOGObjectFnStop();
|
||||
//[GSWApplication statusLogWithFormat:@"Stop startHandleTimerRefusingSessions"];
|
||||
NSLog(@"---Stop startHandleTimerRefusingSessions");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)handleTimerKillingApplication:(id)timer_
|
||||
{
|
||||
NSLog(@"application is shutting down...");
|
||||
[GSWApp lock];
|
||||
[GSWApp lockRequestHandling];
|
||||
[self lock];
|
||||
[GSWApp dealloc];
|
||||
[GSWApplication dealloc]; // call class method , not instance method
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)handleTimerRefusingSessions:(id)timer_
|
||||
{
|
||||
//OK
|
||||
//NSLog(@"-Start HandleTimerRefusingSessions");
|
||||
//[GSWApplication statusLogWithFormat:@"-Start HandleTimerRefusingSessions"];
|
||||
//[GSWApp lockRequestHandling];
|
||||
NS_DURING
|
||||
{
|
||||
[self lock];
|
||||
NS_DURING
|
||||
{
|
||||
GSWApplication *ourApp = [GSWApplication application];
|
||||
NSTimer *_timer=nil;
|
||||
|
||||
if (ourApp && [ourApp isRefusingNewSessions] && ([sessionOrderedTimeOuts count] <= [ourApp minimumActiveSessionsCount])) {
|
||||
|
||||
// okay , soft-shutdown for all avtive sessions
|
||||
|
||||
GSWSessionTimeOut *_sessionTimeOut=nil;
|
||||
|
||||
while ([sessionOrderedTimeOuts count] > 0) {
|
||||
|
||||
_sessionTimeOut = [sessionOrderedTimeOuts lastObject];
|
||||
if (_sessionTimeOut) {
|
||||
|
||||
id _session=nil;
|
||||
[target lock];
|
||||
NS_DURING
|
||||
{
|
||||
_session=[target performSelector:callback
|
||||
withObject:[_sessionTimeOut sessionID]];
|
||||
NSDebugMLLog(@"sessions",@"_session=%@",_session);
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
//TODO
|
||||
[target unlock];
|
||||
_timer = [NSTimer scheduledTimerWithTimeInterval:5
|
||||
target:self
|
||||
selector:@selector(handleTimerRefusingSessions:)
|
||||
userInfo:nil
|
||||
repeats:NO];
|
||||
|
||||
[self unlock];
|
||||
//[GSWApp unlockRequestHandling];
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
[target unlock];
|
||||
|
||||
if (_session)
|
||||
{
|
||||
NSDebugMLLog(@"sessions",@"sessionOrderedTimeOuts=%@",sessionOrderedTimeOuts);
|
||||
[_session terminate]; // ???
|
||||
NSDebugMLLog(@"sessions",@"sessionOrderedTimeOuts=%@",sessionOrderedTimeOuts);
|
||||
|
||||
NSLog(@"GSWSessionTimeOutMananger : removeObject = %@", _sessionTimeOut);
|
||||
|
||||
[sessionOrderedTimeOuts removeObject:_sessionTimeOut];
|
||||
[sessionTimeOuts removeObjectForKey:[_session sessionID]];
|
||||
|
||||
NSDebugMLLog(@"sessions",@"sessionOrderedTimeOuts=%@",sessionOrderedTimeOuts);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// app terminate
|
||||
NSLog(@"application is preparing to shut down in 10 sec...");
|
||||
|
||||
_timer = [NSTimer scheduledTimerWithTimeInterval:10
|
||||
target:self
|
||||
selector:@selector(handleTimerKillingApplication:)
|
||||
userInfo:nil
|
||||
repeats:NO];
|
||||
|
||||
} else
|
||||
{
|
||||
// new timer, app does not terminate
|
||||
_timer = [NSTimer scheduledTimerWithTimeInterval:5
|
||||
target:self
|
||||
selector:@selector(handleTimerRefusingSessions:)
|
||||
userInfo:nil
|
||||
repeats:NO];
|
||||
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
//TODO
|
||||
[self unlock];
|
||||
//[GSWApp unlockRequestHandling];
|
||||
[localException raise];
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
NSDebugMLLog(@"sessions",@"sessionOrderedTimeOuts=%@",sessionOrderedTimeOuts);
|
||||
[self unlock];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException(@"%@ (%@)",localException,[localException reason]);
|
||||
//TODO
|
||||
//[GSWApp unlockRequestHandling];
|
||||
[localException raise];
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
//[GSWApp unlockRequestHandling];
|
||||
//[GSWApplication statusLogWithFormat:@"-Stop HandleTimerRefusingSessions"];
|
||||
//NSLog(@"-Stop HandleTimerRefusingSessions");
|
||||
};
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -148,8 +148,30 @@ static char rcsId[] = "$Id$";
|
|||
NS_ENDHANDLER;
|
||||
if (_actionValue)
|
||||
_element=_actionValue;
|
||||
if (_element)
|
||||
{
|
||||
if (![_element isKindOfClass:[GSWComponent class]]) //TODO GSWComponent or Element ?
|
||||
{
|
||||
ExceptionRaise0(@"GSWHyperlink",@"Invoked element return a not GSWComponent element");
|
||||
}
|
||||
else
|
||||
{
|
||||
// call awakeInContext when _element is sleeping deeply
|
||||
[_element ensureAwakeInContext:context_];
|
||||
/*
|
||||
if (![_element context]) {
|
||||
NSDebugMLLog(@"gswdync",@"_element sleeps, awake it = %@",_element);
|
||||
[_element awakeInContext:context_];
|
||||
} else {
|
||||
[_element awakeInContext:context_];
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
/* ???
|
||||
if (!_element)
|
||||
_element=[context_ page];
|
||||
*/
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -232,7 +232,24 @@ Class GSWTemplateParser_DefaultParserClass=Nil;
|
|||
NS_ENDHANDLER;
|
||||
if (elements)
|
||||
{
|
||||
NSRange docTypeRangeStart=NSMakeRange(NSNotFound,0);
|
||||
NSRange docTypeRangeEnd=NSMakeRange(NSNotFound,0);
|
||||
|
||||
_template=[[GSWHTMLStaticGroup alloc]initWithContentElements:elements];
|
||||
|
||||
//NSLog(@"_string = %@", _string);
|
||||
|
||||
docTypeRangeStart=[_string rangeOfString:@"<!DOCTYPE"];
|
||||
if (docTypeRangeStart.length) {
|
||||
docTypeRangeEnd=[_string rangeOfString:@">"];
|
||||
if (docTypeRangeEnd.length) {
|
||||
if (docTypeRangeStart.location < docTypeRangeEnd.location)
|
||||
{
|
||||
[_template setDocumentTypeString:[_string substringFromRange:NSMakeRange(docTypeRangeStart.location,
|
||||
docTypeRangeEnd.location - docTypeRangeStart.location + 1)]];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -130,7 +130,7 @@ extern void externalSubset (void *ctx,
|
|||
if ((self=[self init]))
|
||||
{
|
||||
_templateParser=templateParser_;
|
||||
NSLog(@"my sax lib=%p",lib);
|
||||
//NSLog(@"my sax lib=%p",lib);
|
||||
if (lib)
|
||||
{
|
||||
xmlSAXHandlerPtr def=NULL;
|
||||
|
@ -504,7 +504,6 @@ static NSString* TabsForLevel(int level)
|
|||
else
|
||||
stringToParse=_string;
|
||||
stringToParse=[xmlHeader stringByAppendingString:stringToParse];
|
||||
NSLog(@"stringToParse=%@",stringToParse);
|
||||
parser=[GSXMLParser parserWithSAXHandler:sax
|
||||
withData:[stringToParse dataUsingEncoding:stringEncoding]];
|
||||
};
|
||||
|
@ -556,6 +555,19 @@ static NSString* TabsForLevel(int level)
|
|||
NSDebugMLLog0(@"low",@"_xmlDocument dumped");
|
||||
};
|
||||
#endif
|
||||
/*
|
||||
if ([node type]==XML_DTD_NODE) {
|
||||
NSLog(@"GSWTemplateParserXML: XML_DTD_NODE is found");
|
||||
}
|
||||
|
||||
NSLog(@"ROOT node=%p %@ [Type:%@] [%@] ##%s##\n",
|
||||
node,
|
||||
[node name],
|
||||
[node typeDescription],
|
||||
[node propertiesAsDictionary],
|
||||
[[node content] lossyCString]);
|
||||
*/
|
||||
|
||||
/* if (node->type!=XML_DTD_NODE)
|
||||
{
|
||||
NSLog(@"Bad first node type: %@ instead of %@",
|
||||
|
@ -589,6 +601,14 @@ static NSString* TabsForLevel(int level)
|
|||
(_isHTMLTag ? "YES" : "NO"),
|
||||
(_isBodyTag ? "YES" : "NO"));
|
||||
*/
|
||||
/*
|
||||
NSLog(@"while1 node=%p %@ [Type:%@] [%@] ##%s##\n",
|
||||
node,
|
||||
[node name],
|
||||
[node typeDescription],
|
||||
[node propertiesAsDictionary],
|
||||
[[node content] lossyCString]);
|
||||
*/
|
||||
if ((!_isHTMLTag && [nodeName caseInsensitiveCompare:@"html"]==NSOrderedSame)
|
||||
|| (!_isBodyTag && [nodeName caseInsensitiveCompare:@"body"]==NSOrderedSame))
|
||||
{
|
||||
|
@ -665,17 +685,27 @@ text [Type:XML_TEXT_NODE] [{}] ####
|
|||
[currentNode name],
|
||||
[currentNode typeDescription],
|
||||
[currentNode propertiesAsDictionary],
|
||||
/* ((xmlNodePtr)[currentNode lib])->content,
|
||||
[currentNode content],*/
|
||||
[[currentNode content] lossyCString]);
|
||||
|
||||
switch([currentNode type])
|
||||
{
|
||||
case XML_TEXT_NODE:
|
||||
{
|
||||
NSDebugMLog0(@"TEXT");
|
||||
elem=[GSWHTMLBareString elementWithString:
|
||||
[NSString stringWithCString:
|
||||
[[[currentNode content]
|
||||
stringByConvertingToHTMLEntities]
|
||||
lossyCString]]];//Because XML Parser decode characters
|
||||
|
||||
if ([currentNode content] && ([[currentNode content] length] > 0) ) {
|
||||
|
||||
elem=[GSWHTMLBareString elementWithString:
|
||||
[NSString stringWithCString:
|
||||
[[[currentNode content]
|
||||
stringByConvertingToHTMLEntities]
|
||||
lossyCString]]];//Because XML Parser decode characters
|
||||
} else {
|
||||
elem = nil;
|
||||
}
|
||||
|
||||
NSDebugMLog(@"TEXT element=%@",elem);
|
||||
};
|
||||
break;
|
||||
|
@ -878,7 +908,8 @@ text [Type:XML_TEXT_NODE] [{}] ####
|
|||
};
|
||||
break;
|
||||
};
|
||||
[_elements addObject:elem];
|
||||
if (elem)
|
||||
[_elements addObject:elem];
|
||||
NSDebugMLog(@"END node=%p %@ [Type:%@] [%@] ##%s##\n",
|
||||
currentNode,
|
||||
[currentNode name],
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef _GSWebUtils_h__
|
||||
#define _GSWebUtils_h__
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -230,18 +230,27 @@
|
|||
@interface WOFrame : GSWFrame
|
||||
@end
|
||||
|
||||
@interface WOGenericContainer : GSWGenericContainer
|
||||
@end
|
||||
|
||||
@interface WOGenericElement : GSWGenericElement
|
||||
@end
|
||||
|
||||
@interface WOImage : GSWImage
|
||||
@end
|
||||
|
||||
@interface WOImageButton : GSWImageButton
|
||||
@end
|
||||
|
||||
@interface WORadioButton : GSWRadioButton
|
||||
@end
|
||||
|
||||
@interface WORadioButtonList : GSWRadioButtonList
|
||||
@end
|
||||
|
||||
@interface WOHyperlink : GSWHyperlink
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _GSWWOCompatibility_h__
|
||||
|
|
|
@ -229,18 +229,27 @@ static char rcsId[] = "$Id$";
|
|||
@implementation WOFrame
|
||||
@end
|
||||
|
||||
@implementation WOGenericContainer
|
||||
@end
|
||||
|
||||
@implementation WOGenericElement
|
||||
@end
|
||||
|
||||
@implementation WOImage
|
||||
@end
|
||||
|
||||
@implementation WOImageButton
|
||||
@end
|
||||
|
||||
@implementation WORadioButton
|
||||
@end
|
||||
|
||||
@implementation WORadioButtonList
|
||||
@end
|
||||
|
||||
@implementation WOHyperlink
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -175,37 +175,64 @@ const char* GSGetInstanceVariableType(id obj,
|
|||
#if GDL2
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
- (id)getIVarNamed:(NSString *)name_
|
||||
{
|
||||
id value;
|
||||
SEL sel = NSSelectorFromString(@"valueForKey:");
|
||||
id (*imp)(id, SEL, id) = (id (*)(id, SEL, id))[NSObject instanceMethodForSelector: sel];
|
||||
|
||||
//NSLog(@"%@",name_);
|
||||
//NSLog(@"sel (valueForKey <NSObject>) : %d", (int)sel);
|
||||
|
||||
NSLog(@"%@", name_);
|
||||
NS_DURING
|
||||
value = [self valueForKey:name_];
|
||||
//value = [self valueForKey:name_];
|
||||
value = (*imp)(self, sel, name_);
|
||||
NS_HANDLER
|
||||
{
|
||||
if([self respondsToSelector:@selector(objectForKey:)] == YES)
|
||||
value = [self objectForKey:name_];
|
||||
else
|
||||
[localException raise];
|
||||
if([self respondsToSelector:@selector(objectForKey:)] == YES) {
|
||||
if (name_) {
|
||||
value = [self objectForKey:name_];
|
||||
} else {
|
||||
value=nil;
|
||||
}
|
||||
} else {
|
||||
[localException raise];
|
||||
}
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
- (void)setIVarNamed:(NSString *)name_
|
||||
withValue:(id)value_
|
||||
{
|
||||
SEL sel = 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);
|
||||
|
||||
NS_DURING
|
||||
[self takeValue:value_ forKey:name_];
|
||||
//NSLog(@"setIVarNamed : self = %@", NSStringFromClass([self class]));
|
||||
//NSLog(@"setIVarNamed : name_ = %@ (%@)", name_, NSStringFromClass([name_ class]));
|
||||
//NSLog(@"setIVarNamed : value_ = %@ (%@)", value_, NSStringFromClass([value_ class]));
|
||||
//[self takeValue:value_ forKey:name_];
|
||||
(*imp)(self, sel, value_, name_);
|
||||
NS_HANDLER
|
||||
{
|
||||
if([self respondsToSelector:@selector(setObject:forKey:)] == YES)
|
||||
[self setObject:value_ forKey:name_];
|
||||
else
|
||||
[localException raise];
|
||||
if (![name_ isEqualToString:@"self"]) {
|
||||
|
||||
if([self respondsToSelector:@selector(setObject:forKey:)] == YES) {
|
||||
if (value_ && name_) {
|
||||
[self setObject:value_ forKey:name_];
|
||||
}
|
||||
} else {
|
||||
[localException raise];
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
|
@ -412,7 +439,7 @@ void IdToPData(const char* retType,id _value,void* pdata)
|
|||
Class _class=Nil;
|
||||
NSObjectIVarsAccess* _ivarAccess=nil;
|
||||
NSMutableDictionary* _classCache=nil;
|
||||
// LOGObjectFnStart();
|
||||
//LOGObjectFnStart();
|
||||
NSDebugMLLog(@"low",@"getIVarNamed %@ in %p %@ (superClass:%@)",name_,self,[self class],[self superclass]);
|
||||
_class=[self class];
|
||||
_classCache=[objectIVarAccessCache_Get objectForKey:_class];
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
************************************************************************/
|
||||
|
||||
#if defined(unix) || defined(__unix) || defined(__xlC__)
|
||||
#if defined(unix) || defined(__unix) || defined(__xlC__) || defined(__NetBSD__)
|
||||
# define PLATFORM_UNIX
|
||||
#elif defined(WIN32) || defined(_WIN32)
|
||||
# define PLATFORM_WIN32
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
************************************************************************/
|
||||
#define USE_BUILTIN
|
||||
|
||||
#if defined(unix) || defined(__unix) || defined(__xlC__)
|
||||
#if defined(unix) || defined(__unix) || defined(__xlC__) || defined(__NetBSD__)
|
||||
# define PLATFORM_UNIX
|
||||
#elif defined(WIN32) || defined(_WIN32)
|
||||
# define PLATFORM_WIN32
|
||||
|
|
3
README
3
README
|
@ -50,5 +50,8 @@ Special Thanks
|
|||
* Catherine Biscourp <cbiscourp@sbuilders.com> for the
|
||||
GNUstepWeb logos and some other things...
|
||||
|
||||
* David Wetzel <dave@turbocat.de> from Turbocat and Kim Shrier <kim@tinker.com>
|
||||
for patches
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Note: All trademarks mentioned on this server belong to their respective owners.
|
Loading…
Reference in a new issue