You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by su...@apache.org on 2008/06/30 06:08:15 UTC
svn commit: r672695 - in
/webservices/axis2/trunk/c/src/core/transport/http/server/IIS:
axis2_iis_regedit.js axis2_iis_worker.c axis2_isapi_plugin.c
iis_iaspi_plugin_51/axis2_isapi_51.c
Author: supun
Date: Sun Jun 29 21:08:15 2008
New Revision: 672695
URL: http://svn.apache.org/viewvc?rev=672695&view=rev
Log:
Fixes to IIS. Introducing new configurations.
Added:
webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_regedit.js
Modified:
webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c
webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_isapi_plugin.c
webservices/axis2/trunk/c/src/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c
Added: webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_regedit.js
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_regedit.js?rev=672695&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_regedit.js (added)
+++ webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_regedit.js Sun Jun 29 21:08:15 2008
@@ -0,0 +1,84 @@
+var WshShell = WScript.CreateObject("WScript.Shell");
+
+/* You can change the following values to suite your requirements */
+/* Axis2/C repo location. axis2.xml, modules folder and services folder should be in this dir */
+var axis2c_home = WshShell.CurrentDirectory;
+/* Log level. Possible values are trace, error, info, critical, user, debug and warning */
+var log_level = "debug";
+/* Full path to the log file */
+var log_file = axis2c_home + "/logs/axis2.log";
+/* Services URL prefix. This is the folder where services are hosted. Optional */
+var services_url_prefix;
+/* Max log file size */
+var max_log_file_size;
+/* Axis2 location */
+var axis2_location;
+
+/* Don't change anything below */
+var axis2c_home_str = "axis2c_home";
+var log_level_str = "log_level";
+var log_file_str = "log_file";
+var services_url_prefix_str = "services_url_prefix";
+var max_log_file_size_str = "max_log_file_size";
+var axis2_location_str = "axis2_location"
+
+var reg_location = "HKLM\\Software\\Apache Axis2C\\IIS ISAPI Redirector\\"
+/* If specified get the values from the command prompt */
+var args = WScript.Arguments;
+if (args.length > 0) {
+ axis2c_home = args.Item(0);
+ if (axis2c_home) {
+ log_file = axis2c_home + "/logs/axis2.log";
+ }
+}
+if (args.length > 1) {
+ log_level = args.Item(1);
+}
+if (args.length > 2) {
+ log_file = args.Item(2);
+}
+if (args.length > 3) {
+ services_url_prefix = args.Item(3);
+}
+if (args.length > 4) {
+ max_log_file_size = args.Item(4);
+}
+if (args.length > 5) {
+ axis2_location = args.Item(5);
+}
+/* Write the axis2c_home entry. This is used by Axis2/C to find the repo location */
+WshShell.RegWrite (reg_location + axis2c_home_str, axis2c_home, "REG_SZ");
+/* Write the log_level registry entry */
+WshShell.RegWrite (reg_location + log_level_str, log_level, "REG_SZ");
+/* Write the log file name */
+WshShell.RegWrite (reg_location + log_file_str, log_file, "REG_SZ");
+/* Write the services url prefix. We write this only if specified */
+try {
+ var services_url_prefix_key = WshShell.RegRead (reg_location + services_url_prefix_str);
+ if (services_url_prefix_key) {
+ WshShell.RegDelete (reg_location + services_url_prefix_str);
+ }
+} catch (e) {}
+if (services_url_prefix) {
+ WshShell.RegWrite (reg_location + services_url_prefix_str, services_url_prefix, "REG_SZ");
+}
+/* We write max_log_file_size only if specified */
+try {
+ var max_log_file_size_key = WshShell.RegRead (reg_location + max_log_file_size_str);
+ if (max_log_file_size_key) {
+ WshShell.RegDelete (reg_location + max_log_file_size_str);
+ }
+} catch (e) {}
+if (max_log_file_size) {
+ WshShell.RegWrite (reg_location + max_log_file_size_str, max_log_file_size, "REG_SZ");
+}
+
+try{
+ var axis2_location_key = WshShell.RegRead (reg_location + axis2_location_str);
+ if (axis2_location_key) {
+ WshShell.RegDelete (reg_location + axis2_location_str);
+ }
+} catch (e) {}
+if (axis2_location) {
+ WshShell.RegWrite (reg_location + axis2_location_str, axis2_location, "REG_SZ");
+}
\ No newline at end of file
Modified: webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c?rev=672695&r1=672694&r2=672695&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c Sun Jun 29 21:08:15 2008
@@ -273,7 +273,7 @@
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "IIS: Unsupported HTTP Method.");
return AXIS2_FAILURE;
}
- /* Set the URL prefix */
+ /* Set the URL prefix. axis2_request_url_prefix is a global variable set at the init time */
request.request_url_prefix = axis2_request_url_prefix;
/* Create the transport out info */
request.out_transport_info = axis2_iis_out_transport_info_create(env, lpECB);
@@ -493,12 +493,9 @@
axis2_status_t AXIS2_CALL axis2_worker_get_original_url(char url[],
char ret_url[])
{
- int i = 0;
- for (i = 0; i < 7; i++)
- ret_url[i] = url[i];
- for (i = 7; url[i] != '\0'; i++)
- ret_url[i] = url[i + 18];
- ret_url[i] = '\0';
+ extern axis2_char_t *axis2_location;
+ strcpy(ret_url, axis2_location);
+ strcat(ret_url, &url[25]);
return URI_MATCHED;
}
Modified: webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_isapi_plugin.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_isapi_plugin.c?rev=672695&r1=672694&r2=672695&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_isapi_plugin.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_isapi_plugin.c Sun Jun 29 21:08:15 2008
@@ -43,7 +43,7 @@
#define AXIS2_IIS_EXTENSION_URI_TAG "extension_uri"
#define AXIS2_IIS_REDIRECT_WORD_TAG "redirect_uri"
#define AXIS2_IIS_AXIS2_LOCATION "axis2_location"
-#define AXIS2_IIS_SERVICE_URL_PREFIX "services"
+#define AXIS2_IIS_SERVICE_URL_PREFIX "services_url_prefix"
#define AXIS2_IIS_LOG_TRACE_VERB "trace"
#define AXIS2_IIS_LOG_ERROR_VERB "error"
@@ -61,8 +61,8 @@
static const axutil_env_t *axutil_env = NULL;
/* Configuration parameters */
-static axis2_char_t *axis2_location = "axis2";
-static axis2_char_t *axis2_service_url_prefix= "services";
+axis2_char_t *axis2_location = "/axis2";
+static axis2_char_t *axis2_service_url_prefix= "/services";
static axis2_char_t repo_path[MAX_FILE_PATH];
static axis2_char_t log_file[MAX_FILE_PATH];
static axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_CRITICAL;
@@ -157,7 +157,7 @@
HSE_EXEC_URL_INFO ExecUrlInfo;
DWORD cbData = INTERNET_MAX_URL_LENGTH;
char url[INTERNET_MAX_URL_LENGTH];
- axis2_bool_t is_for_us = AXIS2_FALSE;
+ axis2_bool_t is_for_us = AXIS2_TRUE;
/* Get the URL */
if ( pecb->GetServerVariable( pecb->ConnID,
@@ -167,75 +167,80 @@
{
return HSE_STATUS_ERROR;
}
+
+ if (!is_inited)
+ {
+ DWORD dwBufferSize = 0;
+ axis2_char_t server_software[256];
+ axis2_char_t *version = NULL;
+
+ ZeroMemory(szOriginalPath, sizeof szOriginalPath);
+ dwBufferSize = sizeof szOriginalPath;
+
+#if _WIN32_WINNT >= 0x0502
+ GetDllDirectory( dwBufferSize, szOriginalPath );
+#else
+ GetCurrentDirectory( dwBufferSize, szOriginalPath );
+#endif
+ ZeroMemory(szPath, sizeof szPath);
+ dwBufferSize = sizeof szPath;
+ /* Get the current physical paht */
+ if (pecb->GetServerVariable(pecb->ConnID, "APPL_PHYSICAL_PATH", szPath, &dwBufferSize) == FALSE)
+ {
+ send_error(pecb, initializing_error);
+ return HSE_STATUS_ERROR;
+ }
+ /* Retrieve the server version */
+ dwBufferSize = 32;
+ if (pecb->GetServerVariable(pecb->ConnID, "SERVER_SOFTWARE", server_software, &dwBufferSize) == FALSE)
+ {
+ send_error(pecb, initializing_error);
+ return HSE_STATUS_ERROR;
+ }
+ version = axutil_strchr(server_software, '/');
+ if (version)
+ {
+ server_version = atoi(version + 1);
+ }
+#if _WIN32_WINNT >= 0x0502
+ SetDllDirectory( szPath );
+#else
+ SetCurrentDirectory( szPath );
+#endif
+ /* If we haven't initialized axis2/c before initialization failed */
+ if (AXIS2_FAILURE == init_axis2())
+ {
+ send_error(pecb, initializing_error);
+ return HSE_STATUS_ERROR;
+ }
+#if _WIN32_WINNT >= 0x0502
+ SetDllDirectory( szOriginalPath );
+#else
+ SetCurrentDirectory( szOriginalPath );
+#endif
+ }
+
/* Check weather we have a request for Axis2/C */
- if (strlen(url) > strlen(axis2_location))
+ if (server_version >= 6 && strlen(url) >= strlen(axis2_location))
{
int i = 0;
is_for_us = AXIS2_TRUE;
while (axis2_location[i] != '\0')
{
- if (axis2_location[i] != (url + 1)[i]) {
+ if (axis2_location[i] != (url)[i]) {
is_for_us = AXIS2_FALSE;
break;
}
i++;
}
+ if (url[i] != '/' && url[i] != '\0')
+ {
+ is_for_us = AXIS2_FALSE;
+ }
}
if (is_for_us)
- {
- if (!is_inited)
- {
- DWORD dwBufferSize = 0;
- axis2_char_t server_software[256];
- axis2_char_t *version = NULL;
-
- ZeroMemory(szOriginalPath, sizeof szOriginalPath);
- dwBufferSize = sizeof szOriginalPath;
-
-#if _WIN32_WINNT >= 0x0502
- GetDllDirectory( dwBufferSize, szOriginalPath );
-#else
- GetCurrentDirectory( dwBufferSize, szOriginalPath );
-#endif
- ZeroMemory(szPath, sizeof szPath);
- dwBufferSize = sizeof szPath;
- /* Get the current physical paht */
- if (pecb->GetServerVariable(pecb->ConnID, "APPL_PHYSICAL_PATH", szPath, &dwBufferSize) == FALSE)
- {
- send_error(pecb, initializing_error);
- return HSE_STATUS_ERROR;
- }
- /* Retrieve the server version */
- dwBufferSize = 32;
- if (pecb->GetServerVariable(pecb->ConnID, "SERVER_SOFTWARE", server_software, &dwBufferSize) == FALSE)
- {
- send_error(pecb, initializing_error);
- return HSE_STATUS_ERROR;
- }
- version = axutil_strchr(server_software, '/');
- if (version)
- {
- server_version = atoi(version + 1);
- }
-#if _WIN32_WINNT >= 0x0502
- SetDllDirectory( szPath );
-#else
- SetCurrentDirectory( szPath );
-#endif
- /* If we haven't initialized axis2/c before initialization failed */
- if (AXIS2_FAILURE == init_axis2())
- {
- send_error(pecb, initializing_error);
- return HSE_STATUS_ERROR;
- }
-#if _WIN32_WINNT >= 0x0502
- SetDllDirectory( szOriginalPath );
-#else
- SetCurrentDirectory( szOriginalPath );
-#endif
- }
-
+ {
/* Windows cannot find the correct dlls unless the path is set*/
#if _WIN32_WINNT >= 0x0502
SetDllDirectory( szPath );
Modified: webservices/axis2/trunk/c/src/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c?rev=672695&r1=672694&r2=672695&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c Sun Jun 29 21:08:15 2008
@@ -1,4 +1,4 @@
-
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -22,14 +22,18 @@
#include <string.h>
#include <httpfilt.h>
-#include <axis2_const.h>
-#include <axis2_defines.h>
-#include <axutil_env.h>
+#include <axis2_const.h>
+#include <axis2_defines.h>
+#include <axutil_env.h>
#include <axutil_stream.h>
#include "..\\axis2_iis_constants.h"
-
-static axis2_char_t redirect_word[INTERNET_MAX_URL_LENGTH] = "/axis2/mod_axis2_IIS.dll\?";
+
+#define REGISTRY_LOC "Software\\Apache Axis2c\\IIS ISAPI Redirector"
+#define AXIS2_IIS_AXIS2_LOC "axis2_location"
+static char *axis2_loc = "/axis2";
+
+static axis2_char_t redirect_word[INTERNET_MAX_URL_LENGTH] = "/axis2/mod_axis2_IIS.dll\?";
/*
* Search a given uri to find weather it matches a uri for the axis2
* The uri format for axis2 is of the form
@@ -37,17 +41,26 @@
* This function search a give uri for the /axis2/. If a match
* is found it will replace the /axis2 part of the url with /axis2/mod_iis.dll?
*/
-axis2_status_t AXIS2_CALL
-get_extension_url(char url[], char ret_url[]);
-
+axis2_bool_t AXIS2_CALL
+get_extension_url(char url[], char ret_url[]);
+
/*
* This function is called by the IIS server at the server
* initialization. So this is the ideal plcae for initializing
* axis2c.
*/
BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pVer)
-{
ULONG http_filter_revision = HTTP_FILTER_REVISION;
pVer->dwFilterVersion = pVer->dwServerFilterVersion;
if (pVer->dwFilterVersion > http_filter_revision)
- {
pVer->dwFilterVersion = http_filter_revision;
}
+{
+ DWORD type = 0, size = 0;
+ LONG lrc = 0;
+ char tmpbuf[INTERNET_MAX_URL_LENGTH];
+ HKEY hkey;
+ ULONG http_filter_revision = HTTP_FILTER_REVISION;
+ pVer->dwFilterVersion = pVer->dwServerFilterVersion;
+ if (pVer->dwFilterVersion > http_filter_revision)
+ {
+ pVer->dwFilterVersion = http_filter_revision;
+ }
/*
Receive notifictions when
@@ -55,50 +68,86 @@
2. Log
3. All the request coming in secure and none secure ports.
*/
- pVer->dwFlags =
- (SF_NOTIFY_ORDER_HIGH |
SF_NOTIFY_PREPROC_HEADERS |
SF_NOTIFY_SECURE_PORT |
SF_NOTIFY_NONSECURE_PORT |
SF_NOTIFY_AUTH_COMPLETE
);
+ pVer->dwFlags =
+ (SF_NOTIFY_ORDER_HIGH |
+ SF_NOTIFY_PREPROC_HEADERS |
+ SF_NOTIFY_SECURE_PORT |
+ SF_NOTIFY_NONSECURE_PORT |
+ SF_NOTIFY_AUTH_COMPLETE
+ );
/* Give a short discription about the module.*/
strcpy(pVer->lpszFilterDesc, "axis2c filter");
- /* initialize axis2*/
-
return TRUE;
}
-
+ /* Get the axis2 location from the registry configuration */
+ lrc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_LOC, (DWORD) 0, KEY_READ, &hkey);
+ if (ERROR_SUCCESS != lrc)
+ {
+ return FALSE;
+ }
+ size = INTERNET_MAX_URL_LENGTH;
+ lrc = RegQueryValueEx(hkey, AXIS2_IIS_AXIS2_LOC, (LPDWORD) 0, &type, (LPBYTE) tmpbuf, &size);
+ if ((ERROR_SUCCESS == lrc) && (type == REG_SZ))
+ {
+ tmpbuf[size] = '\0';
+ axis2_loc = _strdup(tmpbuf);
+ }
+ RegCloseKey(hkey);
+ return TRUE;
+}
+
/*
When a notification happens this function is called by the IIS.
*/
-DWORD WINAPI HttpFilterProc(
PHTTP_FILTER_CONTEXT pfc,
DWORD notificationType,
LPVOID pvNotification)
-{
DWORD bufferLength = INTERNET_MAX_URL_LENGTH;
char url[INTERNET_MAX_URL_LENGTH];
char modified_url[INTERNET_MAX_URL_LENGTH];
-
if (notificationType == SF_NOTIFY_PREPROC_HEADERS)
- {
pfc->GetServerVariable(pfc, "HTTP_URL", url, &bufferLength);
if (get_extension_url(url, modified_url))
- {
((PHTTP_FILTER_PREPROC_HEADERS) pvNotification)->SetHeader(pfc,
- "url",
- modified_url);
return SF_STATUS_REQ_HANDLED_NOTIFICATION;
}
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
-
-axis2_status_t AXIS2_CALL
-get_extension_url(char url[], char ret_url[])
-{
- /* Should contain "/axis2/"*/
- ret_url[0] = '\0';
-
- /* The url should begin with "/axis2/"*/
- if (url[0] == '/' && (url[1] == 'a' || url[1] == 'A')
- &&(url[2] == 'x' || url[2] == 'X')
- &&(url[3] == 'i' || url[3] == 'I')
- &&(url[4] == 's' || url[4] == 'S')
- &&url[5] == '2' && url[6] == '/')
- {
- /* Append the string to redirect the request*/
- strcpy(ret_url, redirect_word);
- strcat(ret_url, &url[7]);
- return TRUE;
- }
- if (url[0] == '/' && (url[1] == 'a' || url[1] == 'A')
- &&(url[2] == 'x' || url[2] == 'X')
- &&(url[3] == 'i' || url[3] == 'I')
- &&(url[4] == 's' || url[4] == 'S') &&url[5] == '2' && url[6] == '\0')
- {
- strcpy(ret_url, redirect_word);
- return TRUE;
- }
- return FALSE;
+DWORD WINAPI HttpFilterProc(
+ PHTTP_FILTER_CONTEXT pfc,
+ DWORD notificationType,
+ LPVOID pvNotification)
+{
+ DWORD bufferLength = INTERNET_MAX_URL_LENGTH;
+ char url[INTERNET_MAX_URL_LENGTH];
+ char modified_url[INTERNET_MAX_URL_LENGTH];
+
+ if (notificationType == SF_NOTIFY_PREPROC_HEADERS)
+ {
+ pfc->GetServerVariable(pfc, "HTTP_URL", url, &bufferLength);
+ if (get_extension_url(url, modified_url))
+ {
+ ((PHTTP_FILTER_PREPROC_HEADERS) pvNotification)->SetHeader(pfc,
+ "url",
+ modified_url);
+ return SF_STATUS_REQ_HANDLED_NOTIFICATION;
+ }
+ }
+ return SF_STATUS_REQ_NEXT_NOTIFICATION;
+}
+
+axis2_bool_t AXIS2_CALL
+get_extension_url(char url[], char ret_url[])
+{
+ axis2_bool_t is_for_us = AXIS2_FALSE;
+ int i = 0;
+ /* Should contain "/axis2/"*/
+ ret_url[0] = '\0';
+ if (strlen(url) >= strlen(axis2_loc))
+ {
+ is_for_us = AXIS2_TRUE;
+ while (axis2_loc[i] != '\0')
+ {
+ if (axis2_loc[i] != (url)[i]) {
+ is_for_us = AXIS2_FALSE;
+ break;
+ }
+ i++;
+ }
+ if (url[i] != '/' && url[i] != '\0')
+ {
+ is_for_us = AXIS2_FALSE;
+ }
+ }
+ if (is_for_us)
+ {
+ strcpy(ret_url, redirect_word);
+ strcat(ret_url, &url[i]);
+ }
+ return is_for_us;
}
\ No newline at end of file