Playing with WOxExtTest on the desktop

Well, we will start playing with the application WOxExtTest that we have compiled in the previous step.

To launch the application, you can double clic on the application icon, but to choose the port used to communicate with the application, open a terminal window and type:

$ cd /Users/philippe/SOPE-4.5/sopex/Samples/WOxExtTest
$ ./build/Development/WOExtTest.app/Contents/MacOS/WOExtTest -WOPort 20000

[TODO This was supposed to work. I have to check that.
$ ./build/Development/WOExtTest.app/Contents/MacOS/WOExtTest -WOPort 20000 --daemon]

Choose the menu item Debug > Show Statistics (Commande Majuscule S).
Look at the Base url. You should see something like : http://localhost:20000/WOExtTest
You have choosen the port used by the web application : 20000 (remember the -WOPort 20000 ?).

Click on the button to launch your browser. You can now see the application content in Safari.

You may also open a Safari window and enter the following URL: http://localhost:20000/
You will see WOxExtTest application content.
That's fine but we will go a step further and use the URL like: http://localhost/WOExtTest
To do this, we need to associate the application WOExtTest with port 20000.

Setting Apache to serve SOPE applications

To associate the application WOExtTest with port 20000, we will need to inform Apache web server to transfer all http messages to WOExtTest SOPE application. To do this, we will use an Apache module named "ngobjweb_module".

Compiling ngobjweb_module

$ cd /Users/philippe/SOPE-4.5/sope-appserver/mod_ngobjweb/
$ cp GNUmakefile GNUmakefile_original

Modify the make file by commenting the lines with the caracter # (at the start of the file)

$ emacs GNUmakefile

# lowercase are commandline args (eg make apxs=/usr/bin/apxs)
#ifneq ($(apxs),no)
#ifneq ($(apxs),yes)
#ifneq ($(apxs),)
#APXS=$(apxs)
#else
#APXS=$(shell which apxs 2>/dev/null)
#endif
#else
#APXS=$(shell which apxs 2>/dev/null)
#endif
#else
#APXS=
#endif

# lowercase are commandline args (eg make apr=/usr/bin/apr)
#ifneq ($(apr),no)
#ifneq ($(apr),yes)
#ifneq ($(apr),)
#APR=$(apr)
#else
#APR=$(shell which apr-config 2>/dev/null)
#endif
#else
#APR=$(shell which apr-config 2>/dev/null)
#endif
#else
#APR=
#endif

#ifeq ($(APXS),)
#APXS=$(shell which apxs2 2>/dev/null)
#ifeq ($(APXS),)
#APXS   = $(APACHE)/sbin/apxs2
#endif
#endif

Save your file and build the "ngobjweb_module" module.

$ make

You will get a lot of warnings. But well it will work :-).
Verify that you have your module ready.

$ ls *.so
mod_ngobjweb.so

Install the module with other Apache modules:

$ sudo cp mod_ngobjweb.so /usr/libexec/httpd

You can now prepare yourself to modify your httpd.conf file. That will be not difficult once you know what to do.

Modifying your Apache configuration file named httpd.conf

Open a Terminal window and enter:

$ cd /etc/httpd/
$ sudo emacs httpd.conf
# Add the line below after the section where other modules are loaded

LoadModule ngobjweb_module      libexec/httpd/mod_ngobjweb.so

# Add the line below after the section where other modules are added

AddModule ngobjweb_module.c

# At the end of the file, after the line including configuration for all users, add a line to include the file "/etc/httpd/WOExtTest.conf".

Include /private/etc/httpd/users/*.conf

#
# WOExtTest configurations
#
Include /etc/httpd/WOExtTest.conf


Save your file. Create the file WOExtTest.conf that will contain all WOExtTest configurations.

$ cd /etc/httpd/
$ sudo emacs WOExtTest.conf
# [enter the content below]
$ more WOExtTest.conf
#
# WOExtTest configurations
#

Alias /WOExtTest.sopex/WebServerResources/ /Users/philippe/SOPE-4.5/sopex/Samples/WOxExtTest/WebServerResources/

<LocationMatch "^/WOExtTest*">
SetHandler ngobjweb-adaptor
SetAppPort 20000
</LocationMatch>


As you can see, all uri matching the regular expression "^/WOExtTest*" will be redirected to the SOPE application with the handler "ngobjweb-adaptor" at the port "20000".
The web server resources for WOExtTest application will be found at "/Users/philippe/SOPE-4.5/sopex/Samples/WOxExtTest/WebServerResources/"

Restart your Apache web server, so that it can use your settings:

$ sudo /usr/sbin/apachectl stop
$ sudo /usr/sbin/apachectl start
[Wed Mar 29 20:15:40 2006] [warn] Loaded DSO libexec/httpd/mod_ngobjweb.so uses plain Apache 1.3 API, this module might crash under EAPI! (please recompile it with -DEAPI)
Processing config directory: /private/etc/httpd/users/*.conf
 Processing config file: /private/etc/httpd/users/bigadmin.conf
 Processing config file: /private/etc/httpd/users/philippe.conf
/usr/sbin/apachectl start: httpd started

Well, the warning is not causing problem. [This may be fixed ?]

If you don't have launched the WOxExtTest application, do it now. Open a terminal window ant enter:

$ cd /Users/philippe/SOPE-4.5/sopex/Samples/WOxExtTest
$ ./build/Development/WOExtTest.app/Contents/MacOS/WOExtTest -WOPort 20000 &
[1] 467
G5:~/SOPE-4.5/sopex/Samples/WOxExtTest philippe$ 2006-03-29 20:39:29.395 WOExtTest[467] Unknown class 'MLHierarchyView' in nib file, using `NSControl' instead.
2006-03-29 20:39:29.397 WOExtTest[467] Unknown class 'MLHierarchyView' in nib file, using `NSControl' instead.
2006-03-29 20:39:29.486 WOExtTest[467] Note: WOApplication debugging is enabled.
localhost - - [29/Mar/2006:20:39:29 GMT] "GET /WOExtTest HTTP/1.1" 200 1018 0.056 5206 80% -


Launch Safari. As previously, enter the URL: http://localhost:20000/
The displayed page shows the logo and text with css style.

In the terminal window where the application WOExtTest was launched, one can see :
localhost - - [29/Mar/2006:20:21:19 GMT] "GET / HTTP/1.1" 200 1023 0.025 5206 80% -
localhost - - [29/Mar/2006:20:21:19 GMT] "GET /WOExtTest.sopex/WebServerResources/site.css HTTP/1.1" 200 817 0.003 - - -
localhost - - [29/Mar/2006:20:21:19 GMT] "GET /WOExtTest.sopex/WebServerResources/OGoLogo.gif HTTP/1.1" 200 2047 0.003 - - -



You can now use the URL : http://localhost/WOExtTest or http://localhost/WOExtTest/

localhost - - [29/Mar/2006:20:29:18 GMT] "GET /WOExtTest.sopex/WebServerResources/site.css HTTP/1.1" 200 817 0.008 - - -
localhost - - [29/Mar/2006:20:29:18 GMT] "GET /WOExtTest.sopex/WebServerResources/OGoLogo.gif HTTP/1.1" 200 2047 0.003 - - -
127.0.0.1 - - [29/Mar/2006:20:29:27 GMT] "GET /WOExtTest/ HTTP/1.1" 200 1019 0.200 5206 80% -


Note that if you reload the page (with the reload button), the css and images files will not be reloaded (they are in the browser's cache).

127.0.0.1 - - [29/Mar/2006:20:34:54 GMT] "GET /WOExtTest HTTP/1.1" 200 1019 0.023 5206 80% -


If you click on some of the links displayed in the page, you will see the use of an url starting with WOExtTest.sopex.

127.0.0.1 - - [29/Mar/2006:20:43:26 GMT] "GET /WOExtTest.sopex/wo/01D301D302442AD51A/007442ad54c0287a400.3.7.1.3.9 HTTP/1.1" 200 1488 0.133 5562 73% -
127.0.0.1 - - [29/Mar/2006:20:43:30 GMT] "GET /WOExtTest.sopex/wo/01D301D302442AD51A/008442ad54e02892c00.3.13 HTTP/1.1" 200 994 0.191 3958 74% -



Quitting the WOExtTest application, will generated in the terminal window :

[1]+  Done                    ./build/Development/WOExtTest.app/Contents/MacOS/WOExtTest -WOPort 20000