Introduction
Server Platform
Application Server
Content Generation
Class Library API
   Runtime System
   WebServer
   Process
   Database
   Page
   Context
   Elements
   Templates
   Menu
   User
   CGI
   Form
   Table
   TreeAdmin
   DirectoryTree
   Application
Manual Index

next | previous

Maxscape::WebServer Package

Member Functions

  1. ApplicationServerDatabaseName
  2. ApplicationServerName
  3. copyFile
  4. createDirectory
  5. Date
  6. Environment
  7. executeFunction
  8. executeMemberFunction
  9. executeObject
  10. executeShellCommand
  11. incrementNodeCounter
  12. inheriteProperties
  13. inheritePropertiesFromRegistry
  14. initializeVirtualServer
  15. listConfiguredServer
  16. lookupProperties
  17. MimeTypesByExtension
  18. moveFile
  19. new
  20. PerlMakeHash
  21. Property
  22. PropertyList
  23. PropertyListByUserGroups
  24. PropertySet
  25. queryNodeCounter
  26. readStaticConfiguration
  27. ReloadRegistry
  28. searchForm
  29. ServerURI
  30. setNodeCounter
  31. setSiteNames
  32. setupRegistry
  33. SiteName
  34. TemplateTypeTemplateNames
  35. Ticker
  36. TimeAsString
  37. TimeDurationToSeconds
  38. TimeStringAsTime
  39. TotalBalance
  40. UserGroupExists
  41. UserGroupsAsString
  42. virtualAddress
  43. virtualServerHomeURI
  44. Year

Synopsis

use Maxscape::WebServer;

Description

The Maxscape::WebServer package provides the functionality and generic functions of the Maxscape Web Server. It is the basic package that supplies the run time system, as well as the application servers with the neccesary configuration data.

A global $::WebServer object is created in the initialisation phase and updated in order to the setup. It is defined in the main package, so it can be used within templates, elements and functions. You may add your own data to this object, but be carefull not to overwrite nesseccary entries.

The $::WebServer object is used to store server and application process information, via the following mechanism:

1. Inhale the Maxscape global configuration file
Read and internalize information from the Maxscape global configuration file '/maxscape/etc/maxscape.cnf'.
2. Inhale the Application Servers configuration files
Read and internalize information from the Application Servers configuration files '/maxscape/server/'App Server'/etc/maxscape.conf'.
3. Lookup the Application Server global data
Lookup the %Maxscape::ServerApplication::ServerInitialisationData' hash /maxscape/server/'App Server'/lib/perl/Maxscape/ServerConfiguration.pm.
4. Lookup the process specific data
Lookup the %::ProcessInitialisationData hash in the file /maxscape/server/'App Server'/lib/perl/Maxscape/ProcssApplication.pm.
5. Lookup the WEB_SERVER table of the related application server's database
The table is loaded in dependency of the 'WebServer.lookupWebServerTable' variable setting.

Already defined values are overridden by the next level. To access data use the the $::WebServer->Property() method. Examples:

ServerName: $::WebServer->Property ("ServerName");
ServerPort: $::WebServer->Property("ServerPort");
ServerAddress: $::WebServer->Property("ServerAddress");
ScriptName: $::WebServer->Property("ScriptName");
DocumentRoot: $::WebServer->Property("DocumentRoot");

new

Synopsis

use Maxscape::WebServer;
$WebServer = Maxscape::WebServer->new();

Description

Creates a new Maxscape::WebServer object. If no parameter are given, set the variables $WebServer->{WebServerName} and $WebServer->{DatabaseName} to the 'application server' names.

Since a global '$::WebServer' is created by the system, application functions must not call the 'Maxscape::WebServer->new()' function.

initializeVirtualServer

Synopsis

unless ($WebServer->initializeVirtualServer()) {
  # error
  # ...
}

Description

Initializes an application server.

readStaticConfiguration

Synopsis

my $ServerInitialisationData = $WebServer->readStaticConfiguration();

Description

Reads the various configuration files, e.g. /maxscape/etc/maxscape.cnf, /maxscape/server/'AppServer'/etc/maxscape.cnf.

setupRegistry

Synopsis

$WebServer->setupRegistry();

Description

Sets up the registry, as defined by the configuration files, as well the configuration, stored in the database.

inheriteProperties

Synopsis

$WebServer->inheriteProperties($HashReference);

Description

Adds the keys and values of the taken hash reference to the 'WebServer' object.

inheritePropertiesFromRegistry

Synopsis

$WebServer->inheritePropertiesFromRegistry($Context);

Description

Inherites properties from the registry to the $Context object.

lookupProperties

Synopsis

$WebServer->lookupProperties($Cursor, $WebServerName);

Description

Fetches the properties of the given 'application server' from the 'WEB_SERVER' database table.

ReloadRegistry

Synopsis

my $HasChanged = $WebServer->ReloadRegistry($Cursor, $WebServerName);

Description

Reloads the registry.

listConfiguredServer

Synopsis

my $ConfiguredServers = $WebServer->listConfiguredServer();

Description

Returns the list of configurated application servers.

incrementNodeCounter

Synopsis

my ($PageNr, $ErrorText) = $WebServer->incrementNodeCounter ($Cursor,
                                         $WebServerName}, $NodeCounterName);

Description

Increments the related node counter when pages, templates or categories are added to the page tree.

queryNodeCounter

Synopsis

my ($NodeCounterValue, $ErrorText) = $WebServer->queryNodeCounter ($Cursor,
                                       $WebServerName, $NodeCounterName);

Description

Queries the related node counter and returns it's value.

setNodeCounter

Synopsis

my $ErrorText = $self->{Server}->setNodeCounter ($Cursor, $WebServerName,
                                   $NodeCounterName, ($NewPageNumber + 1));

Description

Sets the related node counter.

TotalBalance

Synopsis

my ($TotalBalance, $ErrorText) = $WebServer->TotalBalance(Cursor => $Cursor,
                                   action => 'add', Value => $P{value},);

Description

For future use.

ApplicationServerName

Synopsis

my $ApplicationServerName = $WebServer->ApplicationServerName;

Description

Return the name of the current application server.

ApplicationServerDatabaseName

Synopsis

my $ApplicationServerDatabaseName = $::WebServer->ApplicationServerDatabaseName;

Description

Return the name of the content database of the current application server.

Property

Synopsis

my $myProperty      = $WebServer->Property ('myProperty');
my $defaultPageName = $WebServer->Property ('Page.defaultName');

Description

Returns the value of the given application server property. The property must be defined in in the configuration files, one of the related configuration hashes or in the WEB_SERVER table (set the variable 'WebServer.lookupWebServerTable').

Examples

@{[
$::WebServer->Property ('HTTPD_ServerName')
]}

PropertyList

Synopsis

my $PageTypes = $::WebServer->PropertyList ($PropertyName);

Description

Returns a reference to a list of values from the given application server property. The property must be defines in the following form: val1;val2;val3;... (list values are separated by the reqular expression '\s*;\n*\s*').

Examples

my $PageTypes = $::WebServer->PropertyList ('Page.Type');
my $Default = ${$PageTypes}[0];

PropertyListByUserGroups

Synopsis

my $PageTypes = $::WebServer->PropertyListByUserGroups ($PropertyName);

Description

Returns a reference to a list of values from the given application server property. The property must be defines in the following form: val1;val2;val3;... (list values are separated by the reqular expression '\s*;\n*\s*').

Examples

my $PageTypes = $::WebServer->PropertyListByUserGroups ('Page.Type');
my $Default = ${$PageTypes}[0];

PropertySet

Synopsis

my $isSet = $WebServer->PropertySet ('foo', 'bar');

Description

Returs true, if the properties parameter 'foo' is defined. The property foo has the form foo = 'joe|bar|boo';

UserGroupsAsString

Synopsis

my $UserGroupsAsString = $WebServer->UserGroupsAsString();

Description

Groups are defined in '/maxscape/etc/maxscape.conf' and the WEB_SERVER database table. 'UserGroupsAsString' gethers them into a string.

Examples

my $AllUserGroups = $WebServer->UserGroupsAsString ();

UserGroupExists

Synopsis

my $UserGroupExists = $WebServer->UserGroupExists();

Description

Checks if a user group exits.

Environment

Synopsis

my $Environment = $WebServer->Environment();

Description

Returns the environment variables.

ServerURI

Synopsis

my $HTTPD_ServerName = $WebServer->ServerURI();

Description

Returns the 'HTTPD_ServerName' property.

virtualServerHomeURI

Synopsis

my $virtualServerHomeURI = $WebServer->virtualServerHomeURI();

Description

Returns the home URI of the current application server as a string. $virtualServerHomeURI contains something like: https://www.myScape.org:4711 Depreciated function virtualServerHomeURI chg to virtualAddress!

virtualAddress

Synopsis

my $virtualAddress = $WebServer->virtualAddress (Sheme => $Sheme,
                                                 Port  => $Port);

Description

Returns the home URI of the current application server as a string. $virtualServerHomeURI contains something like: https://www.myScape.org:4711

SiteName

Synopsis

my $SiteName = $WebServer->SiteName();

Description

Returns the server's site name.

setSiteNames

Synopsis

$WebServer->setSiteNames();

Description

Sets the server's site names.

TimeDurationToSeconds

Synopsis

my $Seconds = $::WebServer->TimeDurationToSeconds ($Duration);

Description

Returns the $Duration as seconds.

Date

Synopsis

my $TimeAsString = $::WebServer->TimeAsString ($Time);
my $NowAsString = $::WebServer->TimeAsString ();

Description

Returns the the Date as a string. If $Time is ommited, returns the local time. $Time is the number of seconds since whatever time the system considers to be the epoch (that's 00:00:00 UTC, January 1, 1970 for UNIX).

TimeAsString

Synopsis

my $TimeAsString = $::WebServer->TimeAsString ($Time);
my $NowAsString = $::WebServer->TimeAsString ();

Description

Returns the time as string. If $Time is ommited, returns the local time. $Time is the number of seconds since whatever time the system considers to be the epoch (that's 00:00:00 UTC, January 1, 1970 for UNIX).

TimeStringAsTime

Synopsis

my $DateAndTimeInSeconds = $::WebServer->TimeStringAsTime (
                               $Page->lastModificationTimeAsString()
                           );

Description

Returns the time as string. If $Time is ommited, returns the local time.

Year

Synopsis

my $Year     = $::WebServer->Year ($Time);
my $thisYear = $::WebServer->Year ();

Description

Returns the actual year.

executeShellCommand

Synopsis

my $Command = "ls -l";
$Text = $::WebServer->executeShellCommand($Command);

my $Command = "(cd $DirectoryFullPath; rm -f ./$ToBeDeleted; )";
my $ErrText = $::WebServer->executeShellCommand($Command);
if ($ErrText) {
  return ('Image.Dir.Template.deleteImage', $!, $ErrText);
}

Description

Execute the taken unix shell command in a sub process and returns the commands output.

executeFunction

Synopsis

$Text = $WebServer->executeFunction ($Function, $Object, $Parameter);

Description

Executes a function.

executeMemberFunction

Synopsis

$Text = $WebServer->executeMemberFunction ($Function, $Object, $Parameter);

Description

Executes a member function of an object.

executeObject

Synopsis

$Text = $WebServer->executeObject ($ClassName, $MemberFunction, $Parameter);

Description

Executes a member function of an object.

copyFile

Synopsis

$Text = $::WebServer->copyFile ($Command);

Description

Copies a file.

moveFile

Synopsis

$Text = $::WebServer->moveFile ($Command);

Description

Moves a file.

createDirectory

Synopsis

$Text = $::WebServer->createDirectory (DirectoryName => 'MyDir',);

Description

Creates a directory.

searchForm

Synopsis

$Text = $WebServer->searchForm ();

Description

Return a search form.

MimeTypesByExtension

Synopsis

%MimeTypes = $::WebServer->MimeTypesByExtension ();

Description

Returns the configured mime types by extension.

PerlMakeHash

Synopsis

my %MimeTypes = $WebServer->PerlMakeHash ($XMLHashText);

Description

Make a Perl hash from an XML text.

Examples

my %MimeTypes = $WebServer->PerlMakeHash ($XMLHashText);
if ($@) {
  $ErrorText = "Error: " . $@;
}

Ticker

Synopsis

my $Ticker = $WebServer->Ticker; 

Description

Returns a ticker ().

TemplateTypeTemplateNames

Synopsis

my @TemplateNames = $::WebServer->TemplateTypeTemplateNames ($TemplateName,
                                                             $TemplateName);

Description

Examples

my $TemplateType = 'DB-Template';
my $TemplateName = 'UserTemplate';

my @TemplateNames = $::WebServer->TemplateTypeTemplateNames ('DB-Template',
                                                             'UserTemplate');

nextprevioustopbecome a membercontact © Maxscape