costin 02/04/29 12:35:36 Modified: jk/native2/common jk_uriMap.c jk_uriEnv.c jk/native2/include jk_uriEnv.h Log: Change TYPE_CONTEXT to TYPE_PREFIX ( it's prefix map, not a context ). Add the 'real' MAP_TYPE_CONTEXT to correspond to the webapp root, and the TYPE_VHOST for the host. This will allow common ( and correct ) code to deal with WEB-INF automatically, and will let the maker set the correct vhost and context path ( that can be used by coyote to avoid a second mapping, eventually ). Revision Changes Path 1.26 +22 -10 jakarta-tomcat-connectors/jk/native2/common/jk_uriMap.c Index: jk_uriMap.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_uriMap.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- jk_uriMap.c 25 Apr 2002 19:22:19 -0000 1.25 +++ jk_uriMap.c 29 Apr 2002 19:35:35 -0000 1.26 @@ -66,8 +66,8 @@ * This lets us either partition the work among the web server and the * servlet container. * - * Author: Gal Shachor <[EMAIL PROTECTED]> - * Version: $Revision: 1.25 $ + * @author: Gal Shachor <[EMAIL PROTECTED]> + * @author: Costin Manolache */ #include "jk_pool.h" @@ -233,14 +233,12 @@ { jk_uriMap_t *_this=mbean->object; char *value=valueP; - int rc=JK_OK; if( strcmp( name, "debug" )==0 ) { _this->debug=atoi( value ); - } else { - return JK_ERR; - } - return rc; + return JK_OK; + } + return JK_OK; } @@ -346,7 +344,7 @@ char *url_rewrite=NULL; const char *suffix; int uriLen; - + /* Ugly hack to avoid using non-thread safe code. Modify the uri in place for uri session encoding, then restore it to the original. That works since the processing @@ -373,7 +371,7 @@ "uriMap.mapUri() uri must start with /\n"); return NULL; } - + url_rewrite = strstr(uri, JK_PATH_SESSION_IDENTIFIER); if(url_rewrite) { @@ -416,7 +414,7 @@ /* restore */ if( url_rewrite ) *url_rewrite=origChar; return uwr; - } else if(MATCH_TYPE_CONTEXT == uwr->match_type) { + } else if(MATCH_TYPE_PREFIX == uwr->match_type) { if(uwr->prefix_len > longest_match) { /* This takes care of 'shorter' matches */ if( _this->debug > 0 ) @@ -436,6 +434,20 @@ uwr->suffix ); longest_match = uwr->prefix_len; best_match = i; + } + } + } else if(MATCH_TYPE_CONTEXT_PATH == uwr->match_type) { + char *suffix_path = NULL; + if (strlen(uri) > 1 && (suffix_path = strchr(uri+1,'/')) != NULL) { + if (0 == strncmp(suffix_path,uwr->suffix, strlen(uwr->suffix))) { + if(uwr->prefix_len >= longest_match) { + env->l->jkLog(env, env->l, JK_LOG_INFO, + "jk_uri_worker_map_t::map_uri_to_worker, " + "Found a general context path match %s -> *%s\n", + uwr->worker_name, uwr->suffix ); + longest_match = uwr->prefix_len; + best_match = i; + } } } } else /* MATCH_TYPE_SUFFIX */ { 1.12 +10 -9 jakarta-tomcat-connectors/jk/native2/common/jk_uriEnv.c Index: jk_uriEnv.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_uriEnv.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- jk_uriEnv.c 29 Apr 2002 19:13:32 -0000 1.11 +++ jk_uriEnv.c 29 Apr 2002 19:35:35 -0000 1.12 @@ -201,10 +201,11 @@ } /* - * Now, lets check that the pattern is /context/STAR.suffix - * or /context/STAR - * we need to have a '/' then a '*' and the a '.' or a - * '/' then a '*' + * We have an * in the uri. Check the type. + * - /ASTERISK/PREFIX + * + * - /context/ASTERISK.suffix + * - /context/PREFIX/ASTERISK */ asterisk--; if ('/' == asterisk[0]) { @@ -223,7 +224,7 @@ uri, asterisk + 2, uriEnv->workerName); } else if ('.' == asterisk[2]) { - /* suffix rule: /foo/bar/STAR.extension */ + /* suffix rule: /foo/bar/ASTERISK.extension */ asterisk[1] = '\0'; asterisk[2] = '\0'; uriEnv->prefix = uri; @@ -236,7 +237,7 @@ uri, asterisk + 3, uriEnv->workerName); } } else if ('\0' != asterisk[2]) { - /* general suffix rule /foo/bar/STARextraData */ + /* general suffix rule /foo/bar/ASTERISKextraData */ asterisk[1] = '\0'; uriEnv->suffix = asterisk + 2; uriEnv->prefix = uri; @@ -248,12 +249,12 @@ uri, asterisk + 2, uriEnv->workerName); } } else { - /* context based /foo/bar/STAR */ + /* context based /foo/bar/ASTERISK */ asterisk[1] = '\0'; uriEnv->suffix = NULL; uriEnv->prefix = uri; uriEnv->prefix_len =strlen( uriEnv->prefix ); - uriEnv->match_type = MATCH_TYPE_CONTEXT; + uriEnv->match_type = MATCH_TYPE_PREFIX; if( uriEnv->debug > 0 ) { env->l->jkLog(env, env->l, JK_LOG_INFO, "uriMap.addMapping() prefix mapping %s=%s\n", @@ -266,7 +267,7 @@ uriEnv->prefix = uri; uriEnv->prefix_len =strlen( uriEnv->prefix ); uriEnv->suffix = NULL; - uriEnv->match_type = MATCH_TYPE_EXACT; + uriEnv->match_type = MATCH_TYPE_PREFIX; if( uriEnv->debug > 0 ) { env->l->jkLog(env, env->l, JK_LOG_INFO, "uriMap.addMapping() prefix mapping2 %s=%s\n", 1.10 +19 -4 jakarta-tomcat-connectors/jk/native2/include/jk_uriEnv.h Index: jk_uriEnv.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_uriEnv.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- jk_uriEnv.h 29 Apr 2002 19:13:32 -0000 1.9 +++ jk_uriEnv.h 29 Apr 2002 19:35:35 -0000 1.10 @@ -87,13 +87,28 @@ struct jk_uriEnv; typedef struct jk_uriEnv jk_uriEnv_t; - +/* Standard exact mapping */ #define MATCH_TYPE_EXACT (0) -#define MATCH_TYPE_CONTEXT (1) + +/* Standard prefix mapping */ +#define MATCH_TYPE_PREFIX (1) + +/* Standard suffix mapping ( *.jsp ) */ #define MATCH_TYPE_SUFFIX (2) -#define MATCH_TYPE_GENERAL_SUFFIX (3) /* match all URIs of the form *ext */ -/* match all context path URIs with a path component suffix */ + +/* Special: match all URIs of the form *ext */ +#define MATCH_TYPE_GENERAL_SUFFIX (3) + +/* Special: match all context path URIs with a path component suffix */ #define MATCH_TYPE_CONTEXT_PATH (4) + +/* The uriEnv corresponds to a virtual host */ +#define MATCH_TYPE_HOST (5) + +/* Top level context mapping. WEB-INF and META-INF will be checked, + and the information will be passed to tomcat +*/ +#define MATCH_TYPE_CONTEXT (6) struct jk_uriEnv {
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>