* GSWExtensions/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.gswd

* GSWExtensions/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.gswd
* GSWExtensions/GNUmakefile
* GSWExtensions/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.gswd
* GSWExtensions/GSWExceptionPage.gswc/GSWExceptionPage.gswd
use exclamation.png. exclamation.svg is not displayed inline in mozilla 
due to a bug in mozilla.
* GSWExtensions/WebServerResources/exclamation.png
* GSWExtensions/WebServerResources/exclamation.svg
new file
* GSWExtensions/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html
* GSWExtensions/GSWExceptionPage.gswc/GSWExceptionPage.html
better web design
* GSWeb/GSWApplication.m
-path
get path from _resourceManager
_resetCache
do not call _clearCache, maybe we should trash the _componentDefinitionCache?
_finishInitializingSession:
make empty, still seems to work
+_applicationClass
don not use _applicationGSWBundle
* GSWeb/GSWResourceManager.h
* GSWeb/GSWResourceManager.m
major redesign with WO 4.5 docs in mind.
* GSWeb/GSWImageButton.m
refactor resourceManager code
* GSWeb/GSWeb.h
remove GSWBundle class
* Testing/DynamicElements
added Image test.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@30806 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2010-06-22 05:02:29 +00:00
parent c5b731b3ca
commit 39c130d0f5
40 changed files with 1306 additions and 3053 deletions

View file

@ -1,3 +1,36 @@
2010-06-21 David Wetzel <dave@turbocat.de>
* GSWExtensions/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.gswd
* GSWExtensions/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.gswd
* GSWExtensions/GNUmakefile
* GSWExtensions/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.gswd
* GSWExtensions/GSWExceptionPage.gswc/GSWExceptionPage.gswd
use exclamation.png. exclamation.svg is not displayed inline in mozilla
due to a bug in mozilla.
* GSWExtensions/WebServerResources/exclamation.png
* GSWExtensions/WebServerResources/exclamation.svg
new file
* GSWExtensions/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html
* GSWExtensions/GSWExceptionPage.gswc/GSWExceptionPage.html
better web design
* GSWeb/GSWApplication.m
-path
get path from _resourceManager
_resetCache
do not call _clearCache, maybe we should trash the _componentDefinitionCache?
_finishInitializingSession:
make empty, still seems to work
+_applicationClass
don not use _applicationGSWBundle
* GSWeb/GSWResourceManager.h
* GSWeb/GSWResourceManager.m
major redesign with WO 4.5 docs in mind.
* GSWeb/GSWImageButton.m
refactor resourceManager code
* GSWeb/GSWeb.h
remove GSWBundle class
* Testing/DynamicElements
added Image test.
2010-06-18 David Wetzel <dave@turbocat.de>
* GSWeb/GSWContext.m
- computeQueryDictionaryWithPath:queryDictionary:otherQueryDictionary

View file

@ -27,7 +27,7 @@ include $(GNUSTEP_MAKEFILES)/Auxiliary/gsweb.make
GSWAPP_NAME=WebBookStore1
WebBookStore1_HAS_GSWCOMPONENTS=YES
WebBookStore1_PRINCIPAL_CLASS=WebBookStore1
WebBookStore1_PRINCIPAL_CLASS=Application
WebBookStore1_GSWAPP_INFO_PLIST=Resources/Info-WebBookStore1.plist
# The Objective-C source files to be compiled

View file

@ -124,7 +124,8 @@ appOff.png \
appOn.png \
back.png \
dir.png \
exclamation.mng \
exclamation.png \
exclamation.svg \
eye.png \
lft-OSarw.png \
rt-OSarw.png \

View file

@ -1,3 +1,11 @@
ExclamationImage: GSWImage
{
filename = "exclamation.png";
framework = "WOExtensions";
height="50";
width="60";
alt="exclamation sign"
}
ApplicationNameString: GSWString
{

View file

@ -1,86 +1,95 @@
<html>
<head>
<title>GNUstepWeb Error</title>
<meta name="robots" content="noindex,nofollow"/>
</head>
<body bgcolor="white">
<table border="0">
<tr>
<td align="center" Valign="TOP">
<h2>[!] An error occured in application <gsweb name="ApplicationNameString"></gsweb>.</h2>
<h4><gsweb name="ReenterHyperlink">&lt;&lt;&nbsp;Re-enter <gsweb name="ApplicationNameString"></gsweb></gsweb></h4>
</td>
</tr>
<tr>
<td align="LEFT" Valign="TOP">
<hr/>
<table border="0" width="700">
<tr>
<td align="RIGHT" Valign="MIDDLE">
<b>Application:</b>
</td>
<td align="LEFT" Valign="MIDDLE">
<tt><gsweb name="ApplicationNameString"></gsweb></tt>
</td>
</tr>
<tr>
<td align="right" valign="top">
<b>Reference:</b>
</td>
<td align="left" valign="top">
<tt><gsweb name="ReferenceString"></gsweb></tt>
</td>
</tr>
<tr>
<td align="RIGHT" Valign="MIDDLE">
<b>Error:</b>
</td>
<td align="LEFT" Valign="MIDDLE">
<tt><gsweb name="ExceptionNameString"></gsweb></tt>
</td>
</tr>
<tr>
<td align="RIGHT" Valign="MIDDLE">
<b>Reason:</b>
</td>
<td align="LEFT" Valign="MIDDLE">
<gsweb name="ReasonRepetition">
<tt><gsweb name="ReasonString"></gsweb></tt><br/>
</gsweb>
</td>
</tr>
<tr>
<td colspan="2" align="LEFT" Valign="bottom">
<hr/>
<b>User Info Dictionary:</b>
</td>
</tr>
<gsweb name="HasUserInfoConditional">
<gsweb name="UserInfoRowRepetition">
<tr>
<td align="RIGHT" Valign="TOP">
<b><tt><gsweb name="UserInfoKeyString"></gsweb>:</tt></b>
</td>
<td align="LEFT" Valign="TOP">
<tt><gsweb name="UserInfoValueString"></gsweb></tt>
</td>
</tr>
</gsweb>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {color: #111;font-family:"Helvetica Neue",Helvetica,sans-serif;}
.fail {margin: auto; padding: 40px; display: block;
border: 1px solid #000000;
position: relative;}
.fail h2 {margin: 0 0 .2em; font-size: 24px}
.fail p {margin: 0; font-size: .8em;}
.power {float:right;padding-top: 10px;}
img {float:left;padding-right: 10px;}
a {color: #0092E8;}
a:hover {color: #0071b3;}
</style>
<title>GNUstepWeb Error</title>
<meta name="robots" content="noindex,nofollow"/>
</head>
<body>
<div class="fail">
<gsweb name="ExclamationImage"></gsweb>
<h2>An error occured in application <gsweb name="ApplicationNameString"></gsweb>.</h2>
<p><gsweb name="ReenterHyperlink">Re-enter <gsweb name="ApplicationNameString"></gsweb> to continue.</gsweb></p>
<table border="0" width="700">
<tr>
<td align="RIGHT" Valign="MIDDLE">
<b>Application:</b>
</td>
<td align="LEFT" Valign="MIDDLE">
<tt><gsweb name="ApplicationNameString"></gsweb></tt>
</td>
</tr>
<tr>
<td align="right" valign="top">
<b>Reference:</b>
</td>
<td align="left" valign="top">
<tt><gsweb name="ReferenceString"></gsweb></tt>
</td>
</tr>
<tr>
<td align="RIGHT" Valign="MIDDLE">
<b>Error:</b>
</td>
<td align="LEFT" Valign="MIDDLE">
<tt><gsweb name="ExceptionNameString"></gsweb></tt>
</td>
</tr>
<tr>
<td align="RIGHT" Valign="MIDDLE">
<b>Reason:</b>
</td>
<td align="LEFT" Valign="MIDDLE">
<gsweb name="ReasonRepetition">
<tt><gsweb name="ReasonString"></gsweb></tt><br/>
</gsweb>
<gsweb name="NoUserInfoConditional">
<tr>
<td align="RIGHT" Valign="TOP">
</td>
<td align="LEFT" Valign="TOP">
<b>Exception has no userInfo dictionary</b>
</td>
</tr>
</gsweb>
</table>
</td>
</tr>
</table>
<p>Powered by <a href="http://wiki.gnustep.org/index.php/GNUstepWeb">GNUstep Web</a></p>
</body>
</td>
</tr>
<tr>
<td colspan="2" align="LEFT" Valign="bottom">
<hr/>
<b>User Info Dictionary:</b>
</td>
</tr>
<gsweb name="HasUserInfoConditional">
<gsweb name="UserInfoRowRepetition">
<tr>
<td align="RIGHT" Valign="TOP">
<b><tt><gsweb name="UserInfoKeyString"></gsweb>:</tt></b>
</td>
<td align="LEFT" Valign="TOP">
<tt><gsweb name="UserInfoValueString"></gsweb></tt>
</td>
</tr>
</gsweb>
</gsweb>
<gsweb name="NoUserInfoConditional">
<tr>
<td align="RIGHT" Valign="TOP">
</td>
<td align="LEFT" Valign="TOP">
<b>Exception has no userInfo dictionary</b>
</td>
</tr>
</gsweb>
</table>
<p class="power">Powered by <a href="http://wiki.gnustep.org/index.php/GNUstepWeb">GNUstep Web</a></p>
</div>
</body>
</html>

View file

@ -1,8 +1,10 @@
ExclamationImage: GSWImage
{
filename = "exclamation.mng";
framework = "GSWExtensions";
border = 0;
filename = "exclamation.png";
framework = "WOExtensions";
height="50";
width="60";
alt="exclamation sign"
}
ApplicationNameString: GSWString

View file

@ -1,9 +1,11 @@
ExclamationImage: GSWImage
{
filename = "exclamation.mng";
framework = "GSWExtensions";
border = 0;
filename = "exclamation.png";
framework = "WOExtensions";
height="50";
width="60";
alt="exclamation sign"
}
ApplicationNameString: GSWString

View file

@ -1,8 +1,10 @@
ExclamationImage: GSWImage
{
filename = "exclamation.mng";
framework = "GSWExtensions";
border = 0;
filename = "exclamation.png";
framework = "WOExtensions";
height="50";
width="60";
alt="exclamation sign"
}
ApplicationNameString: GSWString

View file

@ -1,24 +1,29 @@
<html>
<head>
<title>Missing Session Error</title>
<meta name="robots" content="noindex,nofollow"/>
</head>
<body bgcolor="white">
<table border="0" width="100%">
<tr>
<td align="CENTER" Valign="TOP">
<gsweb name="ExclamationImage"></gsweb><br/>
Re-enter<br/>
<gsweb name="ReenterHyperlink">
<b><gsweb name="ApplicationNameString"></gsweb></b>
</gsweb>
</td>
<td align="LEFT" Valign="MIDDLE">
<b>Your session has timed out.</b>
</td>
</tr>
</table>
</body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {color: #111;font-family:"Helvetica Neue",Helvetica,sans-serif;}
.fail {margin: auto; padding: 40px; width: 400px; display: block;
border: 1px solid #000000;
position: relative;}
.fail h2 {margin: 0 0 .2em; font-size: 24px}
.fail p {margin: 0; font-size: .8em;}
.power {float:right;padding-top: 10px;}
img {float:left;padding-right: 10px;}
a {color: #0092E8;}
a:hover {color: #0071b3;}
</style>
<title>Missing Session Error</title>
<meta name="robots" content="noindex,nofollow"/>
</head>
<body>
<div class="fail">
<gsweb name="ExclamationImage"></gsweb>
<h2>Your session has timed out.</h2>
<p><gsweb name="ReenterHyperlink">Re-enter <gsweb name="ApplicationNameString"></gsweb> to continue.</gsweb></p>
<p class="power">Powered by <a href="http://wiki.gnustep.org/index.php/GNUstepWeb">GNUstep Web</a></p>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" width="600" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="g1" x1="41.1948738" y1="616.477173" x2="118.931351" y2="527.555115" gradientUnits="userSpaceOnUse" gradientTransform="matrix(4.556763,0,0,-4.315033,37.49756,2758.519)">
<stop offset="0" stop-color="#b00"/>
<stop offset="1" stop-color="#5f0000"/>
</linearGradient>
<linearGradient id="g2" x1="530.809509" y1="486.631012" x2="174.805481" y2="211.22995" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.960006,0,0,0.960006,11.68071,9.787565)">
<stop offset="0" stop-color="#9a0000"/>
<stop offset="1" stop-color="#f22803"/>
</linearGradient>
<linearGradient id="g3" x1="187.873566" y1="224.598923" x2="581.837463" y2="483.100006" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.960006,0,0,0.960006,11.68071,9.787558)">
<stop offset="0" stop-color="#ec6c60"/>
<stop offset="1" stop-color="#d11412"/>
</linearGradient>
<linearGradient id="g4" x1="250.398453" y1="101.536331" x2="412.094299" y2="264.54187" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.960006,0,0,0.960006,11.68071,9.787565)">
<stop offset="0" stop-color="#ffd9d9"/>
<stop offset="1" stop-color="#ff2727"/>
</linearGradient>
<radialGradient id="g5"
cx="295.471252" cy="186.096344" r="179.550003" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.14292e-8,1.531256,-0.876504,-2.165967e-5,462.7486,-245.0023)">
<stop offset="0" stop-color="#fff"/>
<stop offset="0.5" stop-color="#fff"/>
<stop offset="1" stop-color="#d5d5d5"/>
</radialGradient>
</defs>
<path d="M 287.0439 30.68461 C 287.0439 30.68461 26.88238 457.8871 26.88238 457.8871 C 21.89034 466.0472 21.89034 476.1272 26.88238 484.2873 C 31.77841 492.3513 40.99446 497.4394 50.97852 497.4394 L 571.3016 497.4394 C 581.1896 497.4394 590.4057 492.3513 595.3977 484.2873 C 600.2937 476.1272 600.2937 466.0472 595.3977 457.8871 L 335.2362 30.68461 C 330.2442 22.52457 321.0281 17.43654 311.14 17.43654 C 301.252 17.43654 292.0359 22.52457 287.0439 30.68461z" style="fill-opacity:0.178571"/>
<path d="M 275.5863 23.03565 C 275.5863 23.03565 15.42473 450.2381 15.42473 450.2381 C 10.4327 458.3982 10.4327 468.4783 15.42473 476.6383 C 20.32076 484.7024 29.53681 489.7904 39.52087 489.7904 L 559.8439 489.7904 C 569.732 489.7904 578.948 484.7024 583.9401 476.6383 C 588.8361 468.4783 588.8361 458.3982 583.9401 450.2381 L 323.7785 23.03565 C 318.7865 14.8756 309.5705 9.787568 299.6824 9.787568 C 289.7943 9.787568 280.5783 14.8756 275.5863 23.03565z" style="fill:url(#g1)"/>
<path d="M 299.6824 31.7717 C 298.0504 31.7717 296.5144 32.6357 295.6504 33.97971 L 165.5696 247.581 L 35.48885 461.1822 C 34.62484 462.5262 34.62484 464.2542 35.48885 465.5982 C 36.35285 466.9422 37.88886 467.8062 39.52087 467.8062 L 559.8439 467.8062 C 561.4759 467.8062 563.0119 466.9422 563.876 465.5982 C 564.74 464.2542 564.74 462.5262 563.876 461.1822 L 303.7144 33.97971 C 302.8504 32.6357 301.3144 31.7717 299.6824 31.7717z" style="fill:url(#g2)"/>
<path d="M 299.6464 31.7717 C 298.0144 31.7717 296.4783 32.6357 295.6143 33.97971 L 165.5336 247.581 L 35.45283 461.1822 C 34.58882 462.5262 34.58882 464.2542 35.45283 465.5982 C 36.31683 466.9422 37.85284 467.8062 39.48485 467.8062 L 559.8079 467.8062 C 561.4399 467.8062 562.9759 466.9422 563.8399 465.5982 C 564.7039 464.2542 564.7039 462.5262 563.8399 461.1822 L 303.6784 33.97971 C 302.8144 32.6357 301.2784 31.7717 299.6464 31.7717z" style="fill:none;stroke:url(#g3);stroke-width:11.52;stroke-linejoin:round"/>
<path d="M 299.7514 39.46512 C 298.2057 39.54152 296.7649 40.40413 295.9414 41.68514 L 165.8606 255.2864 L 147.7405 285.0466 C 191.8747 311.5396 243.5133 326.8068 298.7014 326.8068 C 354.6732 326.8068 407.0086 311.1293 451.5523 283.9366 L 304.0114 41.68514 C 303.1474 40.34112 301.6234 39.46512 299.9914 39.46512 C 299.9149 39.46512 299.8274 39.46136 299.7514 39.46512z" style="fill:url(#g4);stroke-width:10;stroke-linejoin:round"/>
<path d="M 286.4344 145.7244 L 129.2814 403.678 C 126.5934 408.1901 126.5934 413.7581 129.2814 418.1741 C 131.9695 422.6861 137.0575 425.4702 142.5295 425.4702 L 456.7395 425.4702 C 462.2115 425.4702 467.2996 422.6861 469.9876 418.1741 C 472.6756 413.6621 472.6756 408.1901 469.9876 403.678 L 312.9306 145.7244 C 310.2426 141.2124 305.1545 138.4284 299.6825 138.4284 C 294.2105 138.4284 289.1224 141.2124 286.4344 145.7244z" style="fill:url(#g5)"/>
<path d="M 291.3968 416.3174 C 282.3931 412.0051 275.5362 401.6362 275.5362 392.3333 C 275.5362 375.0116 293.6366 361.9634 310.762 366.9398 C 322.3151 370.2971 330.1674 380.7229 330.0712 392.5774 C 329.9891 402.6474 325.6306 410.0656 316.7341 415.2773 C 309.9242 419.2665 298.5306 419.7341 291.3968 416.3174 z M 293.4432 347.9194 C 292.3177 347.3009 289.6669 345.1473 287.5529 343.1337 C 280.1664 336.0983 280.1756 336.1602 275.3607 260.8815 C 271.0805 193.9641 271.0451 192.9243 272.8817 188.1175 C 277.0134 177.3028 286.2196 172.5672 301.5485 173.3714 C 311.2922 173.8827 318.7963 177.3045 323.674 183.4607 C 327.8404 188.719 328.7462 191.6916 328.7424 200.0923 C 328.7383 209.2211 322.9068 321.1701 322.0779 328.0305 C 320.9926 337.0156 315.7466 344.3072 308.0575 347.5177 C 303.6637 349.3525 296.4136 349.5518 293.4432 347.9194z"/>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

View file

@ -333,13 +333,7 @@ RCS_ID("$Id$")
if (actionClass)
{
GSWResourceManager* resourceManager=nil;
GSWDeployedBundle* appBundle=nil;
id<GSWActionResults> actionResult=nil;
resourceManager=[application resourceManager];
appBundle=[resourceManager _appProjectBundle];
[resourceManager _allFrameworkProjectBundles];//So what ?
NS_DURING
{

View file

@ -389,27 +389,22 @@ static NSString * static_tempQueryKey = nil;
GSWAssociation* actionAssociation=nil;
NSArray* regions=nil;
if (_file)
{
id imageMapFileNameValue=[_file valueInComponent:component];
NSString* imageMapFilePath;
GSWResourceManager* resourceManager=[[GSWApplication application]resourceManager];
NSArray* languages=[aContext languages];
imageMapFilePath=[resourceManager pathForResourceNamed:imageMapFileNameValue
inFramework:nil
languages:languages];
if (imageMapFilePath)
regions=[GSWGeometricRegion geometricRegionsWithFile:imageMapFilePath];
else
{
id imageMapFileNameValue=[_file valueInComponent:component];
NSString* imageMapFilePath=[GSWContext_component(aContext)
pathForResourceNamed:imageMapFileNameValue
ofType:nil];
if (!imageMapFilePath)
{
GSWResourceManager* resourceManager=[[GSWApplication application]resourceManager];
NSArray* languages=[aContext languages];
imageMapFilePath=[resourceManager pathForResourceNamed:imageMapFileNameValue
inFramework:nil
languages:languages];
};
if (imageMapFilePath)
regions=[GSWGeometricRegion geometricRegionsWithFile:imageMapFilePath];
else
{
//NSDebugMLLog0(@"gswdync",@"GSWActiveImage No image Map.");
};
}
//NSDebugMLLog0(@"gswdync",@"GSWActiveImage No image Map.");
};
}
else if (!WOStrictFlag && _imageMapString)
{
id imageMapValue=[_imageMapString valueInComponent:component];

View file

@ -332,8 +332,9 @@ int GSWApplicationMain(NSString* applicationClassName,
{
[self _setupForMonitoring];
};
[[GSWResourceManager _applicationGSWBundle] initializeObject:self
fromArchiveNamed:@"Application"];
// ??
// [[GSWResourceManager _applicationGSWBundle] initializeObject:self
// fromArchiveNamed:@"Application"];
[self setPrintsHTMLParserDiagnostics:NO];
if ([[self class] recordingPath])
@ -658,7 +659,7 @@ int GSWApplicationMain(NSString* applicationClassName,
{
NSString* path=nil;
path=[[GSWResourceManager _applicationGSWBundle] path];
path=[[_resourceManager _appProjectBundle] path];
return path;
};
@ -852,15 +853,17 @@ int GSWApplicationMain(NSString* applicationClassName,
[self lock];
NS_DURING
{
anEnum=[_componentDefinitionCache objectEnumerator];
while ((definition = [anEnum nextObject]))
{
if (((NSString*)definition != GSNotFoundMarker) && (![definition isCachingEnabled]))
[definition _clearCache];
}
// we should probably clear the _componentDefinitionCache? -- dw
// anEnum=[_componentDefinitionCache objectEnumerator];
// while ((definition = [anEnum nextObject]))
// {
// if (((NSString*)definition != GSNotFoundMarker) && (![definition isCachingEnabled]))
// [definition _clearCache];
// }
if (![self isCachingEnabled])
{
[[GSWResourceManager _applicationGSWBundle] clearCache];
[_resourceManager flushDataCache];
}
}
NS_HANDLER
@ -1331,27 +1334,9 @@ int GSWApplicationMain(NSString* applicationClassName,
//--------------------------------------------------------------------
-(void)_finishInitializingSession:(GSWSession*)aSession
{
//OK
[self lock];
NS_DURING
{
[[GSWResourceManager _applicationGSWBundle] initializeObject:aSession
fromArchiveNamed:@"Session"];
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"In initializeObject:fromArchiveNamed:");
//TODO
[self unlock];
[localException raise];
};
NS_ENDHANDLER;
[self unlock];
};
{
//Does nothing on WO 5
}
//--------------------------------------------------------------------
-(GSWSession*)_initializeSessionInContext:(GSWContext*)aContext
@ -1714,64 +1699,16 @@ to another instance **/
//--------------------------------------------------------------------
-(Class)_sessionClass
{
//OK
Class sessionClass=nil;
sessionClass=[[GSWResourceManager _applicationGSWBundle] scriptedClassWithName:GSWClassName_Session
superclassName:GSWClassName_Session];
// sessionClass=[[_resourceManager _appProjectBundle] scriptedClassWithName:GSWClassName_Session
// superclassName:GSWClassName_Session];
if (!sessionClass)
sessionClass=NSClassFromString(GSWClassName_Session);
/*
//Search Compiled Class "Session" (subclass of GSWsession)
gswsessionClass=NSClassFromString();
sessionClass=NSClassFromString(GSWClassName_Session);
//If not found, search for library "Session" in application .gswa directory
if (!_sessionClass)
{
NSString* sessionPath=[self pathForResourceNamed:@"session"
ofType:nil];
Class _principalClass=[self libraryClassWithPath:sessionPath];
NSDebugMLLog(@"application",@"_principalClass=%@",_principalClass);
if (_principalClass)
{
_sessionClass=NSClassFromString(GSWClassName_Session);
NSDebugMLLog(@"application",@"sessionClass=%@",_sessionClass);
};
};
//If not found, search for scripted "Session" in application .gswa directory
if (!sessionClass)
{
//TODO
};
//If not found, search for scripted "Session" in a session.gsws file
if (!sessionClass)
{
//TODO
};
if (!sessionClass)
{
sessionClass=_gswsessionClass;
}
else
{
if (!ClassIsKindOfClass(_sessionClass,_gswsessionClass))
{
//TODO exception
NSDebugMLLog(@"application",
@"session class is not a kind of GSWSession");
}
};
NSDebugMLLog(@"application",@"_sessionClass:%@",_sessionClass);
*/
return sessionClass;
};
}
//--------------------------------------------------------------------
//NDFN
@ -2265,7 +2202,7 @@ to another instance **/
[noteCenter postNotificationName:@"ApplicationWillDispatchRequestNotification"
object:aRequest];
requestHandler = [self handlerForRequest:aRequest];
if (!requestHandler)
@ -2488,11 +2425,11 @@ to another instance **/
NS_DURING
{
errorPage=[self pageWithName:pageName
inContext:context];
inContext:context];
if (anException)
[errorPage takeValue:anException
forKey:@"exception"];
[errorPage setValue:anException
forKey:@"exception"];
}
NS_HANDLER
{
@ -3504,13 +3441,30 @@ to another instance **/
//--------------------------------------------------------------------
+(Class)_applicationClass
{
NSBundle * mainBundle = [NSBundle mainBundle];
NSString * className = [[mainBundle infoDictionary] objectForKey:@"NSPrincipalClass"];
Class potentialAppClass = NULL;
[[GSWResourceManager _applicationGSWBundle]
scriptedClassWithName:GSWClassName_Application//TODO
superclassName:GSWClassName_Application]; //retirune nil //TODO
if (className) {
potentialAppClass = NSClassFromString(className);
if ((potentialAppClass) && GSObjCIsKindOf(potentialAppClass,[GSWApplication class]))
{
return potentialAppClass;
}
}
return NSClassFromString(globalApplicationClassName);
};
potentialAppClass = NSClassFromString(@"Application");
if ((potentialAppClass) && GSObjCIsKindOf(potentialAppClass,[GSWApplication class]))
{
return potentialAppClass;
}
NSLog(@"You should consider creating your own WOApplication subclass.");
return NSClassFromString(@"WOApplication");
}
//--------------------------------------------------------------------
+(Class)_compiledApplicationClass

View file

@ -4,7 +4,8 @@
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 1999
Written by: David Wetzel <dave@turbocat.de>
$Revision$
$Date$
@ -33,116 +34,19 @@
#define _GSWBundle_h__
//====================================================================
@interface GSWBundle : NSObject <NSLocking>
{
NSString* _path;
NSString* _baseURL;
NSString* _frameworkName;
NSMutableDictionary* _archiveCache;
NSMutableDictionary* _apiCache;//NDFN
NSMutableDictionary* _encodingCache;
NSMutableDictionary* _templateParserTypeCache;//NDFN
NSMutableDictionary* _pathCache;
NSMutableDictionary* _urlCache;
NSMutableDictionary* _stringsTableCache;
NSMutableDictionary* _stringsTableArrayCache; //NDFN
NSMutableDictionary* _templateCache;
NSMutableDictionary* _classCache;
NSRecursiveLock* _selfLock;
#ifndef NDEBUG
int _selfLockn;
#endif
};
-(NSString*)baseURL;
-(NSString*)path;
-(NSString*)frameworkName;
-(NSString*)description;
-(void)dealloc;
-(id)initWithPath:(NSString*)aPath
baseURL:(NSString*)aBaseURL
inFrameworkNamed:(NSString*)aFrameworkName;
-(id)initWithPath:(NSString*)aPath
baseURL:(NSString*)aBaseURL;
-(void)unlock;
-(void)lock;
// CHECKME: do we need this for WO 4.5? -- dw
-(void)clearCache;
//-(void)loadCache;
//-(id)lockedResourceNamed:(NSString*)aName
// ofType:(NSString*)aType
// withLanguages:(NSArray*)languages
// usingCache:(NSMutableDictionary*)cache
// relativePath:(NSString**)relativePath
// absolutePath:(NSString**)absolutePath;
@interface NSBundle (WOResourceManagement)
-(void)initializeObject:(id)anObject
fromArchiveNamed:(NSString*)aName;
-(void)initializeObject:(id)anObject
fromArchive:(NSDictionary*)archive;
-(Class)scriptedClassWithName:(NSString*)aName
superclassName:(NSString*)superclassName;
-(Class)lockedScriptedClassWithName:(NSString*)aName
pathName:(NSString*)pathName
superclassName:(NSString*)superclassName;
-(NSString*)lockedScriptedClassPathWithName:(NSString*)aName;
//-(Class)compiledClassWithName:(NSString*)aName
// superclassName:(NSString*)superclassName;
-(GSWElement*)templateNamed:(NSString*)aName
languages:(NSArray*)languages;
-(GSWElement*)lockedTemplateNamed:(NSString*)aName
languages:(NSArray*)languages;
//-(NSString*)stringForKey:(NSString*)key_
// inTableNamed:(NSString*)aName
// withDefaultValue:(NSString*)defaultValue
// languages:(NSArray*)languages;
//
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)aName
withLanguages:(NSArray*)languages;
//NDFN
//-(NSArray*)stringsTableArrayNamed:(NSString*)aName
// withLanguages:(NSArray*)languages;
//-(NSString*)urlForResourceNamed:(NSString*)aName
// ofType:(NSString*)aType
// languages:(NSArray*)languages
// request:(GSWRequest*)aRequest;
//
-(NSString*)pathForResourceNamed:(NSString*)aName
ofType:(NSString*)aType
languages:(NSArray*)languages;
-(NSStringEncoding)encodingForResourcesNamed:(NSString*)aName;
-(GSWTemplateParserType)templateParserTypeForResourcesNamed:(NSString*)aName;//NDFN
-(NSDictionary*)archiveNamed:(NSString*)aName;
-(NSDictionary*)apiNamed:(NSString*)aName;//NDFN
-(NSDictionary*)lockedArchiveNamed:(NSString*)aName;
-(NSDictionary*)lockedApiNamed:(NSString*)aName;//NDFN
//-(id)scriptedClassNameFromClassName:(NSString*)aName;
//-(id)scriptPathNameFromScriptedClassName:(NSString*)aName;
fromArchive:(NSDictionary*)anArchive;
@end
@interface GSWBundleUnarchiverDelegate : NSObject
{
id _object;
}
- (id) unarchiver:(NSKeyedUnarchiver*)unarchiver objectForReference:(NSString*)keyPath;
- (id) initWithObject:(id)object;
@end
#endif //_GSWBundle_h__

File diff suppressed because it is too large Load diff

View file

@ -105,7 +105,7 @@
-(GSWElement*)_childTemplate;
-(GSWElement*) template;
-(GSWComponentDefinition*)_componentDefinition;
-(NSString*)_templateName;
-(NSString*)_templateName GS_ATTRIB_DEPRECATED;
-(NSString*)declarationName;
-(BOOL)_isPage;
-(void)_setIsPage:(BOOL)isPage;
@ -225,58 +225,32 @@ Call this method before using a component which was cached in a variable.
//+(id)validateValue:(id*)valuePtr
// forKey:(id)key;
-(NSString*)stringForKey:(NSString*)key
inTableNamed:(NSString*)aName
withDefaultValue:(NSString*)defaultValue;
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)aName;
//NDFN
-(NSArray*)stringsTableArrayNamed:(NSString*)aName;
-(NSString*)urlForResourceNamed:(NSString*)aName
ofType:(NSString*)extension;
-(NSString*)_urlForResourceNamed:(NSString*)aName
ofType:(NSString*)extension;
ofType:(NSString*)extension GS_ATTRIB_DEPRECATED;
/*
Deprecated in WO 4.0.
Use GSWResourceManagers implementation of
pathForResourceNamed:inFramework:languages:
instead.
*/
-(NSString*)pathForResourceNamed:(NSString*)aName
ofType:(NSString*)extension;
//NDFN
-(NSString*)pathForComponentResourceNamed:(NSString*)aName
ofType:(NSString*)type;
//NDFN
-(NSString*)stringForKey:(id)key
inTableNamed:(NSString*)aName
withDefaultValue:(NSString*)defaultValue
inFramework:(NSString*)frameworkName;
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)aName
inFramework:(NSString*)frameworkName;
//NDFN
-(NSArray*)stringsTableArrayNamed:(NSString*)aName
inFramework:(NSString*)frameworkName;
//NDFN
-(NSString*)urlForResourceNamed:(NSString*)aName
ofType:(NSString*)extension
inFramework:(NSString*)frameworkName;
//NDFN
-(NSString*)pathForResourceNamed:(NSString*)aName
ofType:(NSString*)extension
inFramework:(NSString*)frameworkName;
ofType:(NSString*)extension GS_ATTRIB_DEPRECATED;
+(GSWElement*)templateWithHTMLString:(NSString*)htmlString
declarationString:(NSString*)declarationString
languages:(NSArray*)languages;
/*
Deprecated in WO 4.0.
Use
templateWithHTMLString:declarationString:languages:
instead.
*/
+(GSWElement*)templateWithHTMLString:(NSString *)htmlString
declarationString:(NSString*)declarationString;//old
declarationString:(NSString*)declarationString GS_ATTRIB_DEPRECATED;
- (GSWResponse*)generateResponse;

View file

@ -1453,185 +1453,47 @@ Call this method before using a component which was cached in a variable.
return value;
}
//--------------------------------------------------------------------
// stringForKey:inTableNamed:withDefaultValue:
-(NSString*)stringForKey:(NSString*)key
inTableNamed:(NSString*)tableName
withDefaultValue:(NSString*)defaultValue
{
//OK
NSString* string=nil;
string=[GSWApp stringForKey:key
inTableNamed:tableName
withDefaultValue:defaultValue
inFramework:[self frameworkName]
languages:[self languages]];
return string;
}
//--------------------------------------------------------------------
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)aName
{
//OK
NSDictionary* stringsTable=nil;
stringsTable=[GSWApp stringsTableNamed:aName
inFramework:[self frameworkName]
languages:[self languages]];
return stringsTable;
}
//--------------------------------------------------------------------
//NDFN
-(NSArray*)stringsTableArrayNamed:(NSString*)aName
{
//OK
NSArray* stringsTableArray=nil;
stringsTableArray=[GSWApp stringsTableArrayNamed:aName
inFramework:[self frameworkName]
languages:[self languages]];
return stringsTableArray;
}
//--------------------------------------------------------------------
// urlForResourceNamed:ofType:
-(NSString*)urlForResourceNamed:(NSString*)aName
ofType:(NSString*)type
{
//TODO
NSString* url=nil;
NSString* name;
NSString* url = nil;
if ((type != nil)) {
name = [NSString stringWithFormat:@"%@.%@",aName,type];
} else {
name = aName;
}
GSOnceMLog(@"%s is depricated in WO 4.0. Use GSWResourceManagers implementation of "
@"urlForResourceNamed:inFramework:languages:request: "
@"instead.",
__PRETTY_FUNCTION__);
url=[GSWApp urlForResourceNamed:name
inFramework:[self frameworkName]
languages:[self languages]
request:nil];//TODO
url=[[GSWApp resourceManager] urlForResourceNamed:aName
ofType:type
inFramework:nil
languages:[self languages]
request:nil];
return url;
}
//--------------------------------------------------------------------
-(NSString*)_urlForResourceNamed:(NSString*)aName
ofType:(NSString*)type
{
[self notImplemented: _cmd]; //TODOFN
return nil;
}
//--------------------------------------------------------------------
// pathForResourceNamed:ofType:
// Normally: local search. Here we do a resourceManager serahc.
-(NSString*)pathForResourceNamed:(NSString*)aName
ofType:(NSString*)type
{
NSString* path=nil;
GSOnceMLog(@"%s is depricated in WO 4.0. Use GSWResourceManagers implementation of "
@"pathForResourceNamed:inFramework:languages: "
@"instead.",
__PRETTY_FUNCTION__);
path=[GSWApp pathForResourceNamed:aName
ofType:type
inFramework:[self frameworkName]
languages:[self languages]];
path=[[GSWApp resourceManager] pathForResourceNamed:aName
ofType:type
inFramework:nil
languages:[self languages]];
return path;
}
//--------------------------------------------------------------------
//NDFN
-(NSString*)pathForComponentResourceNamed:(NSString*)aName
ofType:(NSString*)type_
{
NSString* path=nil;
NSArray* languages=nil;
GSWComponentDefinition* aComponentDefinition=nil;
languages=[self languages];
aComponentDefinition=[self _componentDefinition];
if (aComponentDefinition)
path=[aComponentDefinition pathForResourceNamed:aName
ofType:type_
languages:languages];
return path;
}
//--------------------------------------------------------------------
//NDFN
-(NSString*)stringForKey:(id)key
inTableNamed:(NSString*)aName
withDefaultValue:(NSString*)defaultValue
inFramework:(NSString*)aFrameworkName
{
return [GSWApp stringForKey:key
inTableNamed:aName
withDefaultValue:defaultValue
inFramework:aFrameworkName
languages:[self languages]];
}
//--------------------------------------------------------------------
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)aName
inFramework:(NSString*)aFrameworkName
{
return [GSWApp stringsTableNamed:aName
inFramework:aFrameworkName
languages:[self languages]];
}
//--------------------------------------------------------------------
//NDFN
-(NSArray*)stringsTableArrayNamed:(NSString*)aName
inFramework:(NSString*)aFrameworkName
{
return [GSWApp stringsTableArrayNamed:aName
inFramework:aFrameworkName
languages:[self languages]];
}
//--------------------------------------------------------------------
//NDFN
-(NSString*)urlForResourceNamed:(NSString*)aName
ofType:(NSString*)extension
inFramework:(NSString*)aFrameworkName;
{
NSString * name;
if ((extension != nil)) {
name = [NSString stringWithFormat:@"%@.%@",aName,extension];
} else {
name = aName;
}
return [GSWApp urlForResourceNamed:name
inFramework:aFrameworkName
languages:[self languages]
request:nil];//TODO
}
//--------------------------------------------------------------------
//NDFN
-(NSString*)pathForResourceNamed:(NSString*)aName
ofType:(NSString*)extension
inFramework:(NSString*)aFrameworkName
{
return [GSWApp pathForResourceNamed:aName
ofType:(NSString*)extension
inFramework:aFrameworkName
languages:[self languages]];
}
//--------------------------------------------------------------------
// templateWithHTMLString:declarationString:languages
@ -1651,10 +1513,14 @@ Call this method before using a component which was cached in a variable.
//--------------------------------------------------------------------
// templateWithHTMLString:declarationString:
//old
+(GSWElement*)templateWithHTMLString:(NSString*)htmlString
declarationString:(NSString*)pageDefString
{
GSOnceMLog(@"%s is depricated in WO 4.0. Use "
@"templateWithHTMLString:declarationString:languages:"
@"instead.",
__PRETTY_FUNCTION__);
return [self templateWithHTMLString:htmlString
declarationString:pageDefString
languages:nil];

View file

@ -33,7 +33,6 @@
#define _GSWComponentDefinition_h__
@class GSWElement;
@class GSWBundle;
@class GSWComponent;
@class GSWContext;
@class GSWComponentReference;
@ -58,14 +57,15 @@
NSDictionary * _archive;
NSStringEncoding _encoding;
BOOL _isStateless;
GSWBundle * _bundle;
GSWComponent * _sharedInstance;
NSMutableArray * _instancePool;
BOOL _lockInstancePool;
BOOL _hasBeenAccessed;
BOOL _hasContextConstructor;
NSLock * _instancePoolLock;
};
NSDate * _wooReadDate;
NSDate * _htmlReadDate;
}
-(id)initWithName:(NSString*)aName
path:(NSString*)aPath
@ -94,6 +94,11 @@
- (GSWElement *) template;
/*
* returns the contents of the .wod
*/
- (NSDictionary *) archive;
-(NSString*)pathForResourceNamed:(NSString*)aName
ofType:(NSString*)aType
languages:(NSArray*)languages;

View file

@ -30,6 +30,7 @@
#include "GSWeb.h"
#include <GNUstepBase/NSObject+GNUstepBase.h>
#include <GNUstepBase/GSMime.h>
//====================================================================
@ -80,6 +81,8 @@ static GSWContext * TheTemporaryContext;
ASSIGN(_url, baseURL);
ASSIGN(_frameworkName, aFrameworkName);
DESTROY(_language);
DESTROY(_wooReadDate);
DESTROY(_htmlReadDate);
_hasBeenAccessed = NO;
_hasContextConstructor = NO;
_isStateless = NO;
@ -88,10 +91,7 @@ static GSWContext * TheTemporaryContext;
_lockInstancePool = [GSWApp isConcurrentRequestHandlingEnabled];
if ((_name != nil) && (_frameworkName != nil)) {
NSBundle * nsbundle = [NSBundle bundleForClass:NSClassFromString(_className)];
if (nsbundle != nil) {
_componentClass = NSClassFromString(_className);
}
_componentClass = NSClassFromString(_className);
}
myBasePath = [aPath stringByAppendingPathComponent: aName];
ASSIGN(_htmlPath,[myBasePath stringByAppendingPathExtension:@"html"]);
@ -116,25 +116,10 @@ static GSWContext * TheTemporaryContext;
// __PRETTY_FUNCTION__, _name];
// }
_archive = nil;
_encoding = NSUTF8StringEncoding;
_encoding = 0; // to test for real value later
_template = nil;
[self setCachingEnabled:[[GSWApp class] isCachingEnabled]];
_isAwake = NO;
if (_frameworkName == nil) {
_bundle=[[GSWBundle alloc] initWithPath:aPath
baseURL:baseURL
inFrameworkNamed: nil];
} else {
_bundle=[[GSWBundle alloc] initWithPath:aPath
baseURL:baseURL
inFrameworkNamed: _frameworkName];
if (_bundle == nil)
{
[NSException raise:NSInvalidArgumentException
format:@"%s: No framework named '%@'",
__PRETTY_FUNCTION__, _frameworkName];
}
}
_instancePoolLock = [[NSLock alloc] init];
@ -156,10 +141,13 @@ static GSWContext * TheTemporaryContext;
DESTROY(_wodPath);
DESTROY(_wooPath);
DESTROY(_archive);
DESTROY(_bundle);
DESTROY(_sharedInstance);
DESTROY(_instancePool);
DESTROY(_wooReadDate);
DESTROY(_htmlReadDate);
[super dealloc];
};
@ -232,11 +220,10 @@ static GSWContext * TheTemporaryContext;
-(NSString*)description
{
//TODO
return [NSString stringWithFormat:@"<%s %p - name:[%@] bundle:[%@] frameworkName=[%@] componentClass=[%@] isCachingEnabled=[%s] isAwake=[%s]>",
return [NSString stringWithFormat:@"<%s %p - name:[%@] frameworkName=[%@] componentClass=[%@] isCachingEnabled=[%s] isAwake=[%s]>",
object_getClassName(self),
(void*)self,
_name,
_bundle,
_frameworkName,
_componentClass,
_caching ? "YES" : "NO",
@ -279,37 +266,8 @@ static GSWContext * TheTemporaryContext;
//--------------------------------------------------------------------
-(void)_clearCache
{
//OK
[_bundle clearCache];
}
//--------------------------------------------------------------------
-(GSWElement*)templateWithName:(NSString*)aName
languages:(NSArray*)languages
{
GSWElement* element=nil;
element=[_bundle templateNamed:aName
languages:languages];
return element;
};
//--------------------------------------------------------------------
-(NSString*)pathForResourceNamed:(NSString*)aName
ofType:(NSString*)aType
languages:(NSArray*)languages
{
NSString* path=nil;
path=[_bundle pathForResourceNamed:aName
ofType:aType
languages:languages];
return path;
};
// CHECKME
-(GSWComponent*) _componentInstanceInContext:(GSWContext*) aContext
@ -475,24 +433,9 @@ static GSWContext * TheTemporaryContext;
{
BOOL createClassesOk=NO;
NSString* superClassName=nil;
if (!WOStrictFlag)
{
// Search component archive for a superclass (superClassName keyword)
NSDictionary* archive=[_bundle archiveNamed:_name];
superClassName=[archive objectForKey:@"superClassName"];
if (superClassName)
{
if (!NSClassFromString(superClassName))
{
ExceptionRaise(NSGenericException,@"Superclass %@ of component %@ doesn't exist",
superClassName,
_name);
};
};
};
// If we haven't found a superclass, use GSWComponent as the superclass
if (!superClassName)
superClassName=@"GSWComponent";
superClassName=@"WOComponent";
// Create class
createClassesOk=[GSWApplication createUnknownComponentClasses:[NSArray arrayWithObject:_name]
superClassName:superClassName];
@ -518,27 +461,18 @@ static GSWContext * TheTemporaryContext;
return componentReference;
};
//--------------------------------------------------------------------
//NDFN
-(NSDictionary*)componentAPI
{
NSDictionary* componentAPI=nil;
componentAPI=[_bundle apiNamed:_name];
return componentAPI;
};
//--------------------------------------------------------------------
-(void) finishInitializingComponent:(GSWComponent*)component
{
NSDictionary* archive=nil;
archive = [_bundle archiveNamed:_name];
NSDictionary * archive=nil;
NSBundle * bundle = [NSBundle bundleForClass:NSClassFromString(_className)];
archive = [self archive];
if (archive) {
[_bundle initializeObject:component
fromArchive:archive];
[bundle initializeObject:component
fromArchive:archive];
}
}
@ -579,33 +513,161 @@ static GSWContext * TheTemporaryContext;
[self notImplemented: _cmd]; //TODOFN
};
- (GSWElement *) template
/*
* returns the contents of the .woo
*/
- (NSDictionary *) archive
{
BOOL htmlChangedOnDisk = NO;
BOOL wodChangedOnDisk = NO;
BOOL doCache = [self isCachingEnabled];
if (doCache == NO) {
htmlChangedOnDisk = YES; // todo compare last chage date with load date
if (_htmlPath != nil && !htmlChangedOnDisk) {
wodChangedOnDisk = YES; // todo compare last chage date with load date
if ((_caching) && (_archive)) {
// nothing to waste time with.
return _archive;
} else {
NSFileManager * defaultManager = [NSFileManager defaultManager];
NSDictionary * attributes;
NSDate * modDate;
attributes = [defaultManager attributesOfItemAtPath:_wooPath error:NULL];
modDate = [attributes fileModificationDate];
// file not found.
if (!modDate) {
modDate = [NSDate date];
ASSIGN(_wooReadDate, modDate);
ASSIGN(_archive, [NSDictionary dictionary]);
return _archive;
}
if ((!_wooReadDate) || (([modDate compare:_wooReadDate] == NSOrderedDescending))) {
ASSIGN(_wooReadDate, [NSDate date]);
ASSIGN(_archive, [NSDictionary dictionaryWithContentsOfFile:_wooPath]);
}
}
if (_htmlPath != nil && (_template == nil || htmlChangedOnDisk || wodChangedOnDisk)) {
return _archive;
}
-(NSStringEncoding) encoding
{
NSDictionary * archive = nil;
NSString * encodingName = nil;
if ((_encoding == 0)) {
_encoding = [GSWMessage defaultEncoding]; // safer, because we may not have a .woo file
archive = [self archive];
if (archive)
{
encodingName = [archive objectForKey:@"encoding"];
if (encodingName)
{
_encoding = [GSMimeDocument encodingFromCharset:encodingName];
if ((_encoding == 0)) {
[NSException raise: NSInvalidArgumentException
format: @"%s %@ -- unknown encoding '%@'",__PRETTY_FUNCTION__, _wooPath, encodingName];
}
}
}
}
return _encoding;
}
- (GSWElement *) _lockedTemplate
{
//OK
GSWElement* template=nil;
NSStringEncoding encoding = [self encoding];
NSString* pageDefString=nil;
NSString* htmlString = [NSString stringWithContentsOfFile:_htmlPath
encoding:encoding];
if (!htmlString)
{
[NSException raise:NSInvalidArgumentException
format:@"%s: No HTML file found at '%@'",
__PRETTY_FUNCTION__, _htmlPath];
}
pageDefString = [NSString stringWithContentsOfFile:_wodPath
encoding:encoding];
if (!pageDefString) {
[NSException raise:NSInvalidArgumentException
format:@"%s: No WOD file found at '%@'",
__PRETTY_FUNCTION__, _wodPath];
}
NS_DURING
{
template=[GSWTemplateParser templateNamed:_name
inFrameworkNamed:nil
withParserType:GSWTemplateParserType_Default
parserClassName:nil
withString:htmlString
encoding:encoding
fromPath:nil
declarationsString:pageDefString
languages:nil
declarationsPath:nil];
}
NS_HANDLER
{
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"In template Parsing");
[localException raise];
}
NS_ENDHANDLER;
return template;
}
- (GSWElement *) template
{
BOOL htmlChangedOnDisk = NO;
// _htmlReadDate
if (_caching == NO) {
htmlChangedOnDisk = YES;
} else {
NSFileManager * defaultManager = [NSFileManager defaultManager];
NSDictionary * attributes;
NSDate * modDate;
attributes = [defaultManager attributesOfItemAtPath:_wooPath error:NULL];
modDate = [attributes fileModificationDate];
if ((!_htmlReadDate) || (([modDate compare:_htmlReadDate] == NSOrderedDescending))) {
htmlChangedOnDisk = YES;
} else {
attributes = [defaultManager attributesOfItemAtPath:_wodPath error:NULL];
modDate = [attributes fileModificationDate];
if (([modDate compare:_htmlReadDate] == NSOrderedDescending)) {
htmlChangedOnDisk = YES;
}
}
}
if (_htmlPath != nil && (_template == nil || htmlChangedOnDisk)) {
ASSIGN(_htmlReadDate, [NSDate date]);
NS_DURING
[TemplateLock lock];
DESTROY(_template);
_template = RETAIN([_bundle templateNamed: _name
languages:nil]); // _language? array?
_template = RETAIN([self _lockedTemplate]);
[TemplateLock unlock];
NS_HANDLER
NS_HANDLER
DESTROY(_template);
[TemplateLock unlock];
[localException raise];
NS_ENDHANDLER
NS_ENDHANDLER
}
return _template;
}

View file

@ -1519,7 +1519,7 @@ GSWEB_EXPORT BOOL GSWContext_isSenderIDSearchOver(GSWContext* aContext)
}
if ((queryDictionary != nil) && ([queryDictionary count] > 0)) {
aQueryString = [queryDictionary encodeAsCGIFormValuesEscpaeAmpersand:escapeQueryDict];
aQueryString = [queryDictionary encodeAsCGIFormValuesEscapeAmpersand:escapeQueryDict];
}
url = [self _urlWithRequestHandlerKey:[[GSWApp class] directActionRequestHandlerKey]

View file

@ -460,6 +460,7 @@ static SEL appendStringSel = NULL;
int tmpIndex=0;
NSRange protocolEndRange;
NSRange queryStringStartRange=[Left rangeOfString:@"?"];
if (queryStringStartRange.length>0)
{
if (queryStringStartRange.location+1<[Left length])
@ -527,8 +528,9 @@ static SEL appendStringSel = NULL;
ASSIGN(_host,[Left substringToIndex:hostEndRangeSlash.location]);
//NSDebugMLLog(@"low",@"host [%@]",_host);
if (hostEndRangeSlash.location+hostEndRangeSlash.length<[Left length])
{
Left=[Left substringFromIndex:hostEndRangeSlash.location+hostEndRangeSlash.length-1];//Keep the '/'
else
} else
Left=nil;
//NSDebugMLLog(@"low",@"Left [%@]",Left);
}
@ -638,13 +640,13 @@ static SEL appendStringSel = NULL;
};
};
};
//NSDebugMLLog(@"low",@"url=%@",_url);
//NSDebugMLLog(@"low",@"prefix=%@",_prefix);
//NSDebugMLLog(@"low",@"applicationName=%@",_applicationName);
//NSDebugMLLog(@"low",@"applicationNumberString=%@",_applicationNumberString);
//NSDebugMLLog(@"low",@"requestHandlerKey=%@",_requestHandlerKey);
//NSDebugMLLog(@"low",@"queryString=%@",_queryString);
//NSDebugMLLog(@"low",@"requestHandlerPath=%@",_requestHandlerPath);
// NSLog(@"%s %d _url:'%@'",__PRETTY_FUNCTION__, __LINE__, _url);
// NSLog(@"%s %d _prefix:'%@'",__PRETTY_FUNCTION__, __LINE__, _prefix);
// NSLog(@"%s %d _applicationName:'%@'",__PRETTY_FUNCTION__, __LINE__, _applicationName);
// NSLog(@"%s %d _applicationNumberString:'%@'",__PRETTY_FUNCTION__, __LINE__, _applicationNumberString);
// NSLog(@"%s %d _requestHandlerKey:'%@'",__PRETTY_FUNCTION__, __LINE__, _requestHandlerKey);
// NSLog(@"%s %d _queryString:'%@'",__PRETTY_FUNCTION__, __LINE__, _queryString);
// NSLog(@"%s %d _requestHandlerPath:'%@'",__PRETTY_FUNCTION__, __LINE__, _requestHandlerPath);
};
/*

View file

@ -169,7 +169,7 @@ void _unpackHeaderLineAddToDict(NSString *line, NSMutableDictionary* headers)
//PRIVATE
void _appendMessageHeaders(GSWMessage * message,NSMutableString * headers)
void _appendMessageHeaders(GSWResponse * message,NSMutableString * headers)
{
NSMutableDictionary * headerDict = [message headers];
NSArray * keyArray = nil;
@ -209,14 +209,17 @@ void _appendMessageHeaders(GSWMessage * message,NSMutableString * headers)
}
//PRIVATE
void _sendMessage(GSWMessage * message, NSFileHandle* fh, NSString * httpVersion, GSWRequest * request, NSMutableString * headers)
void _sendMessage(GSWResponse * message, NSFileHandle* fh, NSString * httpVersion, GSWRequest * request, NSMutableString * headers)
{
int contentLength = 0;
BOOL keepAlive = NO;
BOOL requestIsHead = NO;
NSString * eTagString = nil;
NSString * ifNoneMatchValue;
if (message) {
contentLength = [message _contentLength];
eTagString = [message headerForKey:@"ETag"];
}
if (request) {
@ -225,10 +228,19 @@ void _sendMessage(GSWMessage * message, NSFileHandle* fh, NSString * httpVersion
keepAlive = [connectionValue isEqualToString:KEEP_ALIVE];
}
requestIsHead = [[request method] isEqualToString:HEAD];
ifNoneMatchValue = [request headerForKey:@"if-none-match"];
}
if ([ifNoneMatchValue isEqualToString:eTagString]) {
// return 304 Not Modified
[message setStatus:304];
}
[headers appendString:GSWIntToNSString([message status])];
[headers appendString:URIResponseString];
_appendMessageHeaders(message,headers);
if ([httpVersion isEqualToString:HTTP11]) {
// bug #24006 keep-alive is not implemented.
// I am uable to reproduce the need for double clicking on links/forms,
@ -239,7 +251,7 @@ void _sendMessage(GSWMessage * message, NSFileHandle* fh, NSString * httpVersion
[headers appendString:@"connection: keep-alive\r\n"];
}
}
if ((contentLength > 0) || _alwaysAppendContentLength) {
[headers appendString:CONTENT_LENGTHCOLON];
[headers appendString:[NSString stringWithFormat:@"%d\r\n", contentLength]];
@ -249,7 +261,8 @@ void _sendMessage(GSWMessage * message, NSFileHandle* fh, NSString * httpVersion
[fh writeData: [headers dataUsingEncoding:NSISOLatin1StringEncoding
allowLossyConversion:YES]];
if ((requestIsHead == NO) && (contentLength > 0)) {
if (((requestIsHead == NO) && (contentLength > 0)) &&
([message status] != 304)) {
[fh writeData: [message content]];
}
}
@ -401,7 +414,7 @@ void _sendMessage(GSWMessage * message, NSFileHandle* fh, NSString * httpVersion
method: [requestArray objectAtIndex:0]
length: contentLength];
}
request = [[GSWRequest alloc] initWithMethod:method
uri:[requestArray objectAtIndex:1]
httpVersion:[requestArray objectAtIndex:2]
@ -430,8 +443,6 @@ void _sendMessage(GSWMessage * message, NSFileHandle* fh, NSString * httpVersion
[bufferStr appendString:httpVersion];
[bufferStr appendString:SPACE];
[bufferStr appendString:GSWIntToNSString([response status])];
[bufferStr appendString:URIResponseString];
_sendMessage(response, fh, httpVersion, request, bufferStr);

View file

@ -110,109 +110,99 @@ RCS_ID("$Id$")
NSString *fileNameValue;
NSString *frameworkName = nil;
NSString *resourceURL;
resourcemanager = [GSWApp resourceManager];
component = GSWContext_component(context);
fileNameValue = [filename valueInComponent:component];
frameworkName
= [GSWHTMLDynamicElement _frameworkNameForAssociation: framework
inComponent: component];
frameworkName = [framework valueInComponent:component];
resourceURL = [context _urlForResourceNamed: fileNameValue
inFramework: frameworkName];
inFramework: frameworkName];
if (resourceURL != nil)
{
NSString *widthStr = nil;
NSString *heightStr = nil;
BOOL calculateWidth = NO;
BOOL calculateHeight = NO;
if (width != nil)
{
NSString *widthStr = nil;
NSString *heightStr = nil;
BOOL calculateWidth = NO;
BOOL calculateHeight = NO;
if (width != nil || height != nil)
{
if (width != nil)
{
id widthValue;
widthValue = [width valueInComponent:component];
if (widthValue)
{
widthStr = NSStringWithObject(widthValue);
}
calculateWidth = (widthStr == nil || [widthStr isEqual:@"*"]);
}
if (height != nil)
{
id heightValue;
heightValue = [height valueInComponent:component];
if (heightValue)
{
heightStr = NSStringWithObject(heightValue);
}
calculateHeight = (heightStr == nil || [heightStr isEqual:@"*"]);
}
}
else
{
calculateWidth = YES;
calculateHeight = YES;
GSOnceMLog(@"%@: No height or width information provided for '%@'. If possible, this information should be provided for best performance.",
NSStringFromClass([self class]), fileNameValue);
}
if (calculateWidth || calculateHeight)
{
GSWImageInfo * imageinfo;
imageinfo = [resourcemanager _imageInfoForUrl: resourceURL
fileName: fileNameValue
framework: frameworkName
languages: [context languages]];
if (imageinfo != nil)
id widthValue;
widthValue = [width valueInComponent:component];
if (widthValue)
{
widthStr = NSStringWithObject(widthValue);
}
calculateWidth = (widthStr == nil || [widthStr isEqual:@"*"]);
}
if (height != nil)
{
id heightValue;
heightValue = [height valueInComponent:component];
if (heightValue)
{
heightStr = NSStringWithObject(heightValue);
}
calculateHeight = (heightStr == nil || [heightStr isEqual:@"*"]);
}
if (calculateWidth || calculateHeight)
{
GSWImageInfo * imageinfo;
GSOnceMLog(@"%@: No height or width information provided for '%@'. If possible, this information should be provided for best performance.",
NSStringFromClass([self class]), fileNameValue);
imageinfo = [resourcemanager _imageInfoForUrl: resourceURL
fileName: fileNameValue
framework: frameworkName
languages: [context languages]];
if (imageinfo != nil)
{
if (calculateWidth)
{
widthStr = [imageinfo widthString];
}
{
widthStr = [imageinfo widthString];
}
if (calculateHeight)
{
heightStr = [imageinfo heightString];
}
{
heightStr = [imageinfo heightString];
}
}
else
else
{
NSLog(@"%@: Could not get height/width information for image at '%@' '%@' '%@'",
NSStringFromClass([self class]), resourceURL,
fileNameValue, frameworkName);
fileNameValue, frameworkName);
}
}
[response _appendTagAttribute: @"src"
value: resourceURL
escapingHTMLAttributeValue: NO];
if (widthStr != nil)
{
[response _appendTagAttribute: @"width"
value: widthStr
escapingHTMLAttributeValue: NO];
}
if (heightStr != nil)
{
[response _appendTagAttribute: @"height"
value: heightStr
escapingHTMLAttributeValue: NO];
}
}
else
[response _appendTagAttribute: @"src"
value: resourceURL
escapingHTMLAttributeValue: NO];
if (widthStr != nil)
{
NSString *message
= [resourcemanager errorMessageUrlForResourceNamed: fileNameValue
inFramework: frameworkName];
[response _appendTagAttribute:@"src"
value: message
escapingHTMLAttributeValue:NO];
[response _appendTagAttribute: @"width"
value: widthStr
escapingHTMLAttributeValue: NO];
}
if (heightStr != nil)
{
[response _appendTagAttribute: @"height"
value: heightStr
escapingHTMLAttributeValue: NO];
}
}
else
{
NSString *message
= [resourcemanager errorMessageUrlForResourceNamed: fileNameValue
inFramework: frameworkName];
[response _appendTagAttribute:@"src"
value: message
escapingHTMLAttributeValue:NO];
}
}
// used from GSWActiveImage

View file

@ -462,26 +462,20 @@ RCS_ID("$Id$")
GSWAssociation* actionAssociation=nil;
NSArray* regions=nil;
if (_imageMapFileName)
{
id imageMapFileNameValue=[_imageMapFileName valueInComponent:component];
NSString* imageMapFilePath;
imageMapFilePath=[[GSWApp resourceManager] pathForResourceNamed:imageMapFileNameValue
inFramework:nil
languages:[aContext languages]];
if (imageMapFilePath)
regions=[GSWGeometricRegion geometricRegionsWithFile:imageMapFilePath];
else
{
id imageMapFileNameValue=[_imageMapFileName valueInComponent:component];
NSString* imageMapFilePath=[component
pathForResourceNamed:imageMapFileNameValue
ofType:nil];
if (!imageMapFilePath)
{
GSWResourceManager* resourceManager=[[GSWApplication application]resourceManager];
NSArray* languages=[aContext languages];
imageMapFilePath=[resourceManager pathForResourceNamed:imageMapFileNameValue
inFramework:nil
languages:languages];
};
if (imageMapFilePath)
regions=[GSWGeometricRegion geometricRegionsWithFile:imageMapFilePath];
else
{
//NSDebugMLLog0(@"gswdync",@"GSWActiveImage No image Map.");
};
}
//NSDebugMLLog0(@"gswdync",@"GSWActiveImage No image Map.");
};
}
else if (!WOStrictFlag && _imageMapString)
{
id imageMapValue=[_imageMapString valueInComponent:component];

View file

@ -57,128 +57,35 @@ GSWEB_EXPORT NSDictionary* globalMime;
};
-(NSString*)description;
-(void)_initFrameworkProjectBundles;
//-(NSString*)frameworkNameForPath:(NSString*)path_;
-(NSString*)pathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName
languages:(NSArray*)languages;
-(NSString*)urlForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName
languages:(NSArray*)languages
request:(GSWRequest*)request;
-(NSString*)stringForKey:(NSString*)key_
/*
* Return value: string from tableName using key to look it up.
* first searches the tableName.strings file in the locale
* subdirectories. languages specifies the search order.
*/
-(NSString*)stringForKey:(NSString*)key
inTableNamed:(NSString*)tableName
withDefaultValue:(NSString*)defaultValue_
withDefaultValue:(NSString*)defaultValue
inFramework:(NSString*)frameworkName
languages:(NSArray*)languages;
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)tableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr;
//NDFN
-(NSDictionary*)stringsTableNamed:(NSString*)tableName
inFramework:(NSString*)frameworkName
languages:(NSArray*)languages;
//NDFN
-(NSArray*)stringsTableArrayNamed:(NSString*)tableName
inFramework:(NSString*)frameworkName
languages:(NSArray*)languages;
-(void)lock;
-(void)unlock;
-(NSString*)lockedStringForKey:(NSString*)key
inTableNamed:(NSString*)tableName
inFramework:(NSString*)framework
languages:(NSArray*)languages;
//NDFN
-(NSDictionary*)lockedStringsTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr;
//NDFN
-(NSString*)lockedStringForKey:(NSString*)aKey
inTableNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr;
//NDFN
-(NSDictionary*)lockedStringsTableNamed:(NSString*)tableName
inFramework:(NSString*)framework
languages:(NSArray*)languages;
//NDFN
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)aTableName
inFramework:(NSString*)aFrameworkName
languages:(NSArray*)languages
foundLanguage:(NSString**)foundLanguagePtr;
//NDFN
-(NSArray*)lockedStringsTableArrayNamed:(NSString*)tableName
inFramework:(NSString*)framework
languages:(NSArray*)languages;
-(NSString*)lockedCachedStringForKey:(NSString*)key
inTableNamed:(NSString*)tableName
inFramework:(NSString*)frameworkName
language:(NSString*)language;
-(NSDictionary*)lockedCachedStringsTableWithName:(NSString*)tableName
inFramework:(NSString*)frameworkName
language:(NSString*)language;
//NDFN
-(NSArray*)lockedCachedStringsTableArrayWithName:(NSString*)tableName
inFramework:(NSString*)frameworkName
language:(NSString*)language;
-(NSDictionary*)lockedStringsTableWithName:(NSString*)tableName
inFramework:(NSString*)frameworkName
language:(NSString*)language;
//NDFN
-(NSArray*)lockedStringsTableArrayWithName:(NSString*)tableName
inFramework:(NSString*)frameworkName
language:(NSString*)language;
-(NSString*)lockedUrlForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName
languages:(NSArray*)languages_
request:(GSWRequest*)request;
-(NSString*)lockedCachedURLForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName
languages:(NSArray*)languages;
-(NSString*)lockedPathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName
languages:(NSArray*)languages;
/** GSWeb specific
Returns the bundle for framework named aFrameworkName or application
bundle if none is found
**/
-(GSWDeployedBundle*)cachedBundleForFrameworkNamed:(NSString*)aFrameworkName;
/** Returns the bundle for framework named aFrameworkName or application
bundle if none is found
**/
-(GSWDeployedBundle*)lockedCachedBundleForFrameworkNamed:(NSString*)name;
-(void)flushDataCache;
-(void)setURLValuedElementData:(GSWURLValuedElementData*)data;
-(void)setData:(NSData*)data
forKey:(NSString*)key
mimeType:(NSString*)type
@ -190,29 +97,32 @@ bundle if none is found
-(NSString*)pathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName
language:(NSString*)language;
-(NSString*)lockedPathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName
language:(NSString*)language;
-(GSWDeployedBundle*)_appProjectBundle;
-(NSArray*)_allFrameworkProjectBundles;
-(void)lockedRemoveDataForKey:(NSString*)key;
-(BOOL)_doesRequireJavaVirualMachine;
-(NSString*)_absolutePathForJavaClassPath:(NSString*)path;
-(GSWURLValuedElementData*)_cachedDataForKey:(NSString*)key;
-(void)lockedCacheData:(GSWURLValuedElementData*)data;
-(NSString*)contentTypeForResourcePath:(NSString*)path;
-(NSArray*)_frameworkClassPaths;
/* Deprecated in WO 4.0.
* Use urlForResourceNamed:inFramework:languages:request: instead.
*/
-(NSString*)urlForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName;
inFramework:(NSString*)frameworkName GS_ATTRIB_DEPRECATED;
/* Deprecated in WO 4.0.
* Use pathForResourceNamed:inFramework:languages: instead.
*/
-(NSString*)pathForResourceNamed:(NSString*)name
inFramework:(NSString*)frameworkName;
inFramework:(NSString*)frameworkName GS_ATTRIB_DEPRECATED;
+(NSString*)GSLanguageFromISOLanguage:(NSString*)ISOLanguage; //NDFN
+(NSArray*)GSLanguagesFromISOLanguages:(NSArray*)ISOlanguages; //NDFN
+(NSString*)ISOLanguageFromGSLanguage:(NSString*)GSLanguage; //NDFN
+(NSArray*)ISOLanguagesFromGSLanguages:(NSArray*)GSlanguages; //NDFN
+(GSWBundle*)_applicationGSWBundle;
- (NSString*) errorMessageUrlForResourceNamed:(NSString *) resourceName
inFramework:(NSString *) frameworkName;

File diff suppressed because it is too large Load diff

View file

@ -44,10 +44,6 @@
-(GSWResponse*)_generateResponseForData:(NSData*)aData
mimeType:(NSString*)mimeType;
@end
//====================================================================
@interface GSWResourceRequestHandler (GSWRequestHandlerClassAA)
+(id)handler;
@end

View file

@ -38,27 +38,108 @@ RCS_ID("$Id$")
//====================================================================
@implementation GSWResourceRequestHandler
//--------------------------------------------------------------------
-(GSWResponse*)_404ResponseForPath:(NSString*)aPath
{
GSWResponse * aResponse = [GSWApp createResponseInContext:nil];
[aResponse setStatus:404];
[aResponse setHeader:@"0"
forKey:@"content-length"];
return aResponse;
}
-(NSString*) _filepathForUripath:(NSString*) uri
{
// testpic.jpg
NSString * filePath = nil;
NSString * framework = nil;
NSRange range = [uri rangeOfString:@"/"];
if ((range.location == NSNotFound)) {
// app wrapper resource
framework = nil;
} else {
framework = [uri substringToIndex:range.location];
range = [uri rangeOfString:@"/"
options:NSBackwardsSearch];
if ((range.location != NSNotFound)) {
uri = [uri substringFromIndex:range.location+1];
}
}
range = [uri rangeOfString:@".."
options:NSBackwardsSearch];
if ((range.location != NSNotFound)) {
[NSException raise:NSInvalidArgumentException
format:@"Resource paths containing '..' are not accepted."];
}
range = [uri rangeOfString:@"~'"
options:NSBackwardsSearch];
if ((range.location != NSNotFound)) {
[NSException raise:NSInvalidArgumentException
format:@"Resource paths containing '~' are not accepted."];
}
range = [uri rangeOfString:@".wo"
options:NSBackwardsSearch];
if ((range.location != NSNotFound)) {
[NSException raise:NSInvalidArgumentException
format:@"Resource paths containing '.wo' are not accepted."];
}
range = [uri rangeOfString:@".wod"
options:NSBackwardsSearch];
if ((range.location != NSNotFound)) {
[NSException raise:NSInvalidArgumentException
format:@"Resource paths containing '.wod' are not accepted."];
}
filePath = [[GSWApp resourceManager] pathForResourceNamed:uri
inFramework:framework
language:nil];
return filePath;
}
-(GSWResponse*)handleRequest:(GSWRequest*)aRequest
{
//OK
// /GSWeb/ObjCTest3.gswa/wr?gswdata=0
GSWResponse* response=nil;
NSString* gswdata=nil;
NSDictionary* elements=nil;
NSString * wodataValue=nil;
NSDictionary * elements=nil;
NSString * uri = nil;
NSString * urlRequestHandlerPath = nil;
NSString * filePath = nil;
elements=[aRequest uriOrFormOrCookiesElements];
gswdata=[elements objectForKey:GSWKey_Data[GSWebNamingConv]];
uri = [aRequest uri];
urlRequestHandlerPath = [uri urlRequestHandlerPath];
if (gswdata)
response=[self _responseForDataCachedWithKey:gswdata];
else
// elements=[aRequest uriOrFormOrCookiesElements];
// gswdata=[elements objectForKey:GSWKey_Data[GSWebNamingConv]];
wodataValue = [aRequest stringFormValueForKey:@"wodata"];
if (wodataValue)
{
ExceptionRaise0(@"GSWResourceRequestHandler",@"No data key in request");
};
response = [self _responseForDataCachedWithKey:wodataValue];
} else {
filePath = [self _filepathForUripath:urlRequestHandlerPath];
response = [self _responseForDataAtPath:filePath];
}
[[NSNotificationCenter defaultCenter] postNotificationName:DidHandleRequestNotification
object:response
userInfo:nil];
[response _finalizeInContext:nil];
return response;
};
}
//--------------------------------------------------------------------
-(GSWResponse*)_responseForJavaClassAtPath:(NSString*)aPath
@ -70,9 +151,36 @@ RCS_ID("$Id$")
//--------------------------------------------------------------------
-(GSWResponse*)_responseForDataAtPath:(NSString*)aPath
{
[self notImplemented: _cmd]; //TODOFN
return nil;
};
NSUInteger fileLength = 0;
NSString * contentType;
NSData * fileData;
GSWResponse * aResponse;
fileData = [NSData dataWithContentsOfFile:aPath];
if (!fileData) {
return [self _404ResponseForPath:aPath];
}
contentType = [[GSWApp resourceManager] contentTypeForResourcePath:aPath];
aResponse = [GSWApp createResponseInContext:nil];
[aResponse setStatus:200];
[aResponse setHeader:[NSString stringWithFormat:@"%d",[fileData length]]
forKey:@"content-length"];
if (contentType)
{
[aResponse setHeader:contentType
forKey:@"content-type"];
}
[aResponse setContent:fileData];
return aResponse;
}
//--------------------------------------------------------------------
-(GSWResponse*)_responseForDataCachedWithKey:(NSString*)aKey
@ -106,10 +214,6 @@ RCS_ID("$Id$")
return nil;
};
@end
//====================================================================
@implementation GSWResourceRequestHandler (GSWRequestHandlerClassA)
//--------------------------------------------------------------------
+(id)handler

View file

@ -101,7 +101,9 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
@"text/calendar",
@"text/x-vcalendar",
@"text/enriched",
@"text/directory",nil]));
@"text/directory",
@"image/svg+xml",
nil]));
};
};
@ -277,6 +279,14 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
dataLength=[self _contentLength];
if (dataLength>0) {
NSString * eTagString = [NSString stringWithFormat:@"%lx",
(unsigned long) [_contentData hash]];
[self setHeader:eTagString
forKey:@"ETag"];
}
// Now we see if we can gzip the content
// it does not make sense to compress data less than 150 bytes.
if ((dataLength > 150) && ([self _browserSupportsCompression:[aContext request]]))

View file

@ -99,7 +99,7 @@
@class GSWStatisticsStore;
@class GSWRequestHandler;
@class GSWComponentDefinition;
@class GSWBundle;
//@class GSWBundle;
@class GSWMultiKeyDictionary;
@class GSWCookie;
@class GSWElementID;
@ -122,7 +122,6 @@
@class GSWDeclaration;
@class GSWDeclarationParser;
@class GSWDynamicGroup;
@class GSWBundle;
@class GSWSessionTimeOutManager;
@class GSWServerSessionStore;
@class GSWDeployedBundle;

View file

@ -12,6 +12,7 @@
"tif" = "image/tiff";
"tiff" = "image/tiff";
"jpeg" = "image/jpeg";
"svg" = "image/svg+xml";
// Audio types
"au" = "audio/basic";

View file

@ -34,6 +34,7 @@ DynamicElements_GSWAPP_INFO_PLIST=Resources/Info-DynamicElements.plist
DynamicElements_RESOURCE_FILES = \
Resources/Info-DynamicElements.plist \
DynamicElements_WEBSERVER_RESOURCE_FILES = testpic.jpg
# The Objective-C source files to be compiled
DynamicElements_OBJC_FILES = \
@ -53,7 +54,8 @@ PopUpButton2Page.m \
TextField1Page.m \
CheckBox1Page.m \
CheckBox2Page.m \
RadioButton1Page.m
RadioButton1Page.m \
ImagePage.m
DynamicElements_COMPONENTS = \
Main.wo \
@ -69,7 +71,8 @@ PopUpButton2Page.wo \
TextField1Page.wo \
CheckBox1Page.wo \
CheckBox2Page.wo \
RadioButton1Page.wo
RadioButton1Page.wo \
ImagePage.wo
-include Makefile.preamble

View file

@ -0,0 +1,39 @@
/** ImagePage.h - <title>GSWeb Testing: Class GSWImage</title>
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: David Wetzel <dave@turbocat.de>
$Revision: 15261 $
$Date: 2002-12-06 06:28:27 -0800 (Fr, 06 Dez 2002) $
$Id: CheckBox2Page.h 15261 2002-12-06 14:28:27Z mguesdon $
This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</license>
**/
#ifndef _ImagePage_h__
#define _ImagePage_h__
@interface ImagePage: BasePage
{
}
@end
#endif //_ImagePage_h__

View file

@ -0,0 +1,38 @@
/** ImagePage.m - <title>GSWeb Testing: Class GSWImage</title>
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: David Wetzel <dave@turbocat.de>
$Revision: 30689 $
$Date: 2010-06-11 18:18:12 -0700 (Fr, 11 Jun 2010) $
$Id: CheckBox2Page.m 30689 2010-06-12 01:18:12Z dwetzel $
This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</license>
**/
#include <WebObjects/WebObjects.h>
#include "BasePage.h"
#include "ImagePage.h"
@implementation ImagePage
@end

View file

@ -0,0 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GSW Image Test</title>
</head>
<body>
<h2>GSWImage Test 1 (Web server resources)</h2>
<br/>
<webobject name="TestImage"></webobject>
<hr/>
<webobject name="MainPageLink"></webobject>
</body>
</html>

View file

@ -0,0 +1,11 @@
MainPageLink: WOHyperlink
{
pageName = "Main";
string = "Main Page";
}
TestImage: WOImage
{
filename = "testpic.jpg";
alt = "test";
}

View file

@ -0,0 +1 @@
{"WebObjects Release" = "WebObjects 5.0"; encoding = NSUTF8StringEncoding; }

View file

@ -78,6 +78,11 @@
pageName = "RadioButton1Page";
label = "RadioButton 1";
comment = "GSWRadioButton Test 1";
},
{
pageName = "ImagePage";
label = "Image";
comment = "GSWImage Test";
}
);
RadioButtonList = {

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB