You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2006/07/09 10:44:12 UTC
svn commit: r420258 -
/tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c
Author: mturk
Date: Sun Jul 9 01:44:12 2006
New Revision: 420258
URL: http://svn.apache.org/viewvc?rev=420258&view=rev
Log:
Allow multiple mappings with JKMount directive
as we have for uriworkermap.properties.
The /servlets-examples|/* worker will be treated
as two mount directives:
/servlets-examples worker
/servlets-examples/* worker
Modified:
tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c
Modified: tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c?rev=420258&r1=420257&r2=420258&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c Sun Jul 9 01:44:12 2006
@@ -365,24 +365,45 @@
if (sz > 0) {
int i;
for (i = 0; i < sz; i++) {
- if (uri_worker_map_add
- (uw_map, jk_map_name_at(init_data, i),
- jk_map_value_at(init_data, i), l) == JK_FALSE) {
+ const char *u = jk_map_name_at(init_data, i);
+ const char *w = jk_map_value_at(init_data, i);
+ /* Multiple mappings like :
+ * /servlets-examples|/ *
+ * will create two mappings:
+ * /servlets-examples
+ * and:
+ * /servlets-examples/ *
+ */
+ if (strchr(u, '|')) {
+ char *s, *r = strdup(u);
+ s = strchr(r, '|');
+ *(s++) = '\0';
+ /* Add first mapping */
+ if (!uri_worker_map_add(uw_map, r, w, l)) {
+ jk_log(l, JK_LOG_ERROR,
+ "invalid mapping rule %s->%s", r, w);
+ rc = JK_FALSE;
+ }
+ for (; *s; s++)
+ *(s - 1) = *s;
+ *(s - 1) = '\0';
+ /* add second mapping */
+ if (!uri_worker_map_add(uw_map, r, w, l)) {
+ jk_log(l, JK_LOG_ERROR,
+ "invalid mapping rule %s->%s", r, w);
+ rc = JK_FALSE;
+ }
+ free(r);
+ }
+ else if (!uri_worker_map_add(uw_map, u, w, l)) {
+ jk_log(l, JK_LOG_ERROR,
+ "invalid mapping rule %s->%s",
+ u, w);
rc = JK_FALSE;
break;
}
- }
-
- if (i == sz) {
- if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "there are %d rules",
- uw_map->size);
- }
- else {
- jk_log(l, JK_LOG_ERROR,
- "Parsing error");
- rc = JK_FALSE;
+ if (rc == JK_FALSE)
+ break;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org