2000-08-14 Manuel Guesdon <mguesdon@orange-concept.com>

* GSWeb.framework/GSWApplication.m: added "exit" in terminate
		generate simple response in -handleException:inContext:
		be sure to have a context in -_handleException:inContext:
		generate simple response in  -_handleException:inContext:
		generate simple response in  -handlePageRestorationErrorInContext:
		be sure to have a context in -_handlePageRestorationErrorInContext:
		generate simple response in  -_handlePageRestorationErrorInContext:
		generate simple response in  -handleSessionCreationErrorInContext:
		generate simple response in  -handleSessionRestorationErrorInContext:
		be sure to have a context in -_handleSessionRestorationErrorInContext:
		generate simple response in  -_handleSessionRestorationErrorInContext:
	* GSWeb.framework/GSWComponentRequestHandler.m: added default response when we catch exceptions,...
		handle more exceptions
	* GSWeb.framework/GSWConstants.h/.m: added GSWHTTPHeader_UserAgent
	* GSWeb.framework/GSWDefaultAdaptor.m: terminate application if it is locked
	* GSWeb.framework/GSWDefaultAdaptorThread.m: Added default response to handle exceptions and various errors
		Correct bug in request data reading (request datas were sometimes not complely readen)
	* GSWeb.framework/GSWFileUpload.m: Added Exception handling
	* GSWeb.framework/GSWRequest.m: add exception handling
	* GSWeb.framework/GSWResponse.h/.m: added  GSWResponse (GSWResponseError)
	* GSWAdaptor/Apache/GNUmakefile: added -DEAPI
	* GSWAdaptor/Apache/mod_gsweb.c: added debug traces
	* GSWAdaptor/common/GSWConfig.c/.h: added debug traces, added init parameter
	* Makefile.postamble: added docs generation
	* Doc/GNUstepWeb-HOWTO moved to howto.gsdoc
	* Doc/gsweb.gsdoc: new file
	* GSWeb.framework/Makefile.postamble: added docs generation
	* GSWExtensions.framework/Makefile.postamble: added docs generation
	* GSWExtensionsGSW.framework/Makefile.postamble: added docs generation


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@7244 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2000-08-25 10:36:16 +00:00
parent 4cf01b08f9
commit 77cbf60540
23 changed files with 801 additions and 418 deletions

View file

@ -1,3 +1,35 @@
2000-08-14 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWApplication.m: added "exit" in terminate
generate simple response in -handleException:inContext:
be sure to have a context in -_handleException:inContext:
generate simple response in -_handleException:inContext:
generate simple response in -handlePageRestorationErrorInContext:
be sure to have a context in -_handlePageRestorationErrorInContext:
generate simple response in -_handlePageRestorationErrorInContext:
generate simple response in -handleSessionCreationErrorInContext:
generate simple response in -handleSessionRestorationErrorInContext:
be sure to have a context in -_handleSessionRestorationErrorInContext:
generate simple response in -_handleSessionRestorationErrorInContext:
* GSWeb.framework/GSWComponentRequestHandler.m: added default response when we catch exceptions,...
handle more exceptions
* GSWeb.framework/GSWConstants.h/.m: added GSWHTTPHeader_UserAgent
* GSWeb.framework/GSWDefaultAdaptor.m: terminate application if it is locked
* GSWeb.framework/GSWDefaultAdaptorThread.m: Added default response to handle exceptions and various errors
Correct bug in request data reading (request datas were sometimes not complely readen)
* GSWeb.framework/GSWFileUpload.m: Added Exception handling
* GSWeb.framework/GSWRequest.m: add exception handling
* GSWeb.framework/GSWResponse.h/.m: added GSWResponse (GSWResponseError)
* GSWAdaptor/Apache/GNUmakefile: added -DEAPI
* GSWAdaptor/Apache/mod_gsweb.c: added debug traces
* GSWAdaptor/common/GSWConfig.c/.h: added debug traces, added init parameter
* Makefile.postamble: added docs generation
* Doc/GNUstepWeb-HOWTO moved to howto.gsdoc
* Doc/gsweb.gsdoc: new file
* GSWeb.framework/Makefile.postamble: added docs generation
* GSWExtensions.framework/Makefile.postamble: added docs generation
* GSWExtensionsGSW.framework/Makefile.postamble: added docs generation
2000-08-13 Mirko Viviani <mirko.viviani@rccr.cremona.it>
* GSWDisplayGroup.m: fixed display next and previous batch.

View file

@ -1,182 +0,0 @@
GNUstepWeb HOWTO
****************
GNUstepWeb-HOWTO
Last Update: 05 February 2000
This document explains how to build and manage GNUstepWeb applications.
Copyright (C) 2000 Free Software Foundation, Inc.
Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
This file is part of GNUstepWeb.
Introduction
============
This document explains how to build GNUstepWeb applications, explain
differences from Apple WebObjects and known bug of these libraries.
Project wrapper
===============
Follow these guidelines to maintain your GSWeb application wrapper.
MyApp/ Application wrapper
Main.gswc/ First page requested by GSWeb
Main.html
Main.gswd
MyApp_main.m main() function
Main.m Your Main class code
Main.h Your Main class interface
GNUmakefile
Makefile.preamble
Makefile.postamble
Main.gswa/ Compiled application
Main.debug/ Compiled application with debug support
Makefiles
=========
Debug
=====
In order to debug your application compile it with "gmake debug=yes" and
install with "gmake install debug=yes". You'll find your application in
GNUSTEP_SYSTEM_ROOT/GSWApps/MyApp.debug
Now you can enable debug starting your app with -GSWebDebug=<option>
Options
-------------
dflt
GSWebFn
seriousError
exception
error
gswdync
low
gswcomponents
associations
sessions
bundles
requests
resmanager
options
info
There are two special options: all and most. The following table explain
which options enable.
Options all most
------------- --- ----
dflt x x
GSWebFn x
seriousError x x
exception x x
error x x
gswdync x x
low x
gswcomponents x x
associations x x
sessions x
bundles x
requests x x
resmanager x
options x
info x x
NOTE: GSWeb will search componentes first in GNUSTEP_SYSTEM_ROOT/GSWApps/Myapp.gswa
so before start your debug app remove or update MyApp.gswa wrapper
with "gmake install".
Threaded applications
=====================
By default GSWeb will start your application in Multi Thread mode.
In order to use this facility your libobjc.a must be compiled with thread
support, else you app won't work.
If you don't have ObjC thread support start your app with -GSWMTEnabled NO
WebObjects compatibility
========================
WebScript is not implemented yet, you can only use compiled components.
You must use Objective-C code, at the moment there aren't equivalent
Java classes.
The following table explain suffix differences:
Name WebObjects GSWeb
---- ---------- -----
Application woa gswa
Component wo gswc
Component definition wod gswd
Script wos gsws
Archive woo gswi
Library woso gswso
URL Prefix /WebObjects /GSWeb
Resource request handler wr rr
Component request handler wo cr
Direct request handler wa dr
ObjC classes prefix WO GSW
If you need WO name space compatibility set to 1 GSWEB_NAMES in
GSWeb.framework/GSWConfig.h and recompile all the libraries.
Known bugs
==========
In order to make your application working you can follow these guidelines:
1. Always create an Application and Session class also if you don't use them.
@interface Session:GSWSession
{
}
@end
@interface Application:GSWApplication
{
}
@end
@implementation Session
@end
@implementation Application
@end
2. Start your application with -GSWHost hostname else it will crash.
4. The HTML parser has some problems with percentage fields, eg:
<TABLE WIDTH=100% BORDER="0"> This does NOT work
<TABLE WIDTH="100%" BORDER="0"> This work
Documentation
=============
You can find WebObjects documentation and good tutorials at
http://developer.apple.com/techpubs/enterprise/WebObjects/
----------
WebObjects is a trademark of Apple Computer, Inc.

42
Doc/gsweb.gsdoc Normal file
View file

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
<gsdoc base="gsweb">
<head>
<title>GNUstepWeb Documentation</title>
<author name="Manuel Guesdon">
<email address="mguesdon@orange-concept.com"/>
<url url="http://www.orange-concept.com"/>
<desc></desc>
</author>
<version>0.1</version>
<date>24 august, 2000</date>
<abstract>This documents GNUstepWeb</abstract>
<copy>2000 Free Software Foundation, Inc.</copy>
</head>
<body>
<front>
<contents/>
<chapter>
<heading>Introduction</heading>
<p>GNUstepWeb is a library which was designed to be compatible with <uref url="http://gemma.apple.com/techpubs/webobjects/">WebObjects</uref> 4.x, developed by <uref url="http://www.next.com">NeXT</uref> (now <uref url="http://www.apple.com">Apple</uref>) Inc.</p>
<p>GNUstepWeb web site is <uref url="http://www.gnustepweb.org">here</uref></p>
<p>GNUstepWeb is based on <prjref prjname="gnustep-base">GNUstep</prjref>. GNUstep web site is <uref url="http://www.gnustep.org">here</uref></p>
</chapter>
</front>
<chapter>
<heading>...</heading>
<p></p>
</chapter>
<back>
<!--
<chapter>
<heading>Afterward</heading>
</chapter>
-->
<index type="label"/>
</back>
</body>
</gsdoc>

193
Doc/howto.gsdoc Normal file
View file

@ -0,0 +1,193 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
<gsdoc base="howto">
<head>
<title>GNUstepWeb HOWTO</title>
<author name="Mirko Viviani">
<email address="mirko.viviani@rccr.cremona.it"/>
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
<desc></desc>
</author>
<version>0.1</version>
<date>5 february, 2000</date>
<abstract>This document explains how to build and manage GNUstepWeb applications.</abstract>
<copy>2000 Free Software Foundation, Inc.</copy>
</head>
<body>
<front>
<contents/>
<chapter>
<heading>Introduction</heading>
<p>This document explains how to build GNUstepWeb applications, explain differences from Apple WebObjects and known bug of these libraries.</p>
</chapter>
</front>
<chapter>
<heading>Project wrapper</heading>
<p>Follow these guidelines to maintain your GSWeb application wrapper.</p>
<example>
MyApp/ Application wrapper
Main.gswc/ First page requested by GSWeb
Main.html
Main.gswd
MyApp_main.m main() function
Main.m Your Main class code
Main.h Your Main class interface
GNUmakefile
Makefile.preamble
Makefile.postamble
Main.gswa/ Compiled application
Main.debug/ Compiled application with debug support
</example>
</chapter>
<chapter>
<heading>Makefiles</heading>
<p> </p>
</chapter>
<chapter>
<heading>Debug</heading>
<p>In order to debug your application compile it with "gmake debug=yes" and
install with "gmake install debug=yes". You'll find your application in
GNUSTEP_SYSTEM_ROOT/GSWApps/MyApp.debug</p>
<p>Now you can enable debug starting your app with -GSWebDebug=&#60;option&#62;</p>
<example>
Options
-------------
dflt
GSWebFn
seriousError
exception
error
gswdync
low
gswcomponents
associations
sessions
bundles
requests
resmanager
options
info
</example>
<p>There are two special options: all and most. The following table explain
which options enable.</p>
<example>
Options all most
------------- --- ----
dflt x x
GSWebFn x
seriousError x x
exception x x
error x x
gswdync x x
low x
gswcomponents x x
associations x x
sessions x
bundles x
requests x x
resmanager x
options x
info x x
</example>
<p>
NOTE: GSWeb will search componentes first in GNUSTEP_SYSTEM_ROOT/GSWApps/Myapp.gswa
so before start your debug app remove or update MyApp.gswa wrapper
with "gmake install".</p>
</chapter>
<chapter>
<heading>Threaded applications</heading>
<p>By default GSWeb will start your application in Multi Thread mode.
In order to use this facility your libobjc.a must be compiled with thread
support, else you app won't work.</p>
<p>If you don't have ObjC thread support start your app with -GSWMTEnabled NO</p>
</chapter>
<chapter>
<heading>WebObjects compatibility</heading>
<p>WebScript is not implemented yet, you can only use compiled components.</p>
<p>You must use Objective-C code, at the moment there aren't equivalent Java classes.</p>
<p>The following table explain suffix differences:</p>
<example>
Name WebObjects GSWeb
---- ---------- -----
Application woa gswa
Component wo gswc
Component definition wod gswd
Script wos gsws
Archive woo gswi
Library woso gswso
URL Prefix /WebObjects /GSWeb
Resource request handler wr rr
Component request handler wo cr
Direct request handler wa dr
ObjC classes prefix WO GSW
</example>
<p>If you need WO name space compatibility set to 1 GSWEB_NAMES in
GSWeb.framework/GSWConfig.h and recompile all the libraries.</p>
</chapter>
<chapter>
<heading>Known bugs</heading>
<p>In order to make your application working you can follow these guidelines:</p>
<p>1. Always create an Application and Session class also if you don't use them.</p>
<p>
<code>
@interface Session:GSWSession
{
}
@end
@interface Application:GSWApplication
{
}
@end
@implementation Session
@end
@implementation Application
@end
</code></p>
<p>2. Start your application with -GSWHost hostname else it will crash.</p>
<p>4. The HTML parser has some problems with percentage fields, eg:</p>
<p>
&#60;TABLE WIDTH&#61;100&#37; BORDER&#61;&#34;0&#34;&#62; This does NOT work
&#60;TABLE WIDTH&#61;&#34;100&#37;&#34; BORDER&#61;&#34;0&#34;&#62; This work
</p>
</chapter>
<chapter>
<heading>Documentation</heading>
<p>You can find WebObjects documentation and good tutorials <uref url="http://developer.apple.com/techpubs/enterprise/WebObjects/">here</uref></p>
</chapter>
<chapter>
<heading>Trademarks</heading>
<p>WebObjects is a trademark of Apple Computer, Inc.</p>
</chapter>
<back>
<!--
<chapter>
<heading>Afterward</heading>
</chapter>
-->
<index type="label"/>
</back>
</body>
</gsdoc>

View file

@ -61,7 +61,7 @@ COMMON = $(SRCROOT)/common
INCLUDE = -I$(COMMON) $(APACHEHEADERS)
CFLAGS = -O2 $(RC_CFLAGS) $(INCLUDE) -D$(SERVERAPI) -DREENTRANT
CFLAGS = -O2 $(RC_CFLAGS) $(INCLUDE) -D$(SERVERAPI) -DREENTRANT -DEAPI
all:: $(ADAPTOR)

View file

@ -90,7 +90,11 @@ static void GSWeb_Init(server_rec* p_pServerRec, pool *p)
pConfig=(GSWeb_Config*)ap_get_module_config(p_pServerRec->module_config,
&GSWeb_Module);
GSWLog_Init(NULL,GSW_INFO);
GSWLog(GSW_INFO,p_pServerRec,"GSWeb Init Start Config" GSWEB_HANDLER);
GSWLog(GSW_INFO,p_pServerRec,
"GSWeb Init Start Config. Handler: " GSWEB_HANDLER);
GSWLog(GSW_DEBUG,p_pServerRec,
"GSWeb_Init: pConfig->pszGSWeb=%s",
pConfig->pszGSWeb);
if (pConfig && pConfig->pszConfigPath)
GSWDict_AddStringDup(pDict,
@ -100,10 +104,12 @@ static void GSWeb_Init(server_rec* p_pServerRec, pool *p)
GSWDict_AddStringDup(pDict,
g_szGSWeb_Conf_DocRoot,
pConfig->pszRoot);*/
GSWLog(GSW_INFO,p_pServerRec,"GSWeb Init LB Init" GSWEB_HANDLER);
GSWConfig_Init(pDict);
GSWLog(GSW_INFO,p_pServerRec,
"GSWeb Init LB Init. Handler: " GSWEB_HANDLER);
GSWConfig_Init(pDict,p_pServerRec);
GSWLog(GSW_INFO,p_pServerRec,"GSWeb Init" GSWEB_HANDLER);
GSWLog(GSW_INFO,p_pServerRec,
"GSWeb Init. Handler: " GSWEB_HANDLER);
GSWDict_Free(pDict);
};
@ -114,6 +120,8 @@ static void* GSWeb_CreateConfig(pool* p_pPool,
{
GSWeb_Config *pConfig = (GSWeb_Config*)ap_palloc(p_pPool,sizeof(GSWeb_Config));
pConfig->pszGSWeb = g_szGSWeb_Prefix;
GSWLog(GSW_DEBUG,p_pServerRec,"GSWeb_CreateConfig: pConfig->pszGSWeb=%s",
pConfig->pszGSWeb);
pConfig->pszConfigPath = NULL;
// pConfig->pszRoot = NULL;
return pConfig;
@ -203,7 +211,9 @@ int GSWeb_Translation(request_rec* p_pRequestRec)
GSWLog(GSW_DEBUG,p_pRequestRec->server,"GSWeb_Translation Decliend");
iRetValue=DECLINED;
};
GSWLog(GSW_DEBUG,p_pRequestRec->server,"Stop GSWeb_Translation");
GSWLog(GSW_DEBUG,p_pRequestRec->server,
"Stop GSWeb_Translation return %d",
iRetValue);
return iRetValue;
};

View file

@ -108,8 +108,10 @@ static GSWConfig g_gswConfig;
static char g_szServerStringInfo[1024]="";
static char g_szAdaptorStringInfo[1024]="";
//--------------------------------------------------------------------
void GSWConfig_Init(GSWDict* p_pDict)
void GSWConfig_Init(GSWDict* p_pDict,
void* p_pLogServerData
{
CONST char* pszPath=NULL;
memset(&g_gswConfig,0,sizeof(g_gswConfig));
sprintf(g_szServerStringInfo,"%s v %s built %s",
g_szGSWeb_Server,
@ -120,9 +122,12 @@ void GSWConfig_Init(GSWDict* p_pDict)
g_szAdaptorBuilt);
if (p_pDict)
{
CONST char* pszPath=GSWDict_ValueForKey(p_pDict,g_szGSWeb_Conf_ConfigFilePath);
pszPath=GSWDict_ValueForKey(p_pDict,g_szGSWeb_Conf_ConfigFilePath);
GSWConfig_SetConfigFilePath(pszPath);
};
GSWLog(GSW_INFO,p_pLogServerData,
"GSWeb: GSWConfig_Init: %s %s path: %s",
g_szServerStringInfo,g_szAdaptorStringInfo,pszPath);
GSWLock_Init(g_lockAppList);
};
@ -223,6 +228,9 @@ EGSWConfigResult GSWConfig_ReadIFND(CONST char* p_pszConfigPath,
{
EGSWConfigResult eResult=EGSWConfigResult__Ok;
p_pLogServerData=NULL;//General Log
GSWLog(GSW_DEBUG,p_pLogServerData,
"GSWeb: GSWConfig_ReadIFND: %s",
p_pszConfigPath);
if (!p_pszConfigPath)
{
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWeb: No path for config file.");
@ -607,6 +615,8 @@ BOOL GSWConfig_LoadConfiguration(void* p_pLogServerData)
BOOL fOk=TRUE;
proplist_t propListConfig=NULL;
p_pLogServerData=NULL;
GSWLog(GSW_DEBUG,p_pLogServerData,
"GSWeb: GSWConfig_LoadConfiguration");
GSWLock_Lock(g_lockAppList);
if (!g_pAppDict)
g_pAppDict = GSWDict_New(16);

View file

@ -122,6 +122,8 @@ GSWString* GSWConfig_DumpGSWApps(const char* p_pszReqApp,
BOOL p_fForceDump,
BOOL p_fHTML,
void* p_pLogServerData);
void GSWConfig_Init(GSWDict* p_pDict,
void* p_pLogServerData);
GSWApp* GSWConfig_GetApp(CONST char* p_pszAppName);
CONST char* GSWConfig_AdaptorBuilt();
CONST char* GSWConfig_ServerStringInfo();

View file

@ -48,6 +48,20 @@
# Things to do after uninstalling
# after-uninstall::
autodocs:
echo $($(LIBRARY_NAME)_HEADER_FILES)
mkdir -p Doc/tmp
rm -f Doc/tmp/*
autodoc -allclasses -format html -template /usr/GNUstep/System/Libraries/Resources/DocTemplates/AutoDocTemplate.gsdoc -destination Doc/tmp/ -copyright "Copyright (C) 1999-200 Free Software Foundation, Inc." -define-author-name "Manuel Guesdon" -define-author-email "mguesdon@orange-concept.com" -define-author-desc "Developer" -define-author-url "http://www.gnustep.org/developers/whoiswho.html" -define-dtd-ref "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-0_6_6.dtd" -define-stylesheeturl "http://www.orange-concept.com/styles/default.css" -define-basetitle "GNUstepWeb - GSWExtensions" -define-dtd-url "http://www.gnustep.org/gsdoc-0_6_6.xml" -define-next "[[next]]" -define-prev "[[prev]]" -define-up "[[up]]" $($(LIBRARY_NAME)_HEADER_FILES)
mmv "Doc/tmp/*.html" "Doc/tmp/#1.gsdoc"
mv -f Doc/tmp/*.gsdoc Doc/
gsdocs:
@(cd Doc; \
gsdoc --verbose=1 --makeRefs --makeIndex --makeIndexTemplate=/usr/GNUstep/System/Libraries/Resources/DocTemplates/indextemplate.gsdoc --projectName="GSWExtensions" --refs=../../../ --refs=/usr/local/doc/dev/ --define-version=1.0 --location="/usr/local/doc/dev/test/gsweb/GSWExtensions" --define-stylesheeturl="http://www.orange-concept.com/styles/default.css" --define-basetitle="GNUstepWeb - GSWeb" --define-dtd-url="http://www.gnustep.org/gsdoc-0_6_6.xml" --define-authorName="Manuel Guesdon" --define-author-email="mguesdon@orange-concept.com" --define-authorDesc="Developer" --define-authorURL="http://www.gnustep.org/developers/whoiswho.html" --define-copyright="Copyright (C) 1999-2000 Free Software Foundation, Inc." --define-date="" --define-up="../index" "*.gsdoc" ; \
cd ..; )
# Things to do before cleaning
# before-clean::

View file

@ -43,6 +43,18 @@
# Things to do after installing
# after-install::
autodocs:
echo $($(LIBRARY_NAME)_HEADER_FILES)
mkdir -p Doc/tmp
rm -f Doc/tmp/*
autodoc -allclasses -format html -template /usr/GNUstep/System/Libraries/Resources/DocTemplates/AutoDocTemplate.gsdoc -destination Doc/tmp/ -copyright "Copyright (C) 1999-200 Free Software Foundation, Inc." -define-author-name "Manuel Guesdon" -define-author-email "mguesdon@orange-concept.com" -define-author-desc "Developer" -define-author-url "http://www.gnustep.org/developers/whoiswho.html" -define-dtd-ref "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-0_6_6.dtd" -define-stylesheeturl "http://www.orange-concept.com/styles/default.css" -define-basetitle "GNUstepWeb - GSWExtensionsGSW" -define-dtd-url "http://www.gnustep.org/gsdoc-0_6_6.xml" -define-next "[[next]]" -define-prev "[[prev]]" -define-up "[[up]]" $($(LIBRARY_NAME)_HEADER_FILES)
mmv "Doc/tmp/*.html" "Doc/tmp/#1.gsdoc"
mv -f Doc/tmp/*.gsdoc Doc/
gsdocs:
@(cd Doc; \
gsdoc --GNU-Debug=dflt --verbose=1 --makeRefs --makeIndex --makeIndexTemplate=/usr/GNUstep/System/Libraries/Resources/DocTemplates/indextemplate.gsdoc --projectName="GSWExtensionsGSW" --refs=../../ --refs=/usr/local/doc/dev/ --define-version=1.0 --location="/usr/local/doc/dev/test/gsweb/GSWExtensionsGSW" --define-stylesheeturl="http://www.orange-concept.com/styles/default.css" --define-basetitle="GNUstepWeb - GSWeb" --define-dtd-url="http://www.gnustep.org/gsdoc-0_6_6.xml" --define-authorName="Manuel Guesdon" --define-author-email="mguesdon@orange-concept.com" --define-authorDesc="Developer" --define-authorURL="http://www.gnustep.org/developers/whoiswho.html" --define-copyright="Copyright (C) 1999-2000 Free Software Foundation, Inc." --define-date="" --define-up="../index" "*.gsdoc" ; \
cd ..; )
# Things to do before uninstalling
# before-uninstall::

View file

@ -422,7 +422,7 @@ extern NSString* globalApplicationClassName;
//====================================================================
@interface GSWApplication (GSWStatisticsSupport)
-(void)setStatisticsStore:(GSWStatisticsStore*)statisticsStore_;
-(/*bycopy*/NSDictionary*)statistics;
-(NSDictionary*)statistics;//bycopy
-(GSWStatisticsStore*)statisticsStore;
@end

View file

@ -1510,6 +1510,7 @@ int GSWApplicationMain(NSString* _applicationClassName,
-(void)_terminateFromMonitor
{
LOGObjectFnNotImplemented(); //TODOFN
exit;
};
@end
@ -2233,6 +2234,10 @@ int GSWApplicationMain(NSString* _applicationClassName,
[self _resetCache];
NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore);
};
if (!_response)
{
//TODO RESPONSE_PB
};
LOGObjectFnStop();
return _response;
};
@ -2341,11 +2346,12 @@ int GSWApplicationMain(NSString* _applicationClassName,
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _handleException:inContext:");
LOGException(@"exception=%@",localException);
//TODO
//Generate simple response !
_response=[GSWResponse responseWithMessage:@"Exception Handling failed"
inContext:context_
forRequest:nil];
}
NS_ENDHANDLER;
NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication handleException: _finalizeInContext called for GSWResponse");
LOGObjectFnStop();
return _response;
};
@ -2368,7 +2374,13 @@ int GSWApplicationMain(NSString* _applicationClassName,
{
LOGError0(@"No context !");
_context=[GSWContext contextWithRequest:nil];
LOGError0(@"Really can't get context !");
};
//TODO Hack: verify that there is an application context otherswise, it failed in component Creation
if (![self _context])
{
[self _setContext:_context];
};
_resourceManager=[self resourceManager];
if ([_resourceManager pathForResourceNamed:_exceptionPage
inFramework:GSWFramework_extensions
@ -2402,8 +2414,12 @@ int GSWApplicationMain(NSString* _applicationClassName,
}
else
{
//TODO can't find exception page !
LOGError0(@"Can't find exception page");
_response=[GSWResponse responseWithMessage:@"Exception Handling failed. Can't find Exception Page"
inContext:_context
forRequest:nil];
};
NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication _handleException: _finalizeInContext called for GSWResponse");
LOGObjectFnStop();
return _response;
};
@ -2422,10 +2438,12 @@ int GSWApplicationMain(NSString* _applicationClassName,
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _handlePageRestorationErrorInContext:");
LOGException(@"exception=%@",localException);
//TODO
//Generate simple response !
_response=[GSWResponse responseWithMessage:@"Exception Handling failed. Can't find Page Restoration Error Page"
inContext:context_
forRequest:nil];
}
NS_ENDHANDLER;
NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication handlePageRestorationErrorInContext: _finalizeInContext called for GSWResponse");
LOGObjectFnStop();
return _response;
};
@ -2448,7 +2466,13 @@ int GSWApplicationMain(NSString* _applicationClassName,
{
LOGError0(@"No context !");
_context=[GSWContext contextWithRequest:nil];
LOGError0(@"Really can't get context !");
};
//TODO Hack: verify that there is an application context otherswise, it failed in component Creation
if (![self _context])
{
[self _setContext:_context];
};
_resourceManager=[self resourceManager];
NSDebugMLLog0(@"low",@"GSWComponentRequestHandler _dispatchWithPreparedSession no page");
if ([_resourceManager pathForResourceNamed:_restorationErrorPage
@ -2475,8 +2499,11 @@ int GSWApplicationMain(NSString* _applicationClassName,
_response=[_errorPage generateResponse];
else
{
//TODO
_response=[GSWResponse responseWithMessage:@"Exception Handling failed. Can't find Page Restoration Error Page"
inContext:_context
forRequest:nil];
};
NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication _handlePageRestorationErrorInContext: _finalizeInContext called for GSWResponse");
LOGObjectFnStop();
return _response;
};
@ -2495,10 +2522,12 @@ int GSWApplicationMain(NSString* _applicationClassName,
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _handleSessionCreationErrorInContext:");
LOGException(@"exception=%@",localException);
//TODO
//Generate simple response !
_response=[GSWResponse responseWithMessage:@"Session Creation Error Handling failed."
inContext:context_
forRequest:nil];
}
NS_ENDHANDLER;
NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication handleSessionCreationErrorInContext: _finalizeInContext called for GSWResponse");
LOGObjectFnStop();
return _response;
};
@ -2526,10 +2555,12 @@ int GSWApplicationMain(NSString* _applicationClassName,
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _handleSessionRestorationErrorInContext:");
LOGException(@"exception=%@",localException);
//TODO
//Generate simple response !
_response=[GSWResponse responseWithMessage:@"Session Restoration Error Handling failed."
inContext:context_
forRequest:nil];
}
NS_ENDHANDLER;
NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication handleSessionRestorationErrorInContext: _finalizeInContext called for GSWResponse");
LOGObjectFnStop();
return _response;
};
@ -2553,7 +2584,13 @@ int GSWApplicationMain(NSString* _applicationClassName,
{
LOGError0(@"No context !");
_context=[GSWContext contextWithRequest:nil];
LOGError0(@"Really can't get context !");
};
//TODO Hack: verify that there is an application context otherswise, it failed in component Creation
if (![self _context])
{
[self _setContext:_context];
};
_resourceManager=[self resourceManager];
if ([_resourceManager pathForResourceNamed:_sessionRestorationErrorPage
inFramework:GSWFramework_extensions
@ -2579,8 +2616,11 @@ int GSWApplicationMain(NSString* _applicationClassName,
_response=[_errorPage generateResponse];
else
{
//TODO
_response=[GSWResponse responseWithMessage:@"Session Restoration Error Handling failed."
inContext:_context
forRequest:nil];
};
NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication _handleSessionRestorationErrorInContext: _finalizeInContext called for GSWResponse");
LOGObjectFnStart();
return _response;
};
@ -2721,7 +2761,7 @@ int GSWApplicationMain(NSString* _applicationClassName,
//--------------------------------------------------------------------
-(void)debugWithFormat:(NSString*)format_,...
{
va_list ap;
va_list ap=NULL;
va_start(ap,format_);
[self debugWithFormat:format_
arguments:ap];
@ -2731,7 +2771,7 @@ int GSWApplicationMain(NSString* _applicationClassName,
//--------------------------------------------------------------------
+(void)debugWithFormat:(NSString*)format_,...
{
va_list ap;
va_list ap=NULL;
va_start(ap,format_);
[GSWApp debugWithFormat:format_
arguments:ap];
@ -2749,7 +2789,7 @@ int GSWApplicationMain(NSString* _applicationClassName,
//--------------------------------------------------------------------
-(void)logWithFormat:(NSString*)format_,...
{
va_list ap;
va_list ap=NULL;
va_start(ap,format_);
[self logWithFormat:format_
arguments:ap];
@ -2759,7 +2799,7 @@ int GSWApplicationMain(NSString* _applicationClassName,
//--------------------------------------------------------------------
+(void)logWithFormat:(NSString*)format_,...
{
va_list ap;
va_list ap=NULL;
va_start(ap,format_);
[GSWApp logWithFormat:format_
arguments:ap];
@ -2780,7 +2820,7 @@ int GSWApplicationMain(NSString* _applicationClassName,
//--------------------------------------------------------------------
-(void)logErrorWithFormat:(NSString*)format_,...
{
va_list ap;
va_list ap=NULL;
va_start(ap,format_);
[self logErrorWithFormat:format_
arguments:ap];
@ -2790,7 +2830,7 @@ int GSWApplicationMain(NSString* _applicationClassName,
//--------------------------------------------------------------------
+(void)logErrorWithFormat:(NSString*)format_,...
{
va_list ap;
va_list ap=NULL;
va_start(ap,format_);
[GSWApp logErrorWithFormat:format_
arguments:ap];

View file

@ -37,6 +37,13 @@ static char rcsId[] = "$Id$";
LOGObjectFnStart();
[_application lockRequestHandling];
_response=[self lockedHandleRequest:request_];
if (!_response)
{
_response=[GSWResponse responseWithMessage:@"Component Handle request failed"
inContext:nil
forRequest:request_];
[_response _finalizeInContext:nil]; //DO Call _finalizeInContext: !
};
[_application unlockRequestHandling];
NSDebugMLLog(@"requests",@"_response=%@",_response);
LOGObjectFnStop();
@ -53,57 +60,84 @@ static char rcsId[] = "$Id$";
GSWResponse* _response=nil;
NSDictionary* _requestHandlerValues=nil;
NSString* _senderID=nil;
BOOL _exceptionRaised=NO;
LOGObjectFnStart();
_requestHandlerValues=[GSWComponentRequestHandler _requestHandlerValuesForRequest:request_];
NSDebugMLLog(@"requests",@"_requestHandlerValues=%@",_requestHandlerValues);
_statisticsStore=[[GSWApplication application]statisticsStore];
NSDebugMLLog(@"requests",@"_statisticsStore=%@",_statisticsStore);
[_statisticsStore _applicationWillHandleComponentActionRequest];
_context=[GSWContext contextWithRequest:request_];
_senderID=[_requestHandlerValues objectForKey:GSWKey_ElementID];
NSDebugMLLog(@"requests",@"AA _senderID=%@",_senderID);
[_context _setSenderID:_senderID];
[_application _setContext:_context];
NS_DURING
{
[_application awake];
_response=[self lockedDispatchWithPreparedApplication:_application
inContext:_context
elements:_requestHandlerValues];
}
{
_requestHandlerValues=[GSWComponentRequestHandler _requestHandlerValuesForRequest:request_];
}
NS_HANDLER
{
LOGException(@"%@ (%@)",
localException,
[localException reason]);
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In lockedDispatchWithPreparedApplication");
LOGException(@"exception=%@",localException);
_response=[_application handleException:localException
inContext:_context];
[_application sleep];
// [_response _finalizeInContext:_context];
NSAssert(!_response || [_response isFinalizeInContextHasBeenCalled],@"_finalizeInContext not called for GSWResponse");
};
{
_exceptionRaised=YES;
LOGException(@"%@ (%@)",
localException,
[localException reason]);
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In -lockedHandleRequest:");
LOGException(@"exception=%@",localException);
[_application awake];
_response=[_application handleException:localException
inContext:nil];
[_application sleep];
[_response _finalizeInContext:_context];//DO Call _finalizeInContext: !
NSAssert(!_response || [_response isFinalizeInContextHasBeenCalled],@"_finalizeInContext not called for GSWResponse");
};
NS_ENDHANDLER;
NS_DURING
{
[_application sleep];
[_response _finalizeInContext:_context];
}
NS_HANDLER
{
LOGException(@"%@ (%@)",
localException,
[localException reason]);
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"In [application sleep] or [_response _finalizeInContext:_context]");
LOGException(@"exception=%@",localException);
_response=[_application handleException:localException
inContext:nil];
// [_response _finalizeInContext:_context];
NSAssert(!_response || [_response isFinalizeInContextHasBeenCalled],@"_finalizeInContext not called for GSWResponse");
if (!_exceptionRaised)
{
NSDebugMLLog(@"requests",@"_requestHandlerValues=%@",_requestHandlerValues);
_statisticsStore=[[GSWApplication application]statisticsStore];
NSDebugMLLog(@"requests",@"_statisticsStore=%@",_statisticsStore);
[_statisticsStore _applicationWillHandleComponentActionRequest];
_context=[GSWContext contextWithRequest:request_];
_senderID=[_requestHandlerValues objectForKey:GSWKey_ElementID];
NSDebugMLLog(@"requests",@"AA _senderID=%@",_senderID);
[_context _setSenderID:_senderID];
[_application _setContext:_context];
NS_DURING
{
[_application awake];
_response=[self lockedDispatchWithPreparedApplication:_application
inContext:_context
elements:_requestHandlerValues];
}
NS_HANDLER
{
_exceptionRaised=YES;
LOGException(@"%@ (%@)",
localException,
[localException reason]);
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In lockedDispatchWithPreparedApplication");
LOGException(@"exception=%@",localException);
_response=[_application handleException:localException
inContext:_context];
[_application sleep];
[_response _finalizeInContext:_context]; //DO Call _finalizeInContext: !
NSAssert(!_response || [_response isFinalizeInContextHasBeenCalled],@"_finalizeInContext not called for GSWResponse");
};
NS_ENDHANDLER;
if (!_exceptionRaised)
{
NS_DURING
{
[_application sleep];
[_response _finalizeInContext:_context];
}
NS_HANDLER
{
LOGException(@"%@ (%@)",
localException,
[localException reason]);
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"In [application sleep] or [_response _finalizeInContext:_context]");
LOGException(@"exception=%@",localException);
_response=[_application handleException:localException
inContext:nil];
[_response _finalizeInContext:_context]; //DO Call _finalizeInContext: !
NSAssert(!_response || [_response isFinalizeInContextHasBeenCalled],@"_finalizeInContext not called for GSWResponse");
};
NS_ENDHANDLER;
};
};
NS_ENDHANDLER;
[_application _setContext:nil];
_statisticsStore=[[GSWApplication application] statisticsStore];
[_statisticsStore _applicationDidHandleComponentActionRequest];
@ -460,7 +494,20 @@ static char rcsId[] = "$Id$";
//OK
NSDictionary* _values=nil;
LOGClassFnStart();
_values=[request_ uriOrFormOrCookiesElements];
NS_DURING
{
_values=[request_ uriOrFormOrCookiesElements];
}
NS_HANDLER
{
LOGException(@"%@ (%@)",
localException,
[localException reason]);
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In +_requestHandlerValuesForRequest:");
LOGException(@"exception=%@",localException);
[localException raise];
};
NS_ENDHANDLER;
LOGClassFnStop();
return _values;
};

View file

@ -120,6 +120,7 @@ extern NSString* GSWHTTPHeader_FormURLEncoded;
extern NSString* GSWHTTPHeader_MultipartFormData;
extern NSString* GSWHTTPHeader_ContentLength;
extern NSString* GSWHTTPHeader_MimeType_TextPlain;
extern NSString* GSWHTTPHeader_UserAgent;
extern NSString* GSWHTTPHeader_Response_OK;
extern NSString* GSWHTTPHeader_Response_HeaderLineEnd;

View file

@ -179,6 +179,7 @@ NSString* GSWHTTPHeader_ContentType=@"content-type";
NSString* GSWHTTPHeader_FormURLEncoded=@"application/x-www-form-urlencoded";
NSString* GSWHTTPHeader_MultipartFormData=@"multipart/form-data";
NSString* GSWHTTPHeader_MimeType_TextPlain=@"text/plain";
NSString* GSWHTTPHeader_UserAgent=@"User-Agent";
NSString* GSWHTTPHeader_ContentLength=@"content-length";

View file

@ -401,6 +401,7 @@ static char rcsId[] = "$Id$";
{
pool=[NSAutoreleasePool new];
LOGSeriousError0(@"Application RequestHandling is LOCKED !!!");
[[GSWApplication application] terminate];
DESTROY(pool);
};
};

View file

@ -182,7 +182,10 @@ static char rcsId[] = "$Id$";
NS_ENDHANDLER;
if (!response)
{
//TODO
response=[GSWResponse responseWithMessage:@"Application returned no response"
inContext:nil
forRequest:request];
[response _finalizeInContext:nil]; //DO Call _finalizeInContext: !
};
if (response)
{
@ -324,6 +327,9 @@ static char rcsId[] = "$Id$";
}
else
{
#define REQUEST_METHOD__UNKNOWN 0
#define REQUEST_METHOD__GET 1
#define REQUEST_METHOD__POST 2
NSMutableData* _pendingData=nil;
NSDate* maxDate=[NSDate dateWithTimeIntervalSinceNow:360]; //360s
NSData* dataBlock=nil;
@ -333,11 +339,14 @@ static char rcsId[] = "$Id$";
int dataBytesNb=0;
int dataBlockLength=0;
int contentLength=-1;
int _requestMethod=REQUEST_METHOD__UNKNOWN;
BOOL _isRequestLineSetted=NO;
BOOL _isDataStep=NO;
BOOL _isAllDataReaden=NO;
BOOL _isElapsed=NO;
NSMutableDictionary* _headers=nil;
NSString* _userAgent=nil;
NSString* _remoteAddr=nil;
NSDebugMLog0(@"dataBlock try reading");
do
{
@ -404,6 +413,21 @@ static char rcsId[] = "$Id$";
};
if ([_key isEqualToString:GSWHTTPHeader_ContentLength])
contentLength=[_value intValue];
else if ([_key isEqualToString:GSWHTTPHeader_Method])
{
if ([_value isEqualToString:GSWHTTPHeader_MethodPost])
_requestMethod=REQUEST_METHOD__POST;
else if ([_value isEqualToString:GSWHTTPHeader_MethodGet])
_requestMethod=REQUEST_METHOD__GET;
else
{
NSAssert1(NO,@"Unknwon method %@",_value);
};
}
else if ([_key isEqualToString:GSWHTTPHeader_UserAgent])
_userAgent=_value;
else if ([_key isEqualToString:GSWHTTPHeader_RemoteAddress])
_remoteAddr=_value;
_prevValue=[_headers objectForKey:_key];
NSDebugMLLog(@"low",@"_prevValue:%@",_prevValue);
if (_prevValue)
@ -419,9 +443,15 @@ static char rcsId[] = "$Id$";
};
};
};
if (_isDataStep && (contentLength<0 || readenBytesNb>=contentLength))
_isAllDataReaden=YES;
else
dataBytesNb=[_pendingData length];
if (_isDataStep)
{
if (_requestMethod==REQUEST_METHOD__GET)
_isAllDataReaden=YES;
else if (_requestMethod==REQUEST_METHOD__POST)
_isAllDataReaden=(dataBytesNb>=contentLength);
};
if (!_isAllDataReaden)
{
_isElapsed=[[NSDate date]compare:maxDate]==NSOrderedDescending;
if (!_isElapsed)
@ -431,13 +461,15 @@ static char rcsId[] = "$Id$";
};
};
} while (!_isAllDataReaden && !_isElapsed);
NSDebugMLLog(@"info",@"GSWDefaultAdaptor: _isAllDataReaden=%s _isElapsed=%s readenBytesNb=%d contentLength=%d dataBytesNb=%d headersBytesNb=%d",
_isAllDataReaden ? "YES" : "NO",
_isElapsed ? "YES" : "NO",
readenBytesNb,
contentLength,
dataBytesNb,
headersBytesNb);
NSDebugMLog(@"GSWDefaultAdaptor: _userAgent=%@ _remoteAddr=%@ _isAllDataReaden=%s _isElapsed=%s readenBytesNb=%d contentLength=%d dataBytesNb=%d headersBytesNb=%d",
_userAgent,
_remoteAddr,
_isAllDataReaden ? "YES" : "NO",
_isElapsed ? "YES" : "NO",
readenBytesNb,
contentLength,
dataBytesNb,
headersBytesNb);
ok=_isAllDataReaden;
if (_isAllDataReaden)
{

View file

@ -117,53 +117,70 @@ static char rcsId[] = "$Id$";
NSString* _fileName=nil;
NSData* _data=nil;
int _fileDatasCount=0;
_component=[context_ component];
_nameInContext=[self nameInContext:context_];
NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext);
_fileDatas=[request_ formValuesForKey:_nameInContext];
NSDebugMLLog(@"gswdync",@"_value=%@",_fileDatas);
_fileDatasCount=[_fileDatas count];
NSAssert1(_fileDatasCount==1,@"File Data Nb != 1 :%d",_fileDatasCount);
_data=[_fileDatas objectAtIndex:0];
if (_data)
{
if ([_data isKindOfClass:[NSData class]])
NS_DURING
{
_component=[context_ component];
_nameInContext=[self nameInContext:context_];
NSDebugMLLog(@"gswdync",@"_nameInContext=%@",_nameInContext);
_fileDatas=[request_ formValuesForKey:_nameInContext];
NSDebugMLLog(@"gswdync",@"_value=%@",_fileDatas);
_fileDatasCount=[_fileDatas count];
if (_fileDatasCount!=1)
{
if ([_data length]==0)
ExceptionRaise(@"GSWFileUpload",
@"GSWFileUpload: File Data Nb != 1 :%d",
_fileDatasCount);
};
_data=[_fileDatas objectAtIndex:0];
if (_data)
{
if ([_data isKindOfClass:[NSData class]])
{
LOGError(@"Empty Data: %@",_data);
if ([_data length]==0)
{
LOGError(@"Empty Data: %@",_data);
};
}
else
{
if ([_data isKindOfClass:[NSString class]] && [_data length]==0)
{
LOGError(@"No Data: %@",_data);
_data=nil;
}
else
{
ExceptionRaise(@"GSWFileUpload",
@"GSWFileUpload: bad data :%@",
_data);
_data=nil;
};
};
}
else
{
if ([_data isKindOfClass:[NSString class]] && [_data length]==0)
{
LOGError(@"No Data: %@",_data);
_data=nil;
}
else
{
NSAssert1(NO,@"Bad Data:%@",_data);
_data=nil;
};
LOGError0(@"No Data:");
};
}
else
{
LOGError0(@"No Data:");
};
fileNameFormValueName=[NSString stringWithFormat:@"%@.filename",_nameInContext];
NSDebugMLLog(@"gswdync",@"fileNameFormValueName=%@",fileNameFormValueName);
_fileName=[request_ formValueForKey:fileNameFormValueName];
NSDebugMLLog(@"gswdync",@"_fileName=%@",_fileName);
if (!_fileName || [_fileName length]==0)
{
LOGError(@"No fileName: %@",_fileName);
};
[filepath setValue:_fileName
fileNameFormValueName=[NSString stringWithFormat:@"%@.filename",_nameInContext];
NSDebugMLLog(@"gswdync",@"fileNameFormValueName=%@",fileNameFormValueName);
_fileName=[request_ formValueForKey:fileNameFormValueName];
NSDebugMLLog(@"gswdync",@"_fileName=%@",_fileName);
if (!_fileName || [_fileName length]==0)
{
LOGError(@"No fileName: %@",_fileName);
};
[filepath setValue:_fileName
inComponent:_component];
[data setValue:_data
inComponent:_component];
[data setValue:_data
inComponent:_component];
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"GSWFileUpload in takeValuesFromRequest");
LOGException(@"%@ (%@)",localException,[localException reason]);
[localException raise];
};
NS_ENDHANDLER;
};
};
LOGObjectFnStopC("GSWFileUpload");

View file

@ -401,7 +401,17 @@ method=%@, uri=%@, httpVersion=%@, headers=%@, content=%@, userInfo=%@, defaultF
NSDictionary* _formValues=nil;
NSArray* _formValueKeys=nil;
LOGObjectFnStart();
_formValues=[self _formValues];
NS_DURING
{
_formValues=[self _formValues];
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"GSWRequest _formValues");
LOGException(@"%@ (%@)",localException,[localException reason]);
[localException raise];
};
NS_ENDHANDLER;
_formValueKeys=[_formValues allKeys];
LOGObjectFnStop();
return _formValueKeys;
@ -415,7 +425,17 @@ method=%@, uri=%@, httpVersion=%@, headers=%@, content=%@, userInfo=%@, defaultF
NSArray* _formValuesForKey=nil;
NSDictionary* _formValues=nil;
LOGObjectFnStart();
_formValues=[self _formValues];
NS_DURING
{
_formValues=[self _formValues];
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"GSWRequest _formValues");
LOGException(@"%@ (%@)",localException,[localException reason]);
[localException raise];
};
NS_ENDHANDLER;
_formValuesForKey=[_formValues objectForKey:key_];
LOGObjectFnStop();
return _formValuesForKey;
@ -447,7 +467,17 @@ method=%@, uri=%@, httpVersion=%@, headers=%@, content=%@, userInfo=%@, defaultF
{
NSDictionary* _formValues=nil;
LOGObjectFnStart();
_formValues=[self _formValues];
NS_DURING
{
_formValues=[self _formValues];
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"GSWRequest _formValues");
LOGException(@"%@ (%@)",localException,[localException reason]);
[localException raise];
};
NS_ENDHANDLER;
LOGObjectFnStop();
return _formValues;
};
@ -982,124 +1012,143 @@ method=%@, uri=%@, httpVersion=%@, headers=%@, content=%@, userInfo=%@, defaultF
_contentTypeCount=[_contentTypes count];
NSDebugMLLog(@"requests",@"_contentTypes=%@",_contentTypes);
_content=[self content];
for(_contentTypeIndex=0;_contentTypeIndex<_contentTypeCount;_contentTypeIndex++)
{
NSDictionary* _parsedContentType=nil;
NSString* _boundary=nil;
NSArray* _decodedParts=nil;
int _decodedPartIndex=0;
int _decodedPartCount=0;
// get "multipart/form-data; boundary=---------------------------1810101926251"
_contentType=[_contentTypes objectAtIndex:_contentTypeIndex];
NSDebugMLLog(@"requests",@"_contentType=%@",_contentType);
// convert it into
// {
// boundary = "---------------------------1810101926251";
// "multipart/form-data" = "multipart/form-data";
// }
_parsedContentType=[self _parseOneHeader:_contentType];
NSDebugMLLog(@"requests",@"_parsedContentType=%@",_parsedContentType);
_boundary=[_parsedContentType objectForKey:@"boundary"];
NSDebugMLLog(@"requests",@"_boundary=%@",_boundary);
NSAssert1(_boundary,@"No boundary in %@",_parsedContentType);
NSDebugMLLog(@"requests",@"_content=%@",_content);
_decodedParts=[self _decodeMultipartBody:_content
boundary:_boundary];
NSDebugMLLog(@"requests",@"_decodedParts=%@",_decodedParts);
_decodedPartIndex=0;
_decodedPartCount=[_decodedParts count];
for(_decodedPartIndex=0;_decodedPartIndex<_decodedPartCount;_decodedPartIndex++)
NS_DURING
{
for(_contentTypeIndex=0;_contentTypeIndex<_contentTypeCount;_contentTypeIndex++)
{
NSData* _decodedPart=nil;
NSArray* _parsedParts=nil;
int _parsedPartsCount=0;
_decodedPart=[_decodedParts objectAtIndex:_decodedPartIndex];
NSDebugMLLog(@"requests",@"_decodedPart=%@",_decodedPart);
_parsedParts=[self _parseData:_decodedPart];
NSDebugMLLog(@"requests",@"_parsedParts=%@",_parsedParts);
//return :
// (
// {
// "content-disposition" = "form-data; name=\"9.1\"; filename=\"C:\\TEMP\\zahn.txt\"";
// "content-type" = text/plain;
// },
// <41514541 41415177 4d444179 666f3054 6c4e2b58 58684357 69314b50 51635159 73573677 426d336f 52617247 36584633 4c7a6455 5637664e 39654b6b 764b4a43 71715059 67417250 59374863 78397944 36506b66 774a7550 465a4141 2f303463 446c5072 48525670 537a4135 67664738 62364572 44314158 372b7067 734c5075 304b4d77 0d0a0d0a >
// )
_parsedPartsCount=[_parsedParts count];
if (_parsedPartsCount==0)
NSDictionary* _parsedContentType=nil;
NSString* _boundary=nil;
NSArray* _decodedParts=nil;
int _decodedPartIndex=0;
int _decodedPartCount=0;
// get "multipart/form-data; boundary=---------------------------1810101926251"
_contentType=[_contentTypes objectAtIndex:_contentTypeIndex];
NSDebugMLLog(@"requests",@"_contentType=%@",_contentType);
// convert it into
// {
// boundary = "---------------------------1810101926251";
// "multipart/form-data" = "multipart/form-data";
// }
_parsedContentType=[self _parseOneHeader:_contentType];
NSDebugMLLog(@"requests",@"_parsedContentType=%@",_parsedContentType);
_boundary=[_parsedContentType objectForKey:@"boundary"];
NSDebugMLLog(@"requests",@"_boundary=%@",_boundary);
NSAssert1(_boundary,@"No boundary in %@",_parsedContentType);
NSDebugMLLog(@"requests",@"_content=%@",_content);
_decodedParts=[self _decodeMultipartBody:_content
boundary:_boundary];
NSDebugMLLog(@"requests",@"_decodedParts=%@",_decodedParts);
_decodedPartIndex=0;
_decodedPartCount=[_decodedParts count];
for(_decodedPartIndex=0;_decodedPartIndex<_decodedPartCount;_decodedPartIndex++)
{
//TODO error
}
else
{
NSDictionary* _partInfo=nil;
NSString* _parsedPartsContentType=nil;
NSString* _parsedPartsContentDisposition=nil;
NSDictionary* _parsedContentDispositionOfParsedPart=nil;
NSEnumerator* _enum=nil;
NSString* _name=nil;
NSString* _dscrKey=nil;
id _descrValue=nil;
NSData* _decodedPart=nil;
NSArray* _parsedParts=nil;
int _parsedPartsCount=0;
_partInfo=[_parsedParts objectAtIndex:0];
NSDebugMLLog(@"requests",@"_partInfo=%@",_partInfo);
NSAssert1([_partInfo isKindOfClass:[NSDictionary class]],@"partInfo %@ is not a dictionary",_partInfo);
_parsedPartsContentType=[[_partInfo objectForKey:GSWHTTPHeader_ContentType] lowercaseString];
NSDebugMLLog(@"requests",@"_parsedPartsContentType=%@",_parsedPartsContentType);
_parsedPartsContentDisposition=[_partInfo objectForKey:@"content-disposition"];
NSDebugMLLog(@"requests",@"_parsedPartsContentDisposition=%@",_parsedPartsContentDisposition);
//Convert: "form-data; name=\"9.1\"; filename=\"C:\\TEMP\\zahn.txt\"";
// into: {filename = "C:\\TEMP\\zahn.txt"; "form-data" = "form-data"; name = 9.1; }
_parsedContentDispositionOfParsedPart=[self _parseOneHeader:_parsedPartsContentDisposition];
NSDebugMLLog(@"requests",@"_parsedContentDispositionOfParsedPart=%@",_parsedContentDispositionOfParsedPart);
_enum=[_parsedContentDispositionOfParsedPart keyEnumerator];
_name=[_parsedContentDispositionOfParsedPart objectForKey:@"name"];
NSDebugMLLog(@"requests",@"_name=%@",_name);
NSAssert1(_name,@"No name in %@",_parsedContentDispositionOfParsedPart);
while((_dscrKey=[_enum nextObject]))
_decodedPart=[_decodedParts objectAtIndex:_decodedPartIndex];
NSDebugMLLog(@"requests",@"_decodedPart=%@",_decodedPart);
_parsedParts=[self _parseData:_decodedPart];
NSDebugMLLog(@"requests",@"_parsedParts=%@",_parsedParts);
//return :
// (
// {
// "content-disposition" = "form-data; name=\"9.1\"; filename=\"C:\\TEMP\\zahn.txt\"";
// "content-type" = text/plain;
// },
// <41514541 41415177 4d444179 666f3054 6c4e2b58 58684357 69314b50 51635159 73573677 426d336f 52617247 36584633 4c7a6455 5637664e 39654b6b 764b4a43 71715059 67417250 59374863 78397944 36506b66 774a7550 465a4141 2f303463 446c5072 48525670 537a4135 67664738 62364572 44314158 372b7067 734c5075 304b4d77 0d0a0d0a >
// )
_parsedPartsCount=[_parsedParts count];
if (_parsedPartsCount==0)
{
NSDebugMLLog(@"requests",@"_dscrKey=%@",_dscrKey);
if (![_dscrKey isEqualToString:@"name"] && ![_dscrKey isEqualToString:@"form-data"])
{
NSString* _key=nil;
_descrValue=[_parsedContentDispositionOfParsedPart objectForKey:_dscrKey];
NSDebugMLLog(@"requests",@"_descrValue=%@",_descrValue);
_key=[NSString stringWithFormat:@"%@.%@",_name,_dscrKey];
NSDebugMLLog(@"requests",@"_key=%@",_key);
[_formValues setObject:[NSArray arrayWithObject:_descrValue]
forKey:_key];
};
};
if (_parsedPartsCount>1)
LOGError(@"_parsedPartsCount==0 _decodedPart=%@",_decodedPart);
//TODO error
}
else
{
NSArray* _values=[_parsedParts subarrayWithRange:NSMakeRange(1,[_parsedParts count]-1)];
NSMutableArray* _valuesNew=[NSMutableArray array];
NSDebugMLLog(@"requests",@"_values=%@",_values);
NSDictionary* _partInfo=nil;
NSString* _parsedPartsContentType=nil;
NSString* _parsedPartsContentDisposition=nil;
NSDictionary* _parsedContentDispositionOfParsedPart=nil;
NSEnumerator* _enum=nil;
NSString* _name=nil;
NSString* _dscrKey=nil;
id _descrValue=nil;
_partInfo=[_parsedParts objectAtIndex:0];
NSDebugMLLog(@"requests",@"_partInfo=%@",_partInfo);
NSAssert1([_partInfo isKindOfClass:[NSDictionary class]],@"partInfo %@ is not a dictionary",_partInfo);
_parsedPartsContentType=[[_partInfo objectForKey:GSWHTTPHeader_ContentType] lowercaseString];
NSDebugMLLog(@"requests",@"_parsedPartsContentType=%@",_parsedPartsContentType);
if (!_parsedPartsContentType || [_parsedPartsContentType isEqualToString:GSWHTTPHeader_MimeType_TextPlain])
_parsedPartsContentDisposition=[_partInfo objectForKey:@"content-disposition"];
NSDebugMLLog(@"requests",@"_parsedPartsContentDisposition=%@",_parsedPartsContentDisposition);
//Convert: "form-data; name=\"9.1\"; filename=\"C:\\TEMP\\zahn.txt\"";
// into: {filename = "C:\\TEMP\\zahn.txt"; "form-data" = "form-data"; name = 9.1; }
_parsedContentDispositionOfParsedPart=[self _parseOneHeader:_parsedPartsContentDisposition];
NSDebugMLLog(@"requests",@"_parsedContentDispositionOfParsedPart=%@",_parsedContentDispositionOfParsedPart);
_enum=[_parsedContentDispositionOfParsedPart keyEnumerator];
_name=[_parsedContentDispositionOfParsedPart objectForKey:@"name"];
NSDebugMLLog(@"requests",@"_name=%@",_name);
if (!_name)
{
int _valueIndex=0;
int _valuesCount=[_values count];
id _value=nil;
for(_valueIndex=0;_valueIndex<_valuesCount;_valueIndex++)
{
_value=[_values objectAtIndex:_valueIndex];
NSDebugMLLog(@"requests",@"_value=%@",_value);
_value=[[[NSString alloc]initWithData:_value
encoding:NSISOLatin1StringEncoding]autorelease];
[_valuesNew addObject:_value];
};
_values=[NSArray arrayWithArray:_valuesNew];
ExceptionRaise(@"GSWRequest",
@"GSWRequest: No name \n%@\n",
_parsedContentDispositionOfParsedPart);
};
while((_dscrKey=[_enum nextObject]))
{
NSDebugMLLog(@"requests",@"_dscrKey=%@",_dscrKey);
if (![_dscrKey isEqualToString:@"name"] && ![_dscrKey isEqualToString:@"form-data"])
{
NSString* _key=nil;
_descrValue=[_parsedContentDispositionOfParsedPart objectForKey:_dscrKey];
NSDebugMLLog(@"requests",@"_descrValue=%@",_descrValue);
_key=[NSString stringWithFormat:@"%@.%@",_name,_dscrKey];
NSDebugMLLog(@"requests",@"_key=%@",_key);
[_formValues setObject:[NSArray arrayWithObject:_descrValue]
forKey:_key];
};
};
if (_parsedPartsCount>1)
{
NSArray* _values=[_parsedParts subarrayWithRange:NSMakeRange(1,[_parsedParts count]-1)];
NSMutableArray* _valuesNew=[NSMutableArray array];
NSDebugMLLog(@"requests",@"_values=%@",_values);
NSDebugMLLog(@"requests",@"_parsedPartsContentType=%@",_parsedPartsContentType);
if (!_parsedPartsContentType || [_parsedPartsContentType isEqualToString:GSWHTTPHeader_MimeType_TextPlain])
{
int _valueIndex=0;
int _valuesCount=[_values count];
id _value=nil;
for(_valueIndex=0;_valueIndex<_valuesCount;_valueIndex++)
{
_value=[_values objectAtIndex:_valueIndex];
NSDebugMLLog(@"requests",@"_value=%@",_value);
_value=[[[NSString alloc]initWithData:_value
encoding:NSISOLatin1StringEncoding]autorelease];
[_valuesNew addObject:_value];
};
_values=[NSArray arrayWithArray:_valuesNew];
};
[_formValues setObject:_values
forKey:_name];
};
[_formValues setObject:_values
forKey:_name];
};
};
};
};
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"GSWRequest in _getFormValuesFromMultipartFormData");
LOGException(@"%@ (%@) \n_contentTypes=%@\n_content=%@",
localException,
[localException reason],
_contentTypes,
_content);
[localException raise];
};
NS_ENDHANDLER;
NSDebugMLLog(@"requests",@"_formValues=%@",_formValues);
ASSIGN(formValues,_formValues);
//

View file

@ -150,4 +150,13 @@
+(NSStringEncoding)defaultEncoding;
@end
//====================================================================
@interface GSWResponse (GSWResponseError)
//NDFN
//Last cHance Response
+(GSWResponse*)responseWithMessage:(NSString*)message_
inContext:(GSWContext*)context_
forRequest:(GSWRequest*)request_;
@end
#endif //_GSWResponse_h__

View file

@ -649,3 +649,38 @@ NSStringEncoding globalDefaultEncoding=NSISOLatin1StringEncoding;
@end
//====================================================================
@implementation GSWResponse (GSWResponseError)
//--------------------------------------------------------------------
//NDFN
//Last cHance Response
+(GSWResponse*)responseWithMessage:(NSString*)message_
inContext:(GSWContext*)context_
forRequest:(GSWRequest*)request_
{
GSWResponse* _response=nil;
NSString* _httpVersion=nil;
LOGClassFnStart();
_response=[[self new]autorelease];
if (_response)
{
NSString* _responseString=nil;
if (context_ && [context_ request])
request_=[context_ request];
_httpVersion=[request_ httpVersion];
if (_httpVersion)
[_response setHTTPVersion:_httpVersion];
[_response setHeader:@"text/html"
forKey:@"content-type"];
[context_ _setResponse:_response];
_responseString=[NSString stringWithFormat:@"<HTML>\n<TITLE>GNUstepWeb Error</TITLE>\n</HEAD>\n<BODY bgcolor=\"white\">\n<CENTER>\n%@\n</CENTER>\n</BODY>\n</HTML>\n",
[[_response class]stringByEscapingHTMLString:message_]];
[_response appendContentString:_responseString];
};
LOGClassFnStop();
return _response;
};
@end

View file

@ -42,7 +42,20 @@
# after-all::
# Things to do before installing
# before-install::
# before-install:: autodoc gsdoc
autodocs:
echo $($(LIBRARY_NAME)_HEADER_FILES)
mkdir -p Doc/tmp
rm -f Doc/tmp/*
autodoc -allclasses -format html -template /usr/GNUstep/System/Libraries/Resources/DocTemplates/AutoDocTemplate.gsdoc -destination Doc/tmp/ -copyright "Copyright (C) 1999-200 Free Software Foundation, Inc." -define-author-name "Manuel Guesdon" -define-author-email "mguesdon@orange-concept.com" -define-author-desc "Developer" -define-author-url "http://www.gnustep.org/developers/whoiswho.html" -define-dtd-ref "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-0_6_6.dtd" -define-stylesheeturl "http://www.orange-concept.com/styles/default.css" -define-basetitle "GNUstepWeb - GSWeb" -define-dtd-url "http://www.gnustep.org/gsdoc-0_6_6.xml" -define-next "[[next]]" -define-prev "[[prev]]" -define-up "[[up]]" $($(LIBRARY_NAME)_HEADER_FILES)
mmv "Doc/tmp/*.html" "Doc/tmp/#1.gsdoc"
mv -f Doc/tmp/*.gsdoc Doc/
gsdocs:
@(cd Doc; \
gsdoc --verbose=1 --makeRefs --makeIndex --makeIndexTemplate=/usr/GNUstep/System/Libraries/Resources/DocTemplates/indextemplate.gsdoc --projectName="GSWeb" --refs=../../../ --define-version=1.0 --location="/usr/local/doc/dev/test/gsweb/GSWeb" --define-stylesheeturl="http://www.orange-concept.com/styles/default.css" --define-basetitle="GNUstepWeb - GSWeb" --define-dtd-url="http://www.gnustep.org/gsdoc-0_6_6.xml" --define-authorName="Manuel Guesdon" --define-author-email="mguesdon@orange-concept.com" --define-authorDesc="Developer" --define-authorURL="http://www.gnustep.org/developers/whoiswho.html" --define-copyright="Copyright (C) 1999-2000 Free Software Foundation, Inc." --define-date="" --define-up="../index" "*.gsdoc" ; \
cd ..; )
# Things to do after installing
# after-install::

View file

@ -1,7 +1,7 @@
# Makefile.postamble - GSWeb: Makefile.postamble
# Copyright (C) 1999 Free Software Foundation, Inc.
#
# Written by: Manuel Guesdon <mguesdon@sbuilders.com>
# Written by: Manuel Guesdon <mguesdon@orange-concept.com>
# Date: Jul 1999
#
# This file is part of the GNUstep Web Library.
@ -30,6 +30,11 @@
# otherwise the normal makefile rules will not be performed.
#
gsdocs:
@(cd Doc; \
gsdoc --verbose=1 --makeRefs --makeIndex --makeIndexTemplate=/usr/GNUstep/System/Libraries/Resources/DocTemplates/indextemplate.gsdoc --projectName="GSWeb" --refs=../../ --define-version=1.0 --location="/usr/local/doc/dev/test/gsweb/" --define-stylesheeturl="http://www.orange-concept.com/styles/default.css" --define-basetitle="GNUstepWeb - " --define-dtd-url="http://www.gnustep.org/gsdoc-0_6_6.xml" --define-authorName="Manuel Guesdon" --define-author-email="mguesdon@orange-concept.com" --define-authorDesc="Developer" --define-authorURL="http://www.gnustep.org/developers/whoiswho.html" --define-copyright="Copyright (C) 1999-2000 Free Software Foundation, Inc." --define-date="" --define-up="../index" "*.gsdoc" ; \
cd ..; )
# Things to do before compiling
# before-all::