tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Whittington <Tim.Whitting...@orion.co.nz>
Subject PATCH: Multiple Tomcat 3.2 ISAPI redirectors on the one machine
Date Fri, 07 Sep 2001 05:15:24 GMT
Afternoon tomcat-dev (It's late afternoon down here in New Zealand)

We have multiple applications that use the IIS ASAPI redirector to talk to 
Tomcat instances. They all get installed separately and its a pain in the 
arse to find the worker and worker mount files and merge in your settings
during installation.
So I've patched the ISAPI redirector to get the redirector to load it's 
properties from an ini file, with one ini file per filter.

It works like this :
	1) You install the ISAPI filter DLL in a virtual directory.
	2) In the same directory you put a properties file of the same name
(except for the extension)
		i.e. /jakarta/isapi_redirect.dll and
/jakarta/isapi_redirect.ini
	3) The ini file is a property file with exactly the same properties
as used to be put in the registry
	i.e.
	worker_file=C:\tomcat\conf\workers.properties
	worker_mount_file=C:\tomcat\conf\uriworkermap.properties
	log_level=error
	log_file=C:\tomcat\logs\isapi_redirector.log
	extension_uri=/jakarta/isapi_redirect.dll
	4) The filter loads this ini file and gets its settings from it.
	5) If the filter can't find the ini file it uses the registry (old
behaviour) == 1 ASAPI per machine.
	6) You can then install another filter, with another ini file, and
not have the two conflict.
diffs follow ....

One gotcha, the DLL needs shlwapi.dll for the PathRenameExtension (Ships in
IE 4.0)
If this is a problem then someone can hack the ini_file_name string to
overwrite the file extension ...
Also a flag and DEBUG print to indicate whether the ini file is being used
could be useful ....


cheers

tim

-- src/native/iis/asapi.dsp ---
56c56
< # ADD LINK32 wsock32.lib advapi32.lib /nologo /dll /machine:I386
/out:"isapi_release/isapi_redirect.dll"
---
> # ADD LINK32 wsock32.lib advapi32.lib shlwapi.lib /nologo /dll
/machine:I386 /out:"isapi_release/isapi_redirect.dll"
82c82
< # ADD LINK32 wsock32.lib advapi32.lib /nologo /dll /debug /machine:I386
/out:"isapi_debug/isapi_redirect.dll" /pdbtype:sept
---
> # ADD LINK32 wsock32.lib advapi32.lib shlwapi.lib /nologo /dll /debug
/machine:I386 /out:"isapi_debug/isapi_redirect.dll" /pdbtype:sept


-- src/native/iis/jk_isapi_plugin.c ---

61a62,66
> #include <stdio.h>
> #include <stdlib.h>
> #include <windows.h>
> #include <shlwapi.h>
> 
121a127
> static char ini_file_name[_MAX_PATH];
614a621,629
> 	if( GetModuleFileName( hInst, ini_file_name, sizeof( ini_file_name )
) ) {
> 		if( !PathRenameExtension( ini_file_name, ".ini" ) ) {
> 			fReturn = FALSE;
> 		}
> 	} else {
> 		fReturn = FALSE;
> 	}
> 
> 
621a637
> 
628a645,651
>         jk_log(logger, JK_LOG_DEBUG, "Using log file %s.\n", log_file);
>         jk_log(logger, JK_LOG_DEBUG, "Using log level %d.\n", log_level);
>         jk_log(logger, JK_LOG_DEBUG, "Using extension uri %s.\n",
extension_uri);
>         jk_log(logger, JK_LOG_DEBUG, "Using worker file %s.\n",
worker_file);
>         jk_log(logger, JK_LOG_DEBUG, "Using worker mount file %s.\n",
worker_mount_file);
> 
> 
668a692
> 	char *tmp;
669a694,735
>     
> 	jk_map_t *map;
> 	if( map_alloc( &map ) ) {
> 		if( !map_read_properties( map, ini_file_name ) ) {
> 			ok = JK_FALSE;
> 		}
> 	} else {
> 		ok = JK_FALSE;
> 	}
> 	if( ok ) {
> 		tmp = map_get_string( map, JK_LOG_FILE_TAG, NULL );
> 		if(tmp) {
> 			strcpy(log_file, tmp);
> 		} else {
> 			ok = JK_FALSE;
> 		}
> 		tmp = map_get_string( map, JK_LOG_LEVEL_TAG, NULL );
> 		if(tmp) {
> 			log_level = jk_parse_log_level(tmp);
> 		} else {
> 			ok = JK_FALSE;
> 		}
> 		tmp = map_get_string( map, EXTENSION_URI_TAG, NULL );
> 		if(tmp) {
> 			strcpy(extension_uri, tmp);
> 		} else {
> 			ok = JK_FALSE;
> 		}
> 		tmp = map_get_string( map, JK_WORKER_FILE_TAG, NULL );
> 		if(tmp) {
> 			strcpy(worker_file, tmp);
> 		} else {
> 			ok = JK_FALSE;
> 		}
> 		tmp = map_get_string( map, JK_MOUNT_FILE_TAG, NULL );
> 		if(tmp) {
> 			strcpy(worker_mount_file, tmp);
> 		} else {
> 			ok = JK_FALSE;
> 		}
> 	
> 	} else {
725c791
< 
---
> 	}


Mime
View raw message