svn commit: r1496809 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/AsyncContextImpl.java test/org/apache/catalina/core/TestAsyncContextImpl.java webapps/docs/changelog.xml

2013-06-26 Thread violetagg
Author: violetagg
Date: Wed Jun 26 07:48:36 2013
New Revision: 1496809

URL: http://svn.apache.org/r1496809
Log:
Merged revisions 1496732, 1496734 from tomcat/trunk:
When AsyncContext.dispatch(...) is invoked do not cast request and response to 
HttpServletRequest/HttpServletResponse. 
ServletRequest.startAsync(ServletRequest,ServletResponse) can be invoked with 
custom ServletRequest/ServletResponse.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1496732,1496734

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1496809&r1=1496808&r2=1496809&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java 
Wed Jun 26 07:48:36 2013
@@ -168,9 +168,17 @@ public class AsyncContextImpl implements
 @Override
 public void dispatch() {
 check();
-HttpServletRequest sr = (HttpServletRequest)getRequest();
-String path = sr.getRequestURI();
-String cpath = sr.getContextPath();
+String path;
+String cpath;
+ServletRequest servletRequest = getRequest();
+if (servletRequest instanceof HttpServletRequest) {
+HttpServletRequest sr = (HttpServletRequest) servletRequest;
+path = sr.getRequestURI();
+cpath = sr.getContextPath();
+} else {
+path = request.getRequestURI();
+cpath = request.getContextPath();
+}
 if (cpath.length()>1) path = path.substring(cpath.length());
 dispatch(path);
 }
@@ -205,10 +213,8 @@ public class AsyncContextImpl implements
 }
 final AsyncDispatcher applicationDispatcher =
 (AsyncDispatcher) requestDispatcher;
-final HttpServletRequest servletRequest =
-(HttpServletRequest) getRequest();
-final HttpServletResponse servletResponse =
-(HttpServletResponse) getResponse();
+final ServletRequest servletRequest = getRequest();
+final ServletResponse servletResponse = getResponse();
 Runnable run = new Runnable() {
 @Override
 public void run() {

Modified: 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java?rev=1496809&r1=1496808&r2=1496809&view=diff
==
--- 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java 
Wed Jun 26 07:48:36 2013
@@ -30,11 +30,15 @@ import javax.servlet.AsyncContext;
 import javax.servlet.AsyncEvent;
 import javax.servlet.AsyncListener;
 import javax.servlet.DispatcherType;
+import javax.servlet.GenericServlet;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
 import javax.servlet.ServletRequestEvent;
 import javax.servlet.ServletRequestListener;
+import javax.servlet.ServletRequestWrapper;
 import javax.servlet.ServletResponse;
+import javax.servlet.ServletResponseWrapper;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -1741,9 +1745,9 @@ public class TestAsyncContextImpl extend
 Wrapper wrapper = Tomcat.addServlet(ctx, "nonAsyncServlet",
 nonAsyncServlet);
 wrapper.setAsyncSupported(true);
-ctx.addServletMapping("/nonAsyncServlet", "nonAsyncServlet");
+ctx.addServletMapping("/target", "nonAsyncServlet");
 
-ForbiddenDispatchingServlet forbiddenDispatchingServlet = new 
ForbiddenDispatchingServlet();
+DispatchingGenericServlet forbiddenDispatchingServlet = new 
DispatchingGenericServlet();
 Wrapper wrapper1 = Tomcat.addServlet(ctx,
 "forbiddenDispatchingServlet", forbiddenDispatchingServlet);
 wrapper1.setAsyncSupported(true);
@@ -1767,20 +1771,92 @@ public class TestAsyncContextImpl extend
 assertTrue(body.toString().contains("NonAsyncServletGet"));
 }
 
-private static class ForbiddenDispatchingServlet extends HttpServlet {
+private static class DispatchingGenericServlet extends GenericServlet {
 
 private

svn commit: r1496844 - in /tomcat/jk/trunk/native/common: jk_ajp_common.c jk_ajp_common.h

2013-06-26 Thread rjung
Author: rjung
Date: Wed Jun 26 09:08:54 2013
New Revision: 1496844

URL: http://svn.apache.org/r1496844
Log:
- Use defined constants in ping mode config
  parsing.

- Fix handling of default values in ping mode
  config parsing.

- Provide utility function to map ping mode
  numeric value to text representation.

Modified:
tomcat/jk/trunk/native/common/jk_ajp_common.c
tomcat/jk/trunk/native/common/jk_ajp_common.h

Modified: tomcat/jk/trunk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp_common.c?rev=1496844&r1=1496843&r2=1496844&view=diff
==
--- tomcat/jk/trunk/native/common/jk_ajp_common.c (original)
+++ tomcat/jk/trunk/native/common/jk_ajp_common.c Wed Jun 26 09:08:54 2013
@@ -74,6 +74,12 @@ static const char *ajp_state_type[] = {
 NULL
 };
 
+static char ajp_cping_mode[] = {
+AJP_CPING_CONNECT_TEXT,
+AJP_CPING_PREPOST_TEXT,
+AJP_CPING_INTERVAL_TEXT,
+};
+
 #define UNKNOWN_METHOD (-1)
 
 static int sc_for_req_method(const char *method, size_t len)
@@ -343,25 +349,43 @@ int jk_ajp_get_state_code(const char *v)
 return JK_AJP_STATE_DEF;
 }
 
+void jk_ajp_get_cping_text(int mode, char *buf)
+{
+int bit = 1;
+int log2 = 0;
+int pos = 0;
+while (bit <= mode && bit <= AJP_CPING_MAX) {
+if (mode & bit) {
+buf[pos] = ajp_cping_mode[log2];
+pos +=1;
+}
+bit *= 2;
+log2 += 1;
+}
+buf[pos] = '\0';
+}
+
 int jk_ajp_get_cping_mode(const char *m, int def)
 {
-int mv = def;
+int mv = 0;
 if (!m)
-return mv;
+return def;
 while (*m != '\0') {
-if (*m == 'C' || *m == 'c')
+if (*m == AJP_CPING_CONNECT_TEXT || *m == 
tolower(AJP_CPING_CONNECT_TEXT))
 mv |= AJP_CPING_CONNECT;
-if (*m == 'P' || *m == 'p')
+if (*m == AJP_CPING_PREPOST_TEXT || *m == 
tolower(AJP_CPING_PREPOST_TEXT))
 mv |= AJP_CPING_PREPOST;
-if (*m == 'I' || *m == 'i')
+if (*m == AJP_CPING_INTERVAL_TEXT || *m == 
tolower(AJP_CPING_INTERVAL_TEXT))
 mv |= AJP_CPING_INTERVAL;
-if (*m == 'A' || *m == 'a') {
+if (*m == AJP_CPING_ALL_TEXT || *m == tolower(AJP_CPING_ALL_TEXT)) {
 mv = AJP_CPING_CONNECT | AJP_CPING_PREPOST | AJP_CPING_INTERVAL;
 break;
 }
 m++;
 }
-return mv;
+if (mv)
+return mv;
+return def;
 }
 
 /*

Modified: tomcat/jk/trunk/native/common/jk_ajp_common.h
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp_common.h?rev=1496844&r1=1496843&r2=1496844&view=diff
==
--- tomcat/jk/trunk/native/common/jk_ajp_common.h (original)
+++ tomcat/jk/trunk/native/common/jk_ajp_common.h Wed Jun 26 09:08:54 2013
@@ -236,6 +236,12 @@ extern "C"
 #define AJP_CPING_CONNECT (1)   /* Send cping on fresh connection */
 #define AJP_CPING_PREPOST (2)   /* Send cping before sending request */
 #define AJP_CPING_INTERVAL(4)   /* Send cping on regular intervals */
+#define AJP_CPING_MAX (AJP_CPING_INTERVAL)
+
+#define AJP_CPING_CONNECT_TEXT('C')   /* Send cping on fresh connection */
+#define AJP_CPING_PREPOST_TEXT('P')   /* Send cping before sending request 
*/
+#define AJP_CPING_INTERVAL_TEXT   ('I')   /* Send cping on regular intervals */
+#define AJP_CPING_ALL_TEXT('A')   /* Send cping on regular intervals */
 
 
 #define RECOVER_ABORT_IF_TCGETREQUEST0x0001 /* DON'T RECOVER IF TOMCAT 
FAILS AFTER RECEIVING REQUEST */
@@ -456,6 +462,7 @@ int ajp_connection_tcp_get_message(ajp_e
 
 int JK_METHOD ajp_maintain(jk_worker_t *pThis, time_t now, jk_logger_t *l);
 
+void jk_ajp_get_cping_text(int mode, char *buf);
 int jk_ajp_get_cping_mode(const char *m, int def);
 
 int ajp_has_endpoint(jk_worker_t *pThis, jk_logger_t *l);



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1496851 - in /tomcat/trunk/java/org/apache/tomcat/websocket: LocalStrings.properties MessageHandlerResult.java MessageHandlerResultType.java Util.java WsSession.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 09:19:02 2013
New Revision: 1496851

URL: http://svn.apache.org/r1496851
Log:
Refactoring in support of fixing BZ 55143

Added:
tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResult.java
tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResultType.java
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1496851&r1=1496850&r2=1496851&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Wed 
Jun 26 09:19:02 2013
@@ -72,6 +72,7 @@ wsSession.sendCloseFail=Failed to send c
 wsSession.invalidHandlerTypePong=A pong message handler must implement 
MessageHandler.Basic
 wsSession.removeHandlerFailed=Unable to remove the handler [{0}] as it was not 
registered with this session
 wsSession.unknownHandler=Unable to add the message handler [{0}] as it was for 
the unrecognised type [{1}]
+wsSession.unknownHandlerType=Unable to add the message handler [{0}] as it was 
wrapped as the unrecognised type [{1}]
 
 wsWebSocketContainer.asynchronousChannelGroupFail=Unable to create dedicated 
AsynchronousChannelGroup for WebSocket clients which is required to prevent 
memory leaks in complex class loader environments like J2EE containers
 wsWebSocketContainer.asynchronousSocketChannelFail=Unable to open a connection 
to the server

Added: tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResult.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResult.java?rev=1496851&view=auto
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResult.java 
(added)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResult.java Wed 
Jun 26 09:19:02 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomcat.websocket;
+
+import javax.websocket.MessageHandler;
+
+public class MessageHandlerResult {
+
+private final MessageHandler handler;
+private final MessageHandlerResultType type;
+
+
+public MessageHandlerResult(MessageHandler handler,
+MessageHandlerResultType type) {
+this.handler = handler;
+this.type = type;
+}
+
+
+public MessageHandler getHandler() {
+return handler;
+}
+
+
+public MessageHandlerResultType getType() {
+return type;
+}
+}

Added: 
tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResultType.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResultType.java?rev=1496851&view=auto
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResultType.java 
(added)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/MessageHandlerResultType.java 
Wed Jun 26 09:19:02 2013
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitation

svn commit: r1496852 - /tomcat/jk/trunk/native/common/jk_util.c

2013-06-26 Thread rjung
Author: rjung
Date: Wed Jun 26 09:20:47 2013
New Revision: 1496852

URL: http://svn.apache.org/r1496852
Log:
- Save stack bytes: reduce param buffer from 1024 bytes
  to 100 bytes and check remaining length when doing
  buffer operations.
  We should document and check the resulting estriction
  of worker name length (60 bytes max).

- Use defaults everywhere if provided when parsing config.
  Also use them in case of error, because most config
  getters don't handle magic error values or they were already
  passed in as default values.

- Fix handling of default values for cping mode config getter

Modified:
tomcat/jk/trunk/native/common/jk_util.c

Modified: tomcat/jk/trunk/native/common/jk_util.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_util.c?rev=1496852&r1=1496851&r2=1496852&view=diff
==
--- tomcat/jk/trunk/native/common/jk_util.c (original)
+++ tomcat/jk/trunk/native/common/jk_util.c Wed Jun 26 09:20:47 2013
@@ -125,11 +125,21 @@
 
 #define HUGE_BUFFER_SIZE 8192
 
-#define MAKE_WORKER_PARAM(P) \
-strcpy(buf, "worker.");  \
-strcat(buf, wname);  \
-strcat(buf, ".");\
-strcat(buf, P)
+/*
+ * Our longest worker attribute name is about 30 bytes,
+ * so 100 bytes for "worker." plus worker name plus "."
+ * plus attribute names leaves at least 60 bytes for
+ * the worker names. That should be enough.
+ */
+#define PARAM_BUFFER_SIZE 100
+#define MAKE_WORKER_PARAM(P) \
+{ \
+size_t remain = PARAM_BUFFER_SIZE; \
+strcpy(buf, "worker."); remain -= strlen("worker."); \
+strncat(buf, wname, remain); remain -= strlen(wname); \
+strncat(buf, ".", remain); remain -= 1; \
+strncat(buf, P, remain); \
+}
 
 /*
  * define the log format, we're using by default the one from error.log
@@ -351,13 +361,13 @@ int jk_get_bool_code(const char *v, int 
  *v == 'F' || *v == 'f' ||
  *v == 'N' || *v == 'n' ||
 (*v == '0' && *(v + 1) == '\0')) {
-return 0;
+return JK_FALSE;
 }
 if (!strcasecmp(v, "on") ||
  *v == 'T' || *v == 't' ||
  *v == 'Y' || *v == 'y' ||
 (*v == '1' && *(v + 1) == '\0')) {
-return 1;
+return JK_TRUE;
 }
 return def;
 }
@@ -783,7 +793,7 @@ int jk_log(jk_logger_t *l,
 
 const char *jk_get_worker_type(jk_map_t *m, const char *wname)
 {
-char buf[1024];
+char buf[PARAM_BUFFER_SIZE];
 
 if (!m || !wname) {
 return NULL;
@@ -794,13 +804,13 @@ const char *jk_get_worker_type(jk_map_t 
 
 const char *jk_get_worker_route(jk_map_t *m, const char *wname, const char 
*def)
 {
-char buf[1024];
+char buf[PARAM_BUFFER_SIZE];
 const char *v;
 if (!m || !wname) {
-return NULL;
+return def;
 }
 MAKE_WORKER_PARAM(ROUTE_OF_WORKER);
-v = jk_map_get_string(m, buf, NULL);
+v = jk_map_get_string(m, buf, def);
 if (v) {
 return v;
 }
@@ -811,9 +821,9 @@ const char *jk_get_worker_route(jk_map_t
 
 const char *jk_get_worker_domain(jk_map_t *m, const char *wname, const char 
*def)
 {
-char buf[1024];
+char buf[PARAM_BUFFER_SIZE];
 if (!m || !wname) {
-return NULL;
+return def;
 }
 MAKE_WORKER_PARAM(DOMAIN_OF_WORKER);
 return jk_map_get_string(m, buf, def);
@@ -821,9 +831,9 @@ const char *jk_get_worker_domain(jk_map_
 
 const char *jk_get_worker_redirect(jk_map_t *m, const char *wname, const char 
*def)
 {
-char buf[1024];
+char buf[PARAM_BUFFER_SIZE];
 if (!m || !wname) {
-return NULL;
+return def;
 }
 MAKE_WORKER_PARAM(REDIRECT_OF_WORKER);
 return jk_map_get_string(m, buf, def);
@@ -831,7 +841,7 @@ const char *jk_get_worker_redirect(jk_ma
 
 const char *jk_get_worker_secret(jk_map_t *m, const char *wname)
 {
-char buf[1024];
+char buf[PARAM_BUFFER_SIZE];
 
 if (!m || !wname) {
 return NULL;
@@ -849,7 +859,7 @@ const char *jk_get_worker_secret(jk_map_
 int jk_get_worker_str_prop(jk_map_t *m,
const char *wname, const char *pname, const char 
**prop)
 {
-char buf[1024];
+char buf[PARAM_BUFFER_SIZE];
 
 if (m && prop && wname && pname) {
 MAKE_WORKER_PARAM(pname);
@@ -864,7 +874,7 @@ int jk_get_worker_str_prop(jk_map_t *m,
 int jk_get_worker_int_prop(jk_map_t *m,
const char *wname, const char *pname, int *prop)
 {
-char buf[1024];
+char buf[PARAM_BUFFER_SIZE];
 
 if (m && prop && wname && pname) {
 int i;
@@ -880,7 +890,7 @@ int jk_get_worker_int_prop(jk_map_t *m,
 
 const char *jk_get_worker_host(jk_map_t *m, const char *wname, const char *def)
 {
-char buf[1024];
+char buf[PARAM_BUFFER_SIZE];
 
 if (!m || !wname) {
 return NULL;
@@ -893,10 +903,10 @@ const char *jk_get_worker_host(jk_map_t 
 
 int j

svn commit: r1496858 - /tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml

2013-06-26 Thread rjung
Author: rjung
Date: Wed Jun 26 09:39:01 2013
New Revision: 1496858

URL: http://svn.apache.org/r1496858
Log:
Update changelog.

Modified:
tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=1496858&r1=1496857&r2=1496858&view=diff
==
--- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Wed Jun 26 09:39:01 2013
@@ -52,6 +52,10 @@
 (using FD_CLOEXEC + fnctl instead) so built modules will work with
 Linux kernels prior to 2.6.27. (timw)
   
+  
+Clean up config file parsing. Worker names are now restricted to
+60 bytes. (rjung)
+  
 
   
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[jira] [Created] (MTOMCAT-229) Release 2.2

2013-06-26 Thread Francois Wauquier (JIRA)
Francois Wauquier created MTOMCAT-229:
-

 Summary: Release 2.2
 Key: MTOMCAT-229
 URL: https://issues.apache.org/jira/browse/MTOMCAT-229
 Project: Apache Tomcat Maven Plugin
  Issue Type: Bug
Reporter: Francois Wauquier
Priority: Blocker


I would need a 2.2 version public release 
in order to fix this issue 
https://issues.apache.org/bugzilla/show_bug.cgi?id=53257
during the use of tomcat7-maven-plugin : exec-war-only,
as 2.1 embed a 7.0.27 instead of a 7.0.28 or higher

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: mod_jk, JSESSION_ID and load-balancing

2013-06-26 Thread Rainer Jung
Hi Henri,

On 25.06.2013 22:11, Henri Gomez wrote:
> Hi Christopher
> 
> I don't have access to code inside application, I'm using stock Sonatype
> Nexus OSS who use Shiro internally to manage (and regenetate JSESSIONID
> cookie), loosing jvmRoute contents.
> 
> See https://issues.sonatype.org/browse/NEXUS-5756
> 
> We could told mod_jk to use another cookie but I think Tomcat allways
> append jvmRoute content to cookie JSESSIONID.

You can configure the name of the session cookie in TC 6 and 7.

So if in your case Tomcat would also set a cookie (in addition to the
app) we wouldn't need anything else. Just switch TC to MYCOOKIE and
configure mod_jk to look for MYCOOKIE.

But it could well be, that Nexus actually replaces the session
management of Tomcat in which case TC would not set a cookie on its own.

Can you check that?

I started to hack on mod_jk to let it set cookies, but there are some
subtleties which make it not that easy (e.g. deriving the correct path
for the cookie form a JKMount). So probably there's a bit mor of
configuration and wiring necessary.

Regards,

Rainer

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1496889 - in /tomcat/trunk/java/org/apache/tomcat/websocket: LocalStrings.properties Util.java WsSession.java pojo/PojoMessageHandlerWholeBinary.java pojo/PojoMessageHandlerWholeText.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 11:54:31 2013
New Revision: 1496889

URL: http://svn.apache.org/r1496889
Log:
Further refactoring towards a fix for BZ 55143

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeBinary.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeText.java
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1496889&r1=1496888&r2=1496889&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Wed 
Jun 26 11:54:31 2013
@@ -26,7 +26,9 @@ asyncChannelWrapperSecure.writeFail=Only
 
 backgroundProcessManager.processFailed=A background process failed
 
+util.invalidMessageHandler=The message handler provided does not have an 
onMessage(Object) method
 util.invalidType=Unable to coerce value [{0}] to type [{1}]. That type is not 
supported.
+util.unknownDecoderType=The Decoder type [{0}] is not recognized
 
 # Note the wsFrame.* messages are used as close reasons in WebSocket control
 # frames and therefore must be 123 bytes (not characters) or less in length.

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Util.java?rev=1496889&r1=1496888&r2=1496889&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/Util.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/Util.java Wed Jun 26 11:54:31 
2013
@@ -16,13 +16,16 @@
  */
 package org.apache.tomcat.websocket;
 
+import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.nio.ByteBuffer;
 import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
+import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -30,11 +33,19 @@ import java.util.concurrent.ConcurrentLi
 import javax.websocket.CloseReason.CloseCode;
 import javax.websocket.CloseReason.CloseCodes;
 import javax.websocket.Decoder;
+import javax.websocket.Decoder.Binary;
+import javax.websocket.Decoder.BinaryStream;
+import javax.websocket.Decoder.Text;
+import javax.websocket.Decoder.TextStream;
+import javax.websocket.DeploymentException;
 import javax.websocket.Encoder;
+import javax.websocket.EndpointConfig;
 import javax.websocket.MessageHandler;
 import javax.websocket.PongMessage;
 
 import org.apache.tomcat.util.res.StringManager;
+import org.apache.tomcat.websocket.pojo.PojoMessageHandlerWholeBinary;
+import org.apache.tomcat.websocket.pojo.PojoMessageHandlerWholeText;
 
 /**
  * Utility class for internal use only within the
@@ -271,40 +282,179 @@ public class Util {
 }
 
 
+public static List getDecoders(
+Class[] decoderClazzes)
+throws DeploymentException{
+
+List result = new ArrayList<>();
+for (Class decoderClazz : decoderClazzes) {
+// Need to instantiate decoder to ensure it is valid and that
+// deployment can be failed if it is not
+@SuppressWarnings("unused")
+Decoder instance;
+try {
+instance = decoderClazz.newInstance();
+} catch (InstantiationException | IllegalAccessException e) {
+throw new DeploymentException(
+sm.getString("pojoMethodMapping.invalidDecoder",
+decoderClazz.getName()), e);
+}
+DecoderEntry entry = new DecoderEntry(
+Util.getDecoderType(decoderClazz), decoderClazz);
+result.add(entry);
+}
+
+return result;
+}
+
+
+
 public static Set getMessageHandlers(
-MessageHandler listener) {
+MessageHandler listener, EndpointConfig endpointConfig) {
 
-Type t = Util.getMessageType(listener);
+Class target = Util.getMessageType(listener);
 
 // Will never be more than 2 types
 Set results = new HashSet<>(2);
 
 // Simple cases - handlers already accepts one of the types expected by
 // the frame handling code
-if (String.class.isAssignableFrom((Class) t)) {
+if (String.class.isAss

svn commit: r1496892 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 12:03:06 2013
New Revision: 1496892

URL: http://svn.apache.org/r1496892
Log:
Note expectations

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java?rev=1496892&r1=1496891&r2=1496892&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java Wed Jun 26 
12:03:06 2013
@@ -71,7 +71,9 @@ public class WsSession implements Sessio
 private final boolean secure;
 private final String id;
 
+// Expected to handle message types of  only
 private MessageHandler textMessageHandler = null;
+// Expected to handle message types of  only
 private MessageHandler binaryMessageHandler = null;
 private MessageHandler.Whole pongMessageHandler = null;
 private volatile State state = State.OPEN;



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1496897 - /tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 12:06:45 2013
New Revision: 1496897

URL: http://svn.apache.org/r1496897
Log:
Extract decoder use flag to a field (will use it later)

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java?rev=1496897&r1=1496896&r2=1496897&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
Wed Jun 26 12:06:45 2013
@@ -267,6 +267,7 @@ public class PojoMethodMapping {
 private int indexPrimitive = -1;
 private Map indexPathParams = new HashMap<>();
 private int indexPayload = -1;
+private boolean useDecoder = false;
 
 
 public MessageMethod(Method m, List decoderEntries) {
@@ -274,7 +275,6 @@ public class PojoMethodMapping {
 
 Class[] types = m.getParameterTypes();
 Annotation[][] paramsAnnotations = m.getParameterAnnotations();
-boolean decoderParameterFound = false;
 
 for (int i = 0; i < types.length; i++) {
 boolean paramFound = false;
@@ -378,7 +378,7 @@ public class PojoMethodMapping {
 if (indexByteBuffer == -1) {
 indexByteBuffer = i;
 foundBinaryDecoderMatch = true;
-decoderParameterFound = true;
+useDecoder = true;
 } else {
 throw new 
IllegalArgumentException(sm.getString(
 
"pojoMethodMapping.duplicateMessageParam",
@@ -390,7 +390,7 @@ public class PojoMethodMapping {
 if (indexString == -1) {
 indexString = i;
 foundTextDecoderMatch = true;
-decoderParameterFound = true;
+useDecoder = true;
 } else {
 throw new 
IllegalArgumentException(sm.getString(
 
"pojoMethodMapping.duplicateMessageParam",
@@ -487,7 +487,7 @@ public class PojoMethodMapping {
 "pojoMethodMapping.partialInputStream",
 m.getName(), m.getDeclaringClass().getName()));
 }
-if (decoderParameterFound && indexBoolean != -1) {
+if (useDecoder && indexBoolean != -1) {
 throw new IllegalArgumentException(sm.getString(
 "pojoMethodMapping.partialObject",
 m.getName(), m.getDeclaringClass().getName()));



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 55143] Unable to add programmatic message handler to an endpoint with custom decoder

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55143

--- Comment #7 from Mark Thomas  ---
The WAR is helpful, but any chance you could convert your WAR to Tomcat unit
test? The more cases the unit test or tests can cover the better.

The ideal would be once that includes cover for the following:
Circle extends Shape
Square extends Shape

Programmatic endpoint with MessageHandler, Decoder.Text and
Decoder.Binary

and a similar annotated endpoint.

I'm sure there are other 'interesting' edge cases along similar themes. Any
additional cases you can include in the test case would be incredibly helpful.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1496905 - in /tomcat/trunk: java/org/apache/tomcat/websocket/ java/org/apache/tomcat/websocket/pojo/ test/org/apache/tomcat/websocket/

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 12:36:58 2013
New Revision: 1496905

URL: http://svn.apache.org/r1496905
Log:
More work for BZ 55143
Add support for byte[], InopuStream and Reader message handlers

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/Util.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeBinary.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeText.java
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
tomcat/trunk/test/org/apache/tomcat/websocket/TesterEchoServer.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Util.java?rev=1496905&r1=1496904&r2=1496905&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/Util.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/Util.java Wed Jun 26 12:36:58 
2013
@@ -16,6 +16,8 @@
  */
 package org.apache.tomcat.websocket;
 
+import java.io.InputStream;
+import java.io.Reader;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
@@ -334,9 +336,33 @@ public class Util {
 new MessageHandlerResult(listener,
 MessageHandlerResultType.PONG);
 results.add(result);
-// TODO byte[], Reader, InputStream
+// Relatively simple cases - handler needs wrapping but no decoder to
+// convert it to one of the types expected by the frame handling code
+} else if (byte[].class.isAssignableFrom(target)) {
+MessageHandlerResult result = new MessageHandlerResult(
+new PojoMessageHandlerWholeBinary(listener,
+getOnMessageMethod(listener), null,
+endpointConfig, null, new Object[1], 0, true, -1,
+false),
+MessageHandlerResultType.BINARY);
+results.add(result);
+} else if (InputStream.class.isAssignableFrom(target)) {
+MessageHandlerResult result = new MessageHandlerResult(
+new PojoMessageHandlerWholeBinary(listener,
+getOnMessageMethod(listener), null,
+endpointConfig, null, new Object[1], 0, true, -1,
+true),
+MessageHandlerResultType.BINARY);
+results.add(result);
+} else if (Reader.class.isAssignableFrom(target)) {
+MessageHandlerResult result = new MessageHandlerResult(
+new PojoMessageHandlerWholeText(listener,
+getOnMessageMethod(listener), null,
+endpointConfig, null, new Object[1], 0, true, -1),
+MessageHandlerResultType.BINARY);
+results.add(result);
 } else {
-// More complex case - listener that requires a decoder
+// More complex case - listener that requires a decoder
 DecoderMatch decoderMatch;
 try {
 decoderMatch = new DecoderMatch(target,
@@ -347,16 +373,19 @@ public class Util {
 Method m = getOnMessageMethod(listener);
 if (decoderMatch.getBinaryDecoders().size() > 0) {
 MessageHandlerResult result = new MessageHandlerResult(
-new PojoMessageHandlerWholeBinary(listener, m,
+new PojoMessageHandlerWholeBinary(listener, m, null,
 endpointConfig,
-decoderMatch.getBinaryDecoders()),
+decoderMatch.getBinaryDecoders(), new 
Object[1],
+0, false, -1, false),
 MessageHandlerResultType.BINARY);
 results.add(result);
 }
 if (decoderMatch.getTextDecoders().size() > 0) {
 MessageHandlerResult result = new MessageHandlerResult(
-new PojoMessageHandlerWholeText(listener, m,
-endpointConfig, 
decoderMatch.getTextDecoders()),
+new PojoMessageHandlerWholeText(listener, m, null,
+endpointConfig,
+decoderMatch.getTextDecoders(), new Object[1],
+0, false, -1),
 MessageHandlerResultType.TEXT);
 results.add(result);
 }

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeBinary.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeBinary.java?rev=14969

[Bug 55143] Unable to add programmatic message handler to an endpoint with custom decoder

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55143

--- Comment #8 from Niki Dokovski  ---
yep I'll prepare a change

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1496907 - in /tomcat/trunk/java/org/apache/tomcat/websocket: WsSession.java pojo/PojoMessageHandlerBase.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 12:45:47 2013
New Revision: 1496907

URL: http://svn.apache.org/r1496907
Log:
BZ 55143
Handle removal of listeners that might have been wrapped

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java?rev=1496907&r1=1496906&r2=1496907&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java Wed Jun 26 
12:45:47 2013
@@ -44,6 +44,7 @@ import javax.websocket.WebSocketContaine
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
+import org.apache.tomcat.websocket.pojo.PojoMessageHandlerBase;
 
 public class WsSession implements Session {
 
@@ -236,23 +237,42 @@ public class WsSession implements Sessio
 return;
 }
 
-// TODO Handle wrapped listeners
+MessageHandler wrapped = null;
 
-if (listener.equals(textMessageHandler)) {
+if (listener instanceof PojoMessageHandlerBase) {
+wrapped =
+((PojoMessageHandlerBase) listener).getWrappedHandler();
+}
+
+if (wrapped == null) {
+wrapped = listener;
+}
+
+boolean removed = false;
+if (wrapped.equals(textMessageHandler) ||
+listener.equals(textMessageHandler)) {
 textMessageHandler = null;
-return;
-} else if (listener.equals(binaryMessageHandler)) {
+removed = true;
+}
+
+if (listener.equals(binaryMessageHandler) ||
+listener.equals(binaryMessageHandler)) {
 binaryMessageHandler = null;
-return;
-} else if (listener.equals(pongMessageHandler)) {
+removed = true;
+}
+
+if (listener.equals(pongMessageHandler) ||
+listener.equals(pongMessageHandler)) {
 pongMessageHandler = null;
-return;
+removed = true;
 }
 
-// ISE for now. Could swallow this silently / log this if the ISE
-// becomes a problem
-throw new IllegalStateException(
-sm.getString("wsSession.removeHandlerFailed", listener));
+if (!removed) {
+// ISE for now. Could swallow this silently / log this if the ISE
+// becomes a problem
+throw new IllegalStateException(
+sm.getString("wsSession.removeHandlerFailed", listener));
+}
 }
 
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerBase.java?rev=1496907&r1=1496906&r2=1496907&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerBase.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerBase.java 
Wed Jun 26 12:45:47 2013
@@ -21,6 +21,7 @@ import java.lang.reflect.Method;
 import java.nio.ByteBuffer;
 
 import javax.websocket.EncodeException;
+import javax.websocket.MessageHandler;
 import javax.websocket.RemoteEndpoint;
 import javax.websocket.Session;
 
@@ -73,4 +74,18 @@ public abstract class PojoMessageHandler
 throw new IllegalStateException(ioe);
 }
 }
+
+
+/**
+ * Expose the POJO if it is a message handler so the Session is able to
+ * match requests to remove handlers if the original handler has been
+ * wrapped.
+ */
+public MessageHandler getWrappedHandler() {
+if (pojo instanceof MessageHandler) {
+return (MessageHandler) pojo;
+} else {
+return null;
+}
+}
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1496909 - in /tomcat/trunk/java/org/apache/tomcat/websocket: DecoderEntry.java Util.java pojo/PojoMethodMapping.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 12:50:37 2013
New Revision: 1496909

URL: http://svn.apache.org/r1496909
Log:
Refactor - move DecoderEntry to new file

Added:
tomcat/trunk/java/org/apache/tomcat/websocket/DecoderEntry.java   (with 
props)
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

Added: tomcat/trunk/java/org/apache/tomcat/websocket/DecoderEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/DecoderEntry.java?rev=1496909&view=auto
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/DecoderEntry.java (added)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/DecoderEntry.java Wed Jun 26 
12:50:37 2013
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomcat.websocket;
+
+import javax.websocket.Decoder;
+
+public class DecoderEntry {
+
+private final Class clazz;
+private final Class decoderClazz;
+
+public DecoderEntry(Class clazz,
+Class decoderClazz) {
+this.clazz = clazz;
+this.decoderClazz = decoderClazz;
+}
+
+public Class getClazz() {
+return clazz;
+}
+
+public Class getDecoderClazz() {
+return decoderClazz;
+}
+}
\ No newline at end of file

Propchange: tomcat/trunk/java/org/apache/tomcat/websocket/DecoderEntry.java
--
svn:eol-style = native

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Util.java?rev=1496909&r1=1496908&r2=1496909&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/Util.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/Util.java Wed Jun 26 12:50:37 
2013
@@ -409,27 +409,6 @@ public class Util {
 }
 }
 
-public static class DecoderEntry {
-
-private final Class clazz;
-private final Class decoderClazz;
-
-public DecoderEntry(Class clazz,
-Class decoderClazz) {
-this.clazz = clazz;
-this.decoderClazz = decoderClazz;
-}
-
-public Class getClazz() {
-return clazz;
-}
-
-public Class getDecoderClazz() {
-return decoderClazz;
-}
-}
-
-
 private static class DecoderMatch {
 
 private final List> textDecoders =

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java?rev=1496909&r1=1496908&r2=1496909&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
Wed Jun 26 12:50:37 2013
@@ -44,8 +44,8 @@ import javax.websocket.Session;
 import javax.websocket.server.PathParam;
 
 import org.apache.tomcat.util.res.StringManager;
+import org.apache.tomcat.websocket.DecoderEntry;
 import org.apache.tomcat.websocket.Util;
-import org.apache.tomcat.websocket.Util.DecoderEntry;
 
 /**
  * For a POJO class annotated with



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 55143] Unable to add programmatic message handler to an endpoint with custom decoder

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55143

--- Comment #9 from Mark Thomas  ---
Thanks. Current trunk should have fixed this now. I'll leave the issue open
until your test case is complete.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1496923 - /tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 13:14:44 2013
New Revision: 1496923

URL: http://svn.apache.org/r1496923
Log:
Reduce decoder scanning

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java?rev=1496923&r1=1496922&r2=1496923&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
Wed Jun 26 13:14:44 2013
@@ -269,7 +269,6 @@ public class PojoMethodMapping {
 private int indexPayload = -1;
 private boolean useDecoder = false;
 
-
 public MessageMethod(Method m, List decoderEntries) {
 this.m = m;
 
@@ -519,31 +518,35 @@ public class PojoMethodMapping {
 
 MessageHandler mh = null;
 if (indexBoolean == -1) {
+List> decoders = null;
+if (useDecoder) {
+decoders = config.getDecoders();
+}
 // Basic
 if (indexString != -1) {
 mh = new PojoMessageHandlerWholeText(pojo, m,  session,
-config, config.getDecoders(), params, indexString,
-false, indexSession);
+config, decoders, params, indexString, false,
+indexSession);
 } else if (indexPrimitive != -1) {
 mh = new PojoMessageHandlerWholeText(pojo, m, session,
-config, config.getDecoders(), params,
-indexPrimitive, false, indexSession);
+config, decoders, params, indexPrimitive, false,
+indexSession);
 } else if (indexByteArray != -1) {
 mh = new PojoMessageHandlerWholeBinary(pojo, m, session,
-config, config.getDecoders(), params,
-indexByteArray, true, indexSession, false);
+config, decoders, params, indexByteArray, true,
+indexSession, false);
 } else if (indexByteBuffer != -1) {
 mh = new PojoMessageHandlerWholeBinary(pojo, m, session,
-config, config.getDecoders(), params,
-indexByteBuffer, false, indexSession, false);
+config, decoders, params, indexByteBuffer, false,
+indexSession, false);
 } else if (indexInputStream != -1) {
 mh = new PojoMessageHandlerWholeBinary(pojo, m, session,
-config, config.getDecoders(), params,
-indexInputStream, true, indexSession, true);
+config, decoders, params, indexInputStream, true,
+indexSession, true);
 } else if (indexReader != -1) {
 mh = new PojoMessageHandlerWholeText(pojo, m, session,
-config, config.getDecoders(), params, indexReader,
-true, indexSession);
+config, decoders, params, indexReader, true,
+indexSession);
 } else {
 mh = new PojoMessageHandlerWholePong(pojo, m, session,
 params, indexPong, false, indexSession);



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot failure in ASF Buildbot on tomcat-trunk

2013-06-26 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/tomcat-trunk/builds/4529

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1496905
Blamelist: markt

BUILD FAILED: failed compile_1

sincerely,
 -The Buildbot





svn commit: r1496936 - in /tomcat/trunk/test/org/apache/tomcat/websocket/pojo: TestEncodingDecoding.java TestPojoEndpointBase.java TestPojoMethodMapping.java TesterUtil.java Util.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 13:43:52 2013
New Revision: 1496936

URL: http://svn.apache.org/r1496936
Log:
Rename for consistency

Added:
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TesterUtil.java
  - copied, changed from r1496910, 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/Util.java
Removed:
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/Util.java
Modified:
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java

tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java

Modified: 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java?rev=1496936&r1=1496935&r2=1496936&view=diff
==
--- 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 
(original)
+++ 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 
Wed Jun 26 13:43:52 2013
@@ -42,8 +42,8 @@ import org.apache.catalina.deploy.Applic
 import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
-import org.apache.tomcat.websocket.pojo.Util.ServerConfigListener;
-import org.apache.tomcat.websocket.pojo.Util.SingletonConfigurator;
+import org.apache.tomcat.websocket.pojo.TesterUtil.ServerConfigListener;
+import org.apache.tomcat.websocket.pojo.TesterUtil.SingletonConfigurator;
 
 public class TestEncodingDecoding extends TomcatBaseTest {
 

Modified: 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java?rev=1496936&r1=1496935&r2=1496936&view=diff
==
--- 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java 
(original)
+++ 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java 
Wed Jun 26 13:43:52 2013
@@ -38,8 +38,8 @@ import org.apache.catalina.deploy.Applic
 import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
-import org.apache.tomcat.websocket.pojo.Util.ServerConfigListener;
-import org.apache.tomcat.websocket.pojo.Util.SingletonConfigurator;
+import org.apache.tomcat.websocket.pojo.TesterUtil.ServerConfigListener;
+import org.apache.tomcat.websocket.pojo.TesterUtil.SingletonConfigurator;
 
 public class TestPojoEndpointBase extends TomcatBaseTest {
 

Modified: 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java?rev=1496936&r1=1496935&r2=1496936&view=diff
==
--- 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java 
(original)
+++ 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java 
Wed Jun 26 13:43:52 2013
@@ -37,9 +37,9 @@ import org.apache.catalina.deploy.Applic
 import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
-import org.apache.tomcat.websocket.pojo.Util.ServerConfigListener;
-import org.apache.tomcat.websocket.pojo.Util.SimpleClient;
-import org.apache.tomcat.websocket.pojo.Util.SingletonConfigurator;
+import org.apache.tomcat.websocket.pojo.TesterUtil.ServerConfigListener;
+import org.apache.tomcat.websocket.pojo.TesterUtil.SimpleClient;
+import org.apache.tomcat.websocket.pojo.TesterUtil.SingletonConfigurator;
 
 public class TestPojoMethodMapping extends TomcatBaseTest {
 

Copied: tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TesterUtil.java 
(from r1496910, tomcat/trunk/test/org/apache/tomcat/websocket/pojo/Util.java)
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TesterUtil.java?p2=tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TesterUtil.java&p1=tomcat/trunk/test/org/apache/tomcat/websocket/pojo/Util.java&r1=1496910&r2=1496936&rev=1496936&view=diff
==
--- tomcat/trunk/test/org/apache/tomcat/websocket/pojo/Util.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TesterUtil.java Wed Jun 
26 13:43:52 2013
@@ -25,7 +25,7 @@ import javax.websocket.server.ServerEndp
 import org.apache.tomcat.websocket.server.Constants;
 import org.apache.tomcat.websocket.server.WsListener;
 
-public class Util {
+public class TesterUtil {
 
 public static class ServerConfigListener extends WsListener {
 

svn commit: r1496942 - in /tomcat/trunk: java/org/apache/tomcat/websocket/ java/org/apache/tomcat/websocket/pojo/ test/org/apache/tomcat/websocket/

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 14:15:08 2013
New Revision: 1496942

URL: http://svn.apache.org/r1496942
Log:
Add message size limit support for message handlers

Added:
tomcat/trunk/java/org/apache/tomcat/websocket/WrappedMessageHandler.java   
(with props)
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java
tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerBase.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerPartialBase.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerPartialBinary.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerPartialText.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeBase.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeBinary.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholePong.java

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeText.java
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1496942&r1=1496941&r2=1496942&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Wed 
Jun 26 14:15:08 2013
@@ -43,6 +43,7 @@ wsFrame.controlNoFin=A control frame was
 wsFrame.invalidOpCode= A WebSocket frame was sent with an unrecognised opCode 
of [{0}]
 wsFrame.invalidUtf8=A WebSocket text frame was received that could not be 
decoded to UTF-8 because it contained invalid byte sequences
 wsFrame.invalidUtf8Close=A WebSocket close frame was received with a close 
reason that contained invalid UTF-8 byte sequences
+wsFrame.messageTooBig=The message was [{0}] bytes long but the MessageHandler 
has a limit of [{1}] bytes
 wsFrame.noContinuation=A new message was started when a continuation frame was 
expected
 wsFrame.notMasked=The client frame was not masked but all client frames must 
be masked
 wsFrame.oneByteCloseCode=The client sent a close frame with a single byte 
payload which is not valid

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Util.java?rev=1496942&r1=1496941&r2=1496942&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/Util.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/Util.java Wed Jun 26 14:15:08 
2013
@@ -343,7 +343,7 @@ public class Util {
 new PojoMessageHandlerWholeBinary(listener,
 getOnMessageMethod(listener), null,
 endpointConfig, null, new Object[1], 0, true, -1,
-false),
+false, -1),
 MessageHandlerResultType.BINARY);
 results.add(result);
 } else if (InputStream.class.isAssignableFrom(target)) {
@@ -351,14 +351,15 @@ public class Util {
 new PojoMessageHandlerWholeBinary(listener,
 getOnMessageMethod(listener), null,
 endpointConfig, null, new Object[1], 0, true, -1,
-true),
+true, -1),
 MessageHandlerResultType.BINARY);
 results.add(result);
 } else if (Reader.class.isAssignableFrom(target)) {
 MessageHandlerResult result = new MessageHandlerResult(
 new PojoMessageHandlerWholeText(listener,
 getOnMessageMethod(listener), null,
-endpointConfig, null, new Object[1], 0, true, -1),
+endpointConfig, null, new Object[1], 0, true, -1,
+-1),
 MessageHandlerResultType.BINARY);
 results.add(result);
 } else {
@@ -376,7 +377,7 @@ public class Util {
 new PojoMessageHandlerWholeBinary(listener, m, null,
 endpointConfig,
 decoderMatch.getBinaryDecoders(), new 
Object[1],
-0, false, -1, false),
+0, false, -1, false, -1),
 Messag

[Bug 55146] New: bin/version.sh reports false server number

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55146

Bug ID: 55146
   Summary: bin/version.sh reports false server number
   Product: Tomcat 6
   Version: 6.0.37
  Hardware: Sun
OS: SunOS
Status: NEW
  Severity: trivial
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: i...@inusasha.de

the Server number should by 6.0.37.0 but the 6.0.0.37 is reported.
this is confusing.

>> output of version.sh
Using CATALINA_BASE:   /appl/tomcat/apache-tomcat-6.0.37
Using CATALINA_HOME:   /appl/tomcat/apache-tomcat-6.0.37
Using CATALINA_TMPDIR: /appl/tomcat/apache-tomcat-6.0.37/temp
Using JRE_HOME:/appl/java/jdk1.7
Using CLASSPATH:   /appl/tomcat/apache-tomcat-6.0.37/bin/bootstrap.jar
Server version: Apache Tomcat/6.0.37
Server built:   Apr 29 2013 11:34:47
Server number:  6.0.0.37
OS Name:SunOS
OS Version: 5.10
Architecture:   sparc
JVM Version:1.7.0_25-b15
JVM Vendor: Oracle Corporation

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Jasper improvements, was: Timeline for beginning EL 3.0 implementation?

2013-06-26 Thread Christopher Schultz
Jeremy,

On 6/26/13 1:44 AM, Jeremy Boynes wrote:
> On Jun 11, 2013, at 1:50 PM, Nick Williams
>  wrote:
>> 
>> Okay. One of many reasons I ask is that I still have it on my to-do
>> to make some improvements on the JSP compiler to support things
>> like 1) precompiling all JSPs on deploy and 2) a better Ant task. I
>> don't know how much the EL changes might affect this JSP
>> compilation (hopefully it's fairly decoupled), and I'd like that to
>> not seriously hinder any effort to back-port my improvements to
>> Tomcat 7. I'm wondering if this needs to move higher on my list and
>> get in before the EL changes. Any insight?
> 
> I have been thinking about improvements to Jasper as well around
> better support for Servlet 3.0 concepts. One area would be decoupling
> it from Tomcat, bootstrapping using an SCI as hinted in
> ContextConfig. I'd also be interested in improving the Ant task as
> well, such as support for pre-compiling a separate package that would
> be treated as a web fragment (including web.xml-less pre-compilation,
> generating a web-fragment.xml rather than a web.xml snippet or
> potentially eliminating the XML entirely if the generated code can be
> annotated with @WebServlet). 

https://issues.apache.org/bugzilla/show_bug.cgi?id=50234

I tried some forays into this a few years ago, but got stuck in the
confusion of how everything works together. I wanted to do something
simple like get the web-app's spec-version number, but could not figure
out how to do it.

-chris



signature.asc
Description: OpenPGP digital signature


[Bug 55146] bin/version.sh reports false server number

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55146

--- Comment #1 from Christopher Schultz  ---
Why do you think the "server number" should be 6.0.37.0?

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: mod_jk, JSESSION_ID and load-balancing

2013-06-26 Thread Henri Gomez
>You can configure the name of the session cookie in TC 6 and 7.

I see sessionCookieName in
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html ...

> So if in your case Tomcat would also set a cookie (in addition to the
> app) we wouldn't need anything else. Just switch TC to MYCOOKIE and
> configure mod_jk to look for MYCOOKIE.

It may works but Nexus is hacking JSESSIONID in extjs side also ;(
I'll try BTW

> But it could well be, that Nexus actually replaces the session
> management of Tomcat in which case TC would not set a cookie on its own.
> Can you check that?

Nexus/Shiro is removing JESSIONID by its own ;(

> I started to hack on mod_jk to let it set cookies, but there are some
> subtleties which make it not that easy (e.g. deriving the correct path
> for the cookie form a JKMount). So probably there's a bit mor of
> configuration and wiring necessary.

Rainer, you're "king of jk".
I think it will bring more values to many uses cases and act as
mod_proxy/http so not too bad


[Bug 55146] bin/version.sh reports false server number

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55146

--- Comment #2 from i...@inusasha.de ---
Tomcat 6.0.35 have 6.0.35.0
Tomcat 6.0.36 have 6.0.36.0

Tomcat 7.0.40 have 7.0.40.0
Tomcat 7.0.41 have 7.0.41.0

So it looks like Server number is a extended version number.


Sascha

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot success in ASF Buildbot on tomcat-trunk

2013-06-26 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/tomcat-trunk/builds/4532

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1496942
Blamelist: markt

Build succeeded!

sincerely,
 -The Buildbot





[Bug 55146] bin/version.sh reports false server number

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55146

Christopher Schultz  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Christopher Schultz  ---
Looks like it was an error in the release process
(http://svn.apache.org/viewvc/tomcat/tc6.0.x/tags/TOMCAT_6_0_37/build.properties.default?r1=1476932&r2=1476935).

I believe the release process is manual so this is a) human error and b) cannot
be fixed in 6.0.37... it will have to wait for 6.0.38 at which point the
release will likely be done correctly.

If you need to fix the version number, you can edit the file
"/org/apache/catalina/util/ServerInfo.properties" found in
CATALINA_HOME/lib/catalina.jar to correct the version string.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: mod_jk, JSESSION_ID and load-balancing

2013-06-26 Thread Rainer Jung
On 26.06.2013 16:54, Henri Gomez wrote:
>> You can configure the name of the session cookie in TC 6 and 7.
> 
> I see sessionCookieName in
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html ...
> 
>> So if in your case Tomcat would also set a cookie (in addition to the
>> app) we wouldn't need anything else. Just switch TC to MYCOOKIE and
>> configure mod_jk to look for MYCOOKIE.
> 
> It may works but Nexus is hacking JSESSIONID in extjs side also ;(
> I'll try BTW
> 
>> But it could well be, that Nexus actually replaces the session
>> management of Tomcat in which case TC would not set a cookie on its own.
>> Can you check that?
> 
> Nexus/Shiro is removing JESSIONID by its own ;(
> 
>> I started to hack on mod_jk to let it set cookies, but there are some
>> subtleties which make it not that easy (e.g. deriving the correct path
>> for the cookie form a JKMount). So probably there's a bit mor of
>> configuration and wiring necessary.
> 
> Rainer, you're "king of jk".

Naa, that's still Mladen. Blame him if something is not working ;)

> I think it will bring more values to many uses cases and act as
> mod_proxy/http so not too bad

Basic hack is done, will do some basic testing, then commit and provide
you with a snapshot tarball to do your own testing.

Regards,

Rainer

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: mod_jk, JSESSION_ID and load-balancing

2013-06-26 Thread Henri Gomez
I'll try it as soon as available. 

Thanks Rainer,  "Prince of Jk" :-)


Le 26 juin 2013 à 19:42, Rainer Jung  a écrit :

> On 26.06.2013 16:54, Henri Gomez wrote:
>>> You can configure the name of the session cookie in TC 6 and 7.
>> 
>> I see sessionCookieName in
>> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html ...
>> 
>>> So if in your case Tomcat would also set a cookie (in addition to the
>>> app) we wouldn't need anything else. Just switch TC to MYCOOKIE and
>>> configure mod_jk to look for MYCOOKIE.
>> 
>> It may works but Nexus is hacking JSESSIONID in extjs side also ;(
>> I'll try BTW
>> 
>>> But it could well be, that Nexus actually replaces the session
>>> management of Tomcat in which case TC would not set a cookie on its own.
>>> Can you check that?
>> 
>> Nexus/Shiro is removing JESSIONID by its own ;(
>> 
>>> I started to hack on mod_jk to let it set cookies, but there are some
>>> subtleties which make it not that easy (e.g. deriving the correct path
>>> for the cookie form a JKMount). So probably there's a bit mor of
>>> configuration and wiring necessary.
>> 
>> Rainer, you're "king of jk".
> 
> Naa, that's still Mladen. Blame him if something is not working ;)
> 
>> I think it will bring more values to many uses cases and act as
>> mod_proxy/http so not too bad
> 
> Basic hack is done, will do some basic testing, then commit and provide
> you with a snapshot tarball to do your own testing.
> 
> Regards,
> 
> Rainer
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Jasper improvements

2013-06-26 Thread Jeremy Boynes
On Jun 26, 2013, at 7:49 AM, Christopher Schultz  
wrote:

> Jeremy,
> 
> On 6/26/13 1:44 AM, Jeremy Boynes wrote:
>> On Jun 11, 2013, at 1:50 PM, Nick Williams
>>  wrote:
>>> 
>>> Okay. One of many reasons I ask is that I still have it on my to-do
>>> to make some improvements on the JSP compiler to support things
>>> like 1) precompiling all JSPs on deploy and 2) a better Ant task. I
>>> don't know how much the EL changes might affect this JSP
>>> compilation (hopefully it's fairly decoupled), and I'd like that to
>>> not seriously hinder any effort to back-port my improvements to
>>> Tomcat 7. I'm wondering if this needs to move higher on my list and
>>> get in before the EL changes. Any insight?
>> 
>> I have been thinking about improvements to Jasper as well around
>> better support for Servlet 3.0 concepts. One area would be decoupling
>> it from Tomcat, bootstrapping using an SCI as hinted in
>> ContextConfig. I'd also be interested in improving the Ant task as
>> well, such as support for pre-compiling a separate package that would
>> be treated as a web fragment (including web.xml-less pre-compilation,
>> generating a web-fragment.xml rather than a web.xml snippet or
>> potentially eliminating the XML entirely if the generated code can be
>> annotated with @WebServlet). 
> 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=50234
> 
> I tried some forays into this a few years ago, but got stuck in the
> confusion of how everything works together. I wanted to do something
> simple like get the web-app's spec-version number, but could not figure
> out how to do it.

I find usage and implementation very confusing as well - an example being 
things that can be configured on the Task vs. init-params for the JSP servlet 
vs. things set via system properties. A challenge here is that cleaning it up 
would likely warrant incompatible changes so would be out for 7.x but 
potentially possible for 8.x - I'd be interested in what people think about a 
major refactor that allowed incompatible changes (assuming they were justified 
not arbitrary).

You wrote in the bug that "annotation's don't make sense" - could you clarify 
that? I was thinking that we could have Jasper add @WebServlet("/foo.jsp") to 
the class generated for "foo.jsp" and then that would be picked up by a 
container as part of its normal scan. We could also have an SCI 
@HandlesTypes(JspPage.class) and then register the JSP servlets itself but two 
issues come to mind:
1) the need for metadata that duplicates what the normal servlet annotations 
could convey
2) avoiding conflicts with classes that are bound via jsp-property-group or 
servlet-mapping elements in XML descriptors

What happens to a fragment compiled a build-time whose properties differ from 
those in the final runtime (for example, due to settings resulting from a 
merged web.xml)? One option would be to say that the build process had simply 
converted all the JSPs into a jar-full of Servlets and that they should be 
deployed as such; if the user wants them treated as JSPs they should be 
packaged as such into META-INF/resources.

How should we control pre-compile on deploy? The spec already supports if the 
web.xml contains a  entry with a  and  but 
that requires defining a entry for every individual JSP ("jsp-file element 
contains the full path to *a* JSP file" on pp 14-160) which is a pain. We could 
embed an Ant task in a configuration file (e.g. META-INF/jasper.xml) but that 
adds a dependency on Ant and seems like overkill. Alternatively we can have the 
SCI read the configuration file and do the necessary.

If we go the SCI route, we could also define a JspConfiguration annotation or 
interface that a user could place on a class they want to handle 
initialization. The SCI could @HandlesTypes that, calling it to handle 
user-provided initialization. We could expose the translator and compiler 
interfaces so it can handle pre-compilation; we could refactor the JSPServlet 
to use them in the same way.

Cheers
Jeremy

BTW, can't we use ServletContext#getEffectiveMajorVersion() to determine the 
spec-version number?

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Jasper improvements

2013-06-26 Thread Nick Williams

On Jun 26, 2013, at 1:57 PM, Jeremy Boynes wrote:

> On Jun 26, 2013, at 7:49 AM, Christopher Schultz 
>  wrote:
> 
>> Jeremy,
>> 
>> On 6/26/13 1:44 AM, Jeremy Boynes wrote:
>>> On Jun 11, 2013, at 1:50 PM, Nick Williams
>>>  wrote:
 
 Okay. One of many reasons I ask is that I still have it on my to-do
 to make some improvements on the JSP compiler to support things
 like 1) precompiling all JSPs on deploy and 2) a better Ant task. I
 don't know how much the EL changes might affect this JSP
 compilation (hopefully it's fairly decoupled), and I'd like that to
 not seriously hinder any effort to back-port my improvements to
 Tomcat 7. I'm wondering if this needs to move higher on my list and
 get in before the EL changes. Any insight?
>>> 
>>> I have been thinking about improvements to Jasper as well around
>>> better support for Servlet 3.0 concepts. One area would be decoupling
>>> it from Tomcat, bootstrapping using an SCI as hinted in
>>> ContextConfig. I'd also be interested in improving the Ant task as
>>> well, such as support for pre-compiling a separate package that would
>>> be treated as a web fragment (including web.xml-less pre-compilation,
>>> generating a web-fragment.xml rather than a web.xml snippet or
>>> potentially eliminating the XML entirely if the generated code can be
>>> annotated with @WebServlet). 
>> 
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=50234
>> 
>> I tried some forays into this a few years ago, but got stuck in the
>> confusion of how everything works together. I wanted to do something
>> simple like get the web-app's spec-version number, but could not figure
>> out how to do it.
> 
> I find usage and implementation very confusing as well - an example being 
> things that can be configured on the Task vs. init-params for the JSP servlet 
> vs. things set via system properties. A challenge here is that cleaning it up 
> would likely warrant incompatible changes so would be out for 7.x but 
> potentially possible for 8.x - I'd be interested in what people think about a 
> major refactor that allowed incompatible changes (assuming they were 
> justified not arbitrary).
> 
> You wrote in the bug that "annotation's don't make sense" - could you clarify 
> that? I was thinking that we could have Jasper add @WebServlet("/foo.jsp") to 
> the class generated for "foo.jsp" and then that would be picked up by a 
> container as part of its normal scan. We could also have an SCI 
> @HandlesTypes(JspPage.class) and then register the JSP servlets itself but 
> two issues come to mind:
> 1) the need for metadata that duplicates what the normal servlet annotations 
> could convey
> 2) avoiding conflicts with classes that are bound via jsp-property-group or 
> servlet-mapping elements in XML descriptors
> 
> What happens to a fragment compiled a build-time whose properties differ from 
> those in the final runtime (for example, due to settings resulting from a 
> merged web.xml)? One option would be to say that the build process had simply 
> converted all the JSPs into a jar-full of Servlets and that they should be 
> deployed as such; if the user wants them treated as JSPs they should be 
> packaged as such into META-INF/resources.
> 
> How should we control pre-compile on deploy? The spec already supports if the 
> web.xml contains a  entry with a  and  
> but that requires defining a entry for every individual JSP ("jsp-file 
> element contains the full path to *a* JSP file" on pp 14-160) which is a 
> pain. We could embed an Ant task in a configuration file (e.g. 
> META-INF/jasper.xml) but that adds a dependency on Ant and seems like 
> overkill. Alternatively we can have the SCI read the configuration file and 
> do the necessary.
> 
> If we go the SCI route, we could also define a JspConfiguration annotation or 
> interface that a user could place on a class they want to handle 
> initialization. The SCI could @HandlesTypes that, calling it to handle 
> user-provided initialization. We could expose the translator and compiler 
> interfaces so it can handle pre-compilation; we could refactor the JSPServlet 
> to use them in the same way.

A word of caution: I don't think web.xml-less compilation is possible. web.xml 
/and/ web-fragment.xml can contain , which sets up rules 
surrounding how JSPs are compiled. Before a single JSP in an application can be 
compiled, the deployment descriptor and all web fragments must be processed and 
merged so that the JSP configuration can be taken into consideration during 
compilation. This requires a large portion of the application (you need 
WEB-INF/web.xml and WEB-INF/lib).

N
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 55146] bin/version.sh reports false server number

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55146

Christopher Schultz  changed:

   What|Removed |Added

 Resolution|INVALID |WONTFIX

--- Comment #4 from Christopher Schultz  ---
Sorry, wrong status.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1497064 - in /tomcat/jk/trunk/native/common: jk_lb_worker.c jk_shm.h

2013-06-26 Thread rjung
Author: rjung
Date: Wed Jun 26 19:58:39 2013
New Revision: 1497064

URL: http://svn.apache.org/r1497064
Log:
Remove session_cookie and session_path from shm.
It would only be needed if we wanted to change
it dynamically, e.g. through the status worker.
This is not implemented currently.

Modified:
tomcat/jk/trunk/native/common/jk_lb_worker.c
tomcat/jk/trunk/native/common/jk_shm.h

Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.c?rev=1497064&r1=1497063&r2=1497064&view=diff
==
--- tomcat/jk/trunk/native/common/jk_lb_worker.c (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.c Wed Jun 26 19:58:39 2013
@@ -334,8 +334,6 @@ void jk_lb_pull(lb_worker_t *p, int lock
 p->lbmethod = p->s->lbmethod;
 p->lblock = p->s->lblock;
 p->max_packet_size = p->s->max_packet_size;
-strncpy(p->session_cookie, p->s->session_cookie, JK_SHM_STR_SIZ);
-strncpy(p->session_path, p->s->session_path, JK_SHM_STR_SIZ);
 
 for (i = 0; i < p->num_of_workers; i++) {
 jk_lb_pull_worker(p, i, l);
@@ -370,8 +368,6 @@ void jk_lb_push(lb_worker_t *p, int lock
 p->s->lbmethod = p->lbmethod;
 p->s->lblock = p->lblock;
 p->s->max_packet_size = p->max_packet_size;
-strncpy(p->s->session_cookie, p->session_cookie, JK_SHM_STR_SIZ);
-strncpy(p->s->session_path, p->session_path, JK_SHM_STR_SIZ);
 
 for (i = 0; i < p->num_of_workers; i++) {
 lb_sub_worker_t *w = &p->lb_workers[i];
@@ -1795,8 +1791,6 @@ static int JK_METHOD init(jk_worker_t *p
 strncpy(p->session_path,
 jk_get_lb_session_path(props, p->name, JK_PATH_SESSION_IDENTIFIER),
 JK_SHM_STR_SIZ);
-strcpy(p->s->session_cookie, p->session_cookie);
-strcpy(p->s->session_path, p->session_path);
 
 JK_INIT_CS(&(p->cs), i);
 if (i == JK_FALSE) {

Modified: tomcat/jk/trunk/native/common/jk_shm.h
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_shm.h?rev=1497064&r1=1497063&r2=1497064&view=diff
==
--- tomcat/jk/trunk/native/common/jk_shm.h (original)
+++ tomcat/jk/trunk/native/common/jk_shm.h Wed Jun 26 19:58:39 2013
@@ -182,11 +182,6 @@ struct jk_shm_lb_worker
 /* Last reset time */
 volatile time_t last_reset;
 volatile time_t last_maintain_time;
-/* Session cookie */
-charsession_cookie[JK_SHM_STR_SIZ+1];
-/* Session path */
-charsession_path[JK_SHM_STR_SIZ+1];
-
 };
 typedef struct jk_shm_lb_worker jk_shm_lb_worker_t;
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Jasper improvements

2013-06-26 Thread Christopher Schultz
Jeremy,

On 6/26/13 2:57 PM, Jeremy Boynes wrote:
> On Jun 26, 2013, at 7:49 AM, Christopher Schultz 
>  wrote:
> 
>> Jeremy,
>>
>> On 6/26/13 1:44 AM, Jeremy Boynes wrote:
>>> On Jun 11, 2013, at 1:50 PM, Nick Williams
>>>  wrote:

 Okay. One of many reasons I ask is that I still have it on my to-do
 to make some improvements on the JSP compiler to support things
 like 1) precompiling all JSPs on deploy and 2) a better Ant task. I
 don't know how much the EL changes might affect this JSP
 compilation (hopefully it's fairly decoupled), and I'd like that to
 not seriously hinder any effort to back-port my improvements to
 Tomcat 7. I'm wondering if this needs to move higher on my list and
 get in before the EL changes. Any insight?
>>>
>>> I have been thinking about improvements to Jasper as well around
>>> better support for Servlet 3.0 concepts. One area would be decoupling
>>> it from Tomcat, bootstrapping using an SCI as hinted in
>>> ContextConfig. I'd also be interested in improving the Ant task as
>>> well, such as support for pre-compiling a separate package that would
>>> be treated as a web fragment (including web.xml-less pre-compilation,
>>> generating a web-fragment.xml rather than a web.xml snippet or
>>> potentially eliminating the XML entirely if the generated code can be
>>> annotated with @WebServlet). 
>>
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=50234
>>
>> I tried some forays into this a few years ago, but got stuck in the
>> confusion of how everything works together. I wanted to do something
>> simple like get the web-app's spec-version number, but could not figure
>> out how to do it.
> 
> I find usage and implementation very confusing as well - an example being 
> things that can be configured on the Task vs. init-params for the JSP servlet 
> vs. things set via system properties. A challenge here is that cleaning it up 
> would likely warrant incompatible changes so would be out for 7.x but 
> potentially possible for 8.x - I'd be interested in what people think about a 
> major refactor that allowed incompatible changes (assuming they were 
> justified not arbitrary).
> 
> You wrote in the bug that "annotation's don't make sense" - could you
> clarify that?

Yes: I was thinking that generating classes that used annotations would
be a good idea. In retrospect, I don't believe it would be a good idea
-- at least not by default. Since we are generating a web-fragment,
there's no need to use annotations. We could also cheat and not use a
web-fragment and instead use annotations.

> I was thinking that we could have Jasper add @WebServlet("/foo.jsp")
> to the class generated for "foo.jsp" and then that would be picked up
> by a container as part of its normal scan.

While that is possible, I see no reason not to explicitly-map the
servlets individually in a web-fragment. The user can then easily edit
the single output file (web-fragment.xml) and modify it if necessary.
For instance, maybe some JSPs shouldn't be called directly.

> BTW, can't we use ServletContext#getEffectiveMajorVersion() to
> determine the spec-version number?

Sure we can, but JspC doesn't provide a ServletContext...

-chris



signature.asc
Description: OpenPGP digital signature


[Bug 54086] ConcurrentModificationException in NioReceiver on shutdown

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=54086

Casey Lucas  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #2 from Casey Lucas  ---
I verified that this problem still exists in 7.0.41.  I tracked down and fixed
the problem.

Problem:
During shutdown, NioReceiver.close() is called which ultimately calls
NioReceiver.closeSelector(). selector.keys() is called and an iteration is
performed - closing the existing channels and canceling the keys.  Per the
Selector javadocs, the set cannot be modified during iteration by another
thread or else a ConcurrentModificationException will be thrown.  The set is in
fact being modified by another thread (NioReceiver thread) when existing
connections are closed (see listen() and canceledKey(SelectionKey) methods).

The problem is difficult to reproduce because of timing. I was able to reliably
reproduce the problem but I had to add a sleep in the closeSelector() method
and or set breakpoints during testing.  Ultimately, I couldn't come up with a
test case that didn't need a sleep in closeSelector() so I don't have a test
case for the attached patch.

The attached patch loops (up to 3 times) catching
ConcurrentModificationException during close and sleeps for a brief period
(100ms * attempt number) allowing the NioReceiver thread to finish it's loop.
After the sleep, it attempts to close channels again.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 54086] ConcurrentModificationException in NioReceiver on shutdown

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=54086

--- Comment #3 from Casey Lucas  ---
Created attachment 30489
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30489&action=edit
fix for bug

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 54086] ConcurrentModificationException in NioReceiver on shutdown

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=54086

Casey Lucas  changed:

   What|Removed |Added

Version|7.0.30  |7.0.41

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1497068 - in /tomcat/jk/trunk/native: apache-1.3/ apache-2.0/ common/ iis/

2013-06-26 Thread rjung
Author: rjung
Date: Wed Jun 26 20:11:12 2013
New Revision: 1497068

URL: http://svn.apache.org/r1497068
Log:
Add new configuration attributes
and also mount extensions with the same
names. Currently they don't do anything.

Next step is implementing the following
functionality:

- set_session_cookie: If true, mod_jk sets a
  session cookie to ensure stickyness.

  The name of the cookie is given by the
  already existing configuration attribute
  session_cookie.

  The cookie is only set, if the browser did
  not already send one, or if mod_jk has no
  worker available that fits the route given in
  the cookie send by the browser.

  Default: false

- session_cookie_name: The PATH attribute of the
  cookie send when set_session_cookie is true.

  The path should be set to the application prefix.
  There is no nice way of deriving it from JkMount,
  so you have to set it.

  Default: None

Modified:
tomcat/jk/trunk/native/apache-1.3/mod_jk.c
tomcat/jk/trunk/native/apache-2.0/mod_jk.c
tomcat/jk/trunk/native/common/jk_lb_worker.c
tomcat/jk/trunk/native/common/jk_lb_worker.h
tomcat/jk/trunk/native/common/jk_service.h
tomcat/jk/trunk/native/common/jk_uri_worker_map.c
tomcat/jk/trunk/native/common/jk_uri_worker_map.h
tomcat/jk/trunk/native/common/jk_util.c
tomcat/jk/trunk/native/common/jk_util.h
tomcat/jk/trunk/native/iis/jk_isapi_plugin.c

Modified: tomcat/jk/trunk/native/apache-1.3/mod_jk.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/apache-1.3/mod_jk.c?rev=1497068&r1=1497067&r2=1497068&view=diff
==
--- tomcat/jk/trunk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/jk/trunk/native/apache-1.3/mod_jk.c Wed Jun 26 20:11:12 2013
@@ -767,6 +767,12 @@ static int init_ws_service(apache_privat
 if (e->session_path) {
 s->extension.session_path = ap_pstrdup(r->pool, e->session_path);
 }
+if (e->set_session_cookie) {
+s->extension.set_session_cookie = e->set_session_cookie;
+}
+if (e->session_cookie_path) {
+s->extension.session_cookie_path = ap_pstrdup(r->pool, 
e->session_cookie_path);
+}
 }
 reply_timeout = ap_table_get(r->subprocess_env, JK_ENV_REPLY_TIMEOUT);
 if (reply_timeout) {

Modified: tomcat/jk/trunk/native/apache-2.0/mod_jk.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/apache-2.0/mod_jk.c?rev=1497068&r1=1497067&r2=1497068&view=diff
==
--- tomcat/jk/trunk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/jk/trunk/native/apache-2.0/mod_jk.c Wed Jun 26 20:11:12 2013
@@ -825,6 +825,12 @@ static int init_ws_service(apache_privat
 if (e->session_path) {
 s->extension.session_path = apr_pstrdup(r->pool, e->session_path);
 }
+if (e->set_session_cookie) {
+s->extension.set_session_cookie = e->set_session_cookie;
+}
+if (e->session_cookie_path) {
+s->extension.session_cookie_path = apr_pstrdup(r->pool, 
e->session_cookie_path);
+}
 }
 reply_timeout = apr_table_get(r->subprocess_env, JK_ENV_REPLY_TIMEOUT);
 if (reply_timeout) {

Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.c?rev=1497068&r1=1497067&r2=1497068&view=diff
==
--- tomcat/jk/trunk/native/common/jk_lb_worker.c (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.c Wed Jun 26 20:11:12 2013
@@ -1791,6 +1791,10 @@ static int JK_METHOD init(jk_worker_t *p
 strncpy(p->session_path,
 jk_get_lb_session_path(props, p->name, JK_PATH_SESSION_IDENTIFIER),
 JK_SHM_STR_SIZ);
+p->set_session_cookie = jk_get_lb_set_session_cookie(props, p->name, 
JK_FALSE);
+strncpy(p->session_cookie_path,
+jk_get_lb_session_cookie_path(props, p->name, "/"),
+JK_SHM_STR_SIZ);
 
 JK_INIT_CS(&(p->cs), i);
 if (i == JK_FALSE) {

Modified: tomcat/jk/trunk/native/common/jk_lb_worker.h
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.h?rev=1497068&r1=1497067&r2=1497068&view=diff
==
--- tomcat/jk/trunk/native/common/jk_lb_worker.h (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.h Wed Jun 26 20:11:12 2013
@@ -200,6 +200,8 @@ struct lb_worker
 char session_cookie[JK_SHM_STR_SIZ+1];
 /* Session path */
 char session_path[JK_SHM_STR_SIZ+1];
+int  set_session_cookie;
+char session_cookie_path[JK_SHM_STR_SIZ+1];
 };
 typedef struct lb_worker lb_worker_t;
 

Modified: tomcat/jk/trunk/native/common/jk_service.h
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_service.h?rev=1497068&r1=1

svn commit: r1497071 - in /tomcat/jk/trunk/native/common: jk_lb_worker.c jk_service.h

2013-06-26 Thread rjung
Author: rjung
Date: Wed Jun 26 20:17:05 2013
New Revision: 1497071

URL: http://svn.apache.org/r1497071
Log:
Add a flag to pass status, whether a request
could be handled in a sticky way.

Modified:
tomcat/jk/trunk/native/common/jk_lb_worker.c
tomcat/jk/trunk/native/common/jk_service.h

Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.c?rev=1497071&r1=1497070&r2=1497071&view=diff
==
--- tomcat/jk/trunk/native/common/jk_lb_worker.c (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.c Wed Jun 26 20:17:05 2013
@@ -877,6 +877,8 @@ static int find_bysession_route(jk_ws_se
 if (candidate < 0) {
 uses_domain = 1;
 candidate = find_best_bydomain(s, p, session_route, states, l);
+} else {
+s->sticky = JK_TRUE;
 }
 if (candidate >= 0) {
 lb_sub_worker_t wr = p->lb_workers[candidate];
@@ -939,8 +941,10 @@ static int find_failover_worker(jk_ws_se
 break;
 }
 }
-if (redirect)
+if (redirect) {
 rc = find_bysession_route(s, p, redirect, states, l);
+s->sticky = JK_FALSE;
+}
 return rc;
 }
 
@@ -967,6 +971,7 @@ static int get_most_suitable_worker(jk_w
 int rc = -1;
 
 JK_TRACE_ENTER(l);
+s->sticky = JK_FALSE;
 if (p->num_of_workers == 1) {
 /* No need to find the best worker
  * if there is a single one
@@ -978,6 +983,7 @@ static int get_most_suitable_worker(jk_w
 activation = p->lb_workers[0].activation;
 if (JK_WORKER_USABLE_STICKY(states[0], activation)) {
 if (activation != JK_LB_ACTIVATION_DISABLED) {
+s->sticky = JK_TRUE;
 JK_TRACE_EXIT(l);
 return 0;
 }
@@ -1240,8 +1246,8 @@ static int JK_METHOD service(jk_endpoint
 
 if (JK_IS_DEBUG_LEVEL(l))
 jk_log(l, JK_LOG_DEBUG,
-   "service worker=%s route=%s",
-   rec->name, s->route);
+   "service worker=%s route=%s failover=%s",
+   rec->name, s->route, s->sticky ? "false" : "true");
 
 if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC)
 jk_shm_lock();

Modified: tomcat/jk/trunk/native/common/jk_service.h
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_service.h?rev=1497071&r1=1497070&r2=1497071&view=diff
==
--- tomcat/jk/trunk/native/common/jk_service.h (original)
+++ tomcat/jk/trunk/native/common/jk_service.h Wed Jun 26 20:17:05 2013
@@ -224,6 +224,12 @@ struct jk_ws_service
 unsigned num_attributes;/* Number of request attributes */
 
 /*
+ * JK_TRUE iff handled by a load balancer, the request
+ * contained a route and it is the route of the current worker.
+ */
+int sticky;
+
+/*
  * The route is in use when the adapter load balance among
  * several workers. It is the ID of a specific target in the load balance
  * group. We are using this variable to implement target session



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 54086] ConcurrentModificationException in NioReceiver on shutdown

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=54086

--- Comment #4 from Casey Lucas  ---
Created attachment 30490
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30490&action=edit
fix for bug

i inadvertently left in a printStackTrace on the original patch. use this one
instead.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 55144] NIO connection locked when trying to release it

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55144

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO
 OS||All

--- Comment #1 from Mark Thomas  ---
I'm leaning towards resolving this as invalid. Tomcat is waiting to write some
data and is waiting for the configured timeout (not sure if Atmosphere or the
app sets the timeout) to send the data. If Tomcat is waiting for hours that is
because of the timeout that has been configured.

I don't see any evidence in this report of incorrect behaviour by Tomcat.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1497079 - in /tomcat/jk/trunk/native/common: jk_ajp_common.c jk_lb_worker.c jk_service.h

2013-06-26 Thread rjung
Author: rjung
Date: Wed Jun 26 20:25:47 2013
New Revision: 1497079

URL: http://svn.apache.org/r1497079
Log:
Add ability to set additional response headers
which do not come from the backend.

Use them to set a cookie if "set_session_cookie"
is true and we didn't get a session cookie, or
couldn't fulfil the routing condition required.

Documentation next.

Modified:
tomcat/jk/trunk/native/common/jk_ajp_common.c
tomcat/jk/trunk/native/common/jk_lb_worker.c
tomcat/jk/trunk/native/common/jk_service.h

Modified: tomcat/jk/trunk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp_common.c?rev=1497079&r1=1497078&r2=1497079&view=diff
==
--- tomcat/jk/trunk/native/common/jk_ajp_common.c (original)
+++ tomcat/jk/trunk/native/common/jk_ajp_common.c Wed Jun 26 20:25:47 2013
@@ -1870,6 +1870,32 @@ static int ajp_process_callback(jk_msg_b
 JK_TRACE_EXIT(l);
 return JK_AJP13_ERROR;
 }
+if (r->num_resp_headers > 0) {
+char **old_names = res.header_names;
+char **old_values = res.header_values;
+if (JK_IS_DEBUG_LEVEL(l))
+jk_log(l, JK_LOG_DEBUG, "Adding %d response headers to %d 
headers received from tomcat", r->num_resp_headers, res.num_headers);
+res.header_names  = jk_pool_alloc(r->pool,
+  (r->num_resp_headers + 
res.num_headers) * sizeof(char *));
+res.header_values = jk_pool_alloc(r->pool,
+  (r->num_resp_headers + 
res.num_headers) * sizeof(char *));
+if (!res.header_names || !res.header_values) {
+jk_log(l, JK_LOG_ERROR,
+"Failed allocating one %d response headers.", 
r->num_resp_headers + res.num_headers);
+res.header_names = old_names;
+res.header_values = old_values;
+} else {
+if (res.num_headers) {
+memcpy(res.header_names, old_names, res.num_headers * 
sizeof(char *));
+memcpy(res.header_values, old_values, res.num_headers 
* sizeof(char *));
+}
+if (r->num_resp_headers) {
+memcpy(res.header_names + res.num_headers, 
r->resp_headers_names, r->num_resp_headers * sizeof(char *));
+memcpy(res.header_values + res.num_headers, 
r->resp_headers_values, r->num_resp_headers * sizeof(char *));
+}
+res.num_headers = res.num_headers + r->num_resp_headers;
+}
+}
 r->http_response_status = res.status;
 if (r->extension.fail_on_status_size > 0)
 rc = is_http_status_fail(r->extension.fail_on_status_size,

Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.c?rev=1497079&r1=1497078&r2=1497079&view=diff
==
--- tomcat/jk/trunk/native/common/jk_lb_worker.c (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.c Wed Jun 26 20:25:47 2013
@@ -1307,6 +1307,41 @@ static int JK_METHOD service(jk_endpoint
 if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC)
 jk_shm_unlock();
 
+if (!s->sticky && (s->extension.set_session_cookie || 
p->worker->set_session_cookie)) {
+char **old_names = s->resp_headers_names;
+char **old_values = s->resp_headers_values;
+s->resp_headers_names  = jk_pool_alloc(s->pool,
+  (s->num_resp_headers + 
1) * sizeof(char *));
+s->resp_headers_values = jk_pool_alloc(s->pool,
+  (s->num_resp_headers + 
1) * sizeof(char *));
+if (!s->resp_headers_names || !s->resp_headers_values) {
+jk_log(l, JK_LOG_ERROR,
+"Failed allocating %d new response headers.", 
s->num_resp_headers + 1);
+s->resp_headers_names = old_names;
+s->resp_headers_values = old_values;
+} else if (s->num_resp_headers) {
+memcpy(s->resp_headers_names, old_names, 
s->num_resp_headers * sizeof(char *));
+memcpy(s->resp_headers_values, old_values, 
s->num_resp_headers * sizeof(char *));
+}
+s->resp_headers_names[s->num_resp_headers] = "Set-Cookie";
+s->resp_headers_values[s->num_resp_headers] = 
jk_pool_strcatv(s->pool, p->worker->session_cookie,
+

[Bug 55144] NIO connection locked when trying to release it

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55144

--- Comment #2 from Pavel  ---
here is my connection config:



As you can see it has a timeout of 20 sec - so I'm not sure how it can lock for
hours.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1497091 - in /tomcat/jk/trunk/xdocs: miscellaneous/changelog.xml reference/uriworkermap.xml reference/workers.xml

2013-06-26 Thread rjung
Author: rjung
Date: Wed Jun 26 20:54:26 2013
New Revision: 1497091

URL: http://svn.apache.org/r1497091
Log:
Basic docs for the new cookie generation feature.

Modified:
tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
tomcat/jk/trunk/xdocs/reference/uriworkermap.xml
tomcat/jk/trunk/xdocs/reference/workers.xml

Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=1497091&r1=1497090&r2=1497091&view=diff
==
--- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Wed Jun 26 20:54:26 2013
@@ -56,6 +56,11 @@
 Clean up config file parsing. Worker names are now restricted to
 60 bytes. (rjung)
   
+  
+Allow to set a stickyness cookie in case a web framework breaks
+Tomcat's adding of the routing ID to the end of the JSESSIONID
+cookie. (rjung)
+  
 
   
 

Modified: tomcat/jk/trunk/xdocs/reference/uriworkermap.xml
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/reference/uriworkermap.xml?rev=1497091&r1=1497090&r2=1497091&view=diff
==
--- tomcat/jk/trunk/xdocs/reference/uriworkermap.xml (original)
+++ tomcat/jk/trunk/xdocs/reference/uriworkermap.xml Wed Jun 26 20:54:26 2013
@@ -340,12 +340,19 @@ for this status code.
 
 
 
-
+
 
 
-The extensions session_cookie and session_path
-allows to define the load balancer worker attributes of the same name
-per mount.
+The extensions
+
+session_cookie
+session_path
+set_session_cookie
+session_cookie_path
+
+allow to define the load balancer worker attributes of the same name
+per mount. See their descriptions in the
+worker.properties configuration 
reference.
 
 
 

Modified: tomcat/jk/trunk/xdocs/reference/workers.xml
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/reference/workers.xml?rev=1497091&r1=1497090&r2=1497091&view=diff
==
--- tomcat/jk/trunk/xdocs/reference/workers.xml (original)
+++ tomcat/jk/trunk/xdocs/reference/workers.xml Wed Jun 26 20:54:26 2013
@@ -1067,6 +1067,40 @@ This feature has been added in jk 1.2
 
 
 
+
+Activates generation of session stickyness cookies. Typically you don't need 
this.
+
+Some web frameworks replace Tomcat session management and use a different way
+of generating session IDs. As a consequence the routing ID added by Tomcat to 
the
+end of the session ID is lost and we no longer can do sticky load balancing.
+As a workaround you can use the following steps:
+
+Choose a non-standard cookie name using the "session_cookie" 
attribute.
+Activate cookie sending by setting the attribute "set_session_cookie" to 
"True".
+Set the attribute "session_cookie_path" to the correct application URI, 
like
+e.g. "/myapp/".
+
+
+
+The cookie will only be send if the request does not already contain
+a cookie of the same name, or that cookie does not contain a routing
+ID which the load balancer can fulfill. Especially after a node failover
+we will send a new cookie to switch stickyness to the new node.
+
+
+This feature has been added in jk 1.2.38.
+
+
+
+
+This attribute is only used if "set_session_cookie" is set to "True".
+See "set_session_cookie" for a description. If the value of 
"session_cookie_path"
+is empty (default), then the send cookie will not contain a PATH information.
+
+This feature has been added in jk 1.2.38.
+
+
+
 
 
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1497098 - in /tomcat/trunk/java/org/apache/tomcat/websocket/pojo: LocalStrings.properties PojoMethodMapping.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 21:09:11 2013
New Revision: 1497098

URL: http://svn.apache.org/r1497098
Log:
WebSocket 1.0, Section 4.3
Invalid use of @PathParam should trigger a deployment error

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/LocalStrings.properties
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/LocalStrings.properties?rev=1497098&r1=1497097&r2=1497098&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/LocalStrings.properties 
Wed Jun 26 21:09:11 2013
@@ -25,8 +25,10 @@ pojoMethodMapping.duplicateMessageParam=
 pojoMethodMapping.duplicatePongMessageParam=Multiple PongMessage parameters 
present on the method [{0}] of class [{1}] that was annotated with OnMessage
 pojoMethodMapping.duplicateSessionParam=Multiple session parameters present on 
the method [{0}] of class [{1}] that was annotated with OnMessage
 pojoMethodMapping.invalidDecoder=The specified decoder of type [{0}] could not 
be instantiated
+pojoMethodMapping.invalidPathParamType=Parameters annotated with @PathParam 
may only be Strings, Java primitives or a boxed version thereof
 pojoMethodMapping.noPayload=No payload parameter present on the method [{0}] 
of class [{1}] that was annotated with OnMessage
 pojoMethodMapping.onErrorNoThrowable=No Throwable parameter was present on the 
method [{0}] of class [{1}] that was annotated with OnError
+pojoMethodMapping.paramWithoutAnnotation=A parameter of type [{0}] was found 
on method[{1}] of class [{2}] that did not have a @PathParam annotation
 pojoMethodMapping.partialInputStream=Invalid InputStream and boolean 
parameters present on the method [{0}] of class [{1}] that was annotated with 
OnMessage
 pojoMethodMapping.partialObject=Invalid Object and boolean parameters present 
on the method [{0}] of class [{1}] that was annotated with OnMessage
 pojoMethodMapping.partialPong=Invalid PongMesssge and boolean parameters 
present on the method [{0}] of class [{1}] that was annotated with OnMessage

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java?rev=1497098&r1=1497097&r2=1497098&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
Wed Jun 26 21:09:11 2013
@@ -175,7 +175,7 @@ public class PojoMethodMapping {
 
 
 private static PojoPathParam[] getPathParams(Method m,
-MethodType methodType) {
+MethodType methodType) throws DeploymentException {
 if (m == null) {
 return new PojoPathParam[0];
 }
@@ -202,6 +202,15 @@ public class PojoMethodMapping {
 for (Annotation paramAnnotation : paramAnnotations) {
 if (paramAnnotation.annotationType().equals(
 PathParam.class)) {
+// Check that the type is valid. "0" coerces to every
+// valid type
+try {
+Util.coerceToType(type, "0");
+} catch (IllegalArgumentException iae) {
+throw new DeploymentException(sm.getString(
+"pojoMethodMapping.invalidPathParamType"),
+iae);
+}
 result[i] = new PojoPathParam(type,
 ((PathParam) paramAnnotation).value());
 break;
@@ -209,12 +218,14 @@ public class PojoMethodMapping {
 }
 // Parameters without annotations are not permitted
 if (result[i] == null) {
-throw new IllegalArgumentException();
+throw new DeploymentException(sm.getString(
+"pojoMethodMapping.paramWithoutAnnotation",
+type, m.getName(), m.getClass().getName()));
 }
 }
 }
 if (methodType == MethodType.ON_ERROR && !foundThrowable) {
-throw new IllegalArgumentException(sm.getString(
+throw new DeploymentException(sm.getString(
 "pojoMethodMapping.onErrorNoThrowable",
 m.getName(), m.getDeclaringClass().getName()));
 }



-
To unsubscribe, e-ma

Re: mod_jk, JSESSION_ID and load-balancing

2013-06-26 Thread Rainer Jung
Hi Henri,

you can find a dev snapshot at:

http://people.apache.org/~rjung/mod_jk-dev/source/jk-1.2.38-dev/

You know those are not releases.

The updated documentation is at:

http://people.apache.org/~rjung/mod_jk-dev/docs/jk-1.2.38-dev/reference/workers.html

look for "set_session_cookie".

I did some basic tests. If it doesn't seem to work:

- turn debug logging on (JkLogLevel debug) on a not to busy system

- use a client (browser) for which you can trace outgoing and incoming
headers, e.g. firefox with firebug or similar tools

If mod_jk crashes please try to get a core dump and from that a stack.

Basic configuration in your case:

worker.balancer.type=lb
... normal lb setup ...
worker.balancer.set_session_cookie=true
worker.balancer.session_cookie=HENRICOOKIE
worker.balancer.session_cookie_path=/nexus

The name of the cookie ("HENRICOOKIE") is arbitrary but it should differ
from any other cookie used, especially don't choose "JSESSIONID".

The session cookie path "/nexus" must be chosen to fit your application
URI. If the balancer serves multiple applications and you want mod_jk
cookies for all of them, you could use "/". In that case the client will
use the same node for all applications.

On the first request mod_jk should send back a cookie containing a dot
(".") and the name (route) of the chosen target worker. As long as the
client presents the cookie during follow up requests, the cookie will no
longer be sent by the server. If the cookie is missing, or the server
needs to do a request failover to another worker, a new cookie will be
send to the client.

As usual you can log an incoming cookie in the access log using
%{HENRICOOKIE}C (adjust name) and the outgoing Cookie using
%{Set-Cookie}o (Set-Cookie is the header name).

Finally: don't recommend this as a general setup. Built in Tomcat
session management and jvmRoute handling works very well and is
generally understood. Letting mod_jk handle the cookie is just a
workaround if a web framework or webapp breaks Tomcat's session ID
generation.

Have fun and let me know whether this already works for you.

BTW: I'm pretty busy on Thursday, so quite possible I can not react
immediately.

Regards,

Rainer


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1497124 - /tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeText.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 21:51:01 2013
New Revision: 1497124

URL: http://svn.apache.org/r1497124
Log:
Fix indent / format

Modified:

tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeText.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeText.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeText.java?rev=1497124&r1=1497123&r2=1497124&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeText.java
 (original)
+++ 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMessageHandlerWholeText.java
 Wed Jun 26 21:51:01 2013
@@ -62,7 +62,8 @@ public class PojoMessageHandlerWholeText
 primitiveType = null;
 }
 
-try {if (decoderClazzes != null) {
+try {
+if (decoderClazzes != null) {
 for (Class decoderClazz : decoderClazzes) {
 if (Text.class.isAssignableFrom(decoderClazz)) {
 Text decoder = (Text) decoderClazz.newInstance();
@@ -78,7 +79,7 @@ public class PojoMessageHandlerWholeText
 // Binary decoder - ignore it
 }
 }
-}
+}
 } catch (IllegalAccessException | InstantiationException e) {
 throw new IllegalArgumentException(e);
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1497135 - /tomcat/trunk/java/org/apache/tomcat/websocket/Util.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 22:13:50 2013
New Revision: 1497135

URL: http://svn.apache.org/r1497135
Log:
Fix wrong MessageHandler type for Reader
Add support for message handlers for primitives

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/Util.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Util.java?rev=1497135&r1=1497134&r2=1497135&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/Util.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/Util.java Wed Jun 26 22:13:50 
2013
@@ -360,7 +360,15 @@ public class Util {
 getOnMessageMethod(listener), null,
 endpointConfig, null, new Object[1], 0, true, -1,
 -1),
-MessageHandlerResultType.BINARY);
+MessageHandlerResultType.TEXT);
+results.add(result);
+} else if (Util.isPrimitive(target)) {
+MessageHandlerResult result = new MessageHandlerResult(
+new PojoMessageHandlerWholeText(listener,
+getOnMessageMethod(listener), null,
+endpointConfig, null, new Object[1], 0, true, -1,
+-1),
+MessageHandlerResultType.TEXT);
 results.add(result);
 } else {
 // More complex case - listener that requires a decoder



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1497136 - /tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 22:14:57 2013
New Revision: 1497136

URL: http://svn.apache.org/r1497136
Log:
Rename prior to some more BZ 55143 related changes

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java?rev=1497136&r1=1497135&r2=1497136&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
Wed Jun 26 22:14:57 2013
@@ -64,7 +64,7 @@ public class PojoMethodMapping {
 private final PojoPathParam[] onOpenParams;
 private final PojoPathParam[] onCloseParams;
 private final PojoPathParam[] onErrorParams;
-private final Set onMessage = new HashSet<>();
+private final Set onMessage = new HashSet<>();
 private final String wsPath;
 
 
@@ -107,7 +107,7 @@ public class PojoMethodMapping {
 OnError.class, clazzPojo));
 }
 } else if (method.getAnnotation(OnMessage.class) != null) {
-onMessage.add(new MessageMethod(method, decoders));
+onMessage.add(new MessageHandlerInfo(method, decoders));
 } else {
 // Method not annotated
 }
@@ -166,7 +166,7 @@ public class PojoMethodMapping {
 Map pathParameters, Session session,
 EndpointConfig config) {
 Set result = new HashSet<>();
-for (MessageMethod messageMethod : onMessage) {
+for (MessageHandlerInfo messageMethod : onMessage) {
 result.add(messageMethod.getMessageHandler(pojo, pathParameters,
 session, config));
 }
@@ -264,7 +264,7 @@ public class PojoMethodMapping {
 }
 
 
-private static class MessageMethod {
+private static class MessageHandlerInfo {
 
 private final Method m;
 private int indexString = -1;
@@ -281,7 +281,7 @@ public class PojoMethodMapping {
 private boolean useDecoder = false;
 private long maxMessageSize = -1;
 
-public MessageMethod(Method m, List decoderEntries) {
+public MessageHandlerInfo(Method m, List decoderEntries) 
{
 this.m = m;
 
 Class[] types = m.getParameterTypes();



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1497142 - /tomcat/trunk/java/org/apache/tomcat/websocket/Util.java

2013-06-26 Thread markt
Author: markt
Date: Wed Jun 26 22:23:04 2013
New Revision: 1497142

URL: http://svn.apache.org/r1497142
Log:
Remove primitive support for MessageHandler - it is only required for @OnMessage

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/Util.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Util.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Util.java?rev=1497142&r1=1497141&r2=1497142&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/Util.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/Util.java Wed Jun 26 22:23:04 
2013
@@ -362,14 +362,6 @@ public class Util {
 -1),
 MessageHandlerResultType.TEXT);
 results.add(result);
-} else if (Util.isPrimitive(target)) {
-MessageHandlerResult result = new MessageHandlerResult(
-new PojoMessageHandlerWholeText(listener,
-getOnMessageMethod(listener), null,
-endpointConfig, null, new Object[1], 0, true, -1,
--1),
-MessageHandlerResultType.TEXT);
-results.add(result);
 } else {
 // More complex case - listener that requires a decoder
 DecoderMatch decoderMatch;



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 55150] New: Memory leak with tag-file

2013-06-26 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55150

Bug ID: 55150
   Summary: Memory leak with tag-file
   Product: Tomcat 6
   Version: unspecified
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: Jasper
  Assignee: dev@tomcat.apache.org
  Reporter: jiangguo...@gmail.com

Hello Tomcat (Jasper) developers,
Can you explain in detail why following ticket is closed with "WONTFIX"?
http://issues.apache.org/bugzilla/show_bug.cgi?id=43878

The tag-file complied with “org.apache.jsp.tag.*” could be loaded by class
loader in each involved JSP. This behavior will turn out there are duplicate
classes loaded and PERM space issue.

Reference:
http://tomcat.10.x6.nabble.com/Memory-leak-with-tagfiles-re-use-JasperLoader-td2249050.html

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Jasper improvements

2013-06-26 Thread Jeremy Boynes
On Jun 26, 2013, at 12:10 PM, Nick Williams  
wrote:

> 
> On Jun 26, 2013, at 1:57 PM, Jeremy Boynes wrote:
> 
>> On Jun 26, 2013, at 7:49 AM, Christopher Schultz 
>>  wrote:
>> 
>>> Jeremy,
>>> 
>>> On 6/26/13 1:44 AM, Jeremy Boynes wrote:
 On Jun 11, 2013, at 1:50 PM, Nick Williams
  wrote:
> 
> Okay. One of many reasons I ask is that I still have it on my to-do
> to make some improvements on the JSP compiler to support things
> like 1) precompiling all JSPs on deploy and 2) a better Ant task. I
> don't know how much the EL changes might affect this JSP
> compilation (hopefully it's fairly decoupled), and I'd like that to
> not seriously hinder any effort to back-port my improvements to
> Tomcat 7. I'm wondering if this needs to move higher on my list and
> get in before the EL changes. Any insight?
 
 I have been thinking about improvements to Jasper as well around
 better support for Servlet 3.0 concepts. One area would be decoupling
 it from Tomcat, bootstrapping using an SCI as hinted in
 ContextConfig. I'd also be interested in improving the Ant task as
 well, such as support for pre-compiling a separate package that would
 be treated as a web fragment (including web.xml-less pre-compilation,
 generating a web-fragment.xml rather than a web.xml snippet or
 potentially eliminating the XML entirely if the generated code can be
 annotated with @WebServlet). 
>>> 
>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=50234
>>> 
>>> I tried some forays into this a few years ago, but got stuck in the
>>> confusion of how everything works together. I wanted to do something
>>> simple like get the web-app's spec-version number, but could not figure
>>> out how to do it.
>> 
>> I find usage and implementation very confusing as well - an example being 
>> things that can be configured on the Task vs. init-params for the JSP 
>> servlet vs. things set via system properties. A challenge here is that 
>> cleaning it up would likely warrant incompatible changes so would be out for 
>> 7.x but potentially possible for 8.x - I'd be interested in what people 
>> think about a major refactor that allowed incompatible changes (assuming 
>> they were justified not arbitrary).
>> 
>> You wrote in the bug that "annotation's don't make sense" - could you 
>> clarify that? I was thinking that we could have Jasper add 
>> @WebServlet("/foo.jsp") to the class generated for "foo.jsp" and then that 
>> would be picked up by a container as part of its normal scan. We could also 
>> have an SCI @HandlesTypes(JspPage.class) and then register the JSP servlets 
>> itself but two issues come to mind:
>> 1) the need for metadata that duplicates what the normal servlet annotations 
>> could convey
>> 2) avoiding conflicts with classes that are bound via jsp-property-group or 
>> servlet-mapping elements in XML descriptors
>> 
>> What happens to a fragment compiled a build-time whose properties differ 
>> from those in the final runtime (for example, due to settings resulting from 
>> a merged web.xml)? One option would be to say that the build process had 
>> simply converted all the JSPs into a jar-full of Servlets and that they 
>> should be deployed as such; if the user wants them treated as JSPs they 
>> should be packaged as such into META-INF/resources.
>> 
>> How should we control pre-compile on deploy? The spec already supports if 
>> the web.xml contains a  entry with a  and 
>>  but that requires defining a entry for every individual 
>> JSP ("jsp-file element contains the full path to *a* JSP file" on pp 14-160) 
>> which is a pain. We could embed an Ant task in a configuration file (e.g. 
>> META-INF/jasper.xml) but that adds a dependency on Ant and seems like 
>> overkill. Alternatively we can have the SCI read the configuration file and 
>> do the necessary.
>> 
>> If we go the SCI route, we could also define a JspConfiguration annotation 
>> or interface that a user could place on a class they want to handle 
>> initialization. The SCI could @HandlesTypes that, calling it to handle 
>> user-provided initialization. We could expose the translator and compiler 
>> interfaces so it can handle pre-compilation; we could refactor the 
>> JSPServlet to use them in the same way.
> 
> A word of caution: I don't think web.xml-less compilation is possible. 
> web.xml /and/ web-fragment.xml can contain , which sets up rules 
> surrounding how JSPs are compiled. Before a single JSP in an application can 
> be compiled, the deployment descriptor and all web fragments must be 
> processed and merged so that the JSP configuration can be taken into 
> consideration during compilation. This requires a large portion of the 
> application (you need WEB-INF/web.xml and WEB-INF/lib).

Could we do this with two different modes: one for a fully assembled web 
application, the other for a standalone JSP web fragment? 

In fully-assembled mode users would assem

Re: Jasper improvements

2013-06-26 Thread Jeremy Boynes
On Jun 26, 2013, at 12:58 PM, Christopher Schultz 
 wrote:
> On 6/26/13 2:57 PM, Jeremy Boynes wrote:
>> 
>> You wrote in the bug that "annotation's don't make sense" - could you
>> clarify that?
> 
> Yes: I was thinking that generating classes that used annotations would
> be a good idea. In retrospect, I don't believe it would be a good idea
> -- at least not by default. Since we are generating a web-fragment,
> there's no need to use annotations. We could also cheat and not use a
> web-fragment and instead use annotations.
> 
>> I was thinking that we could have Jasper add @WebServlet("/foo.jsp")
>> to the class generated for "foo.jsp" and then that would be picked up
>> by a container as part of its normal scan.
> 
> While that is possible, I see no reason not to explicitly-map the
> servlets individually in a web-fragment. The user can then easily edit
> the single output file (web-fragment.xml) and modify it if necessary.
> For instance, maybe some JSPs shouldn't be called directly.

Perhaps this should be user-configurable (option to generate a web-fragment.xml 
or annotations on the generated classes)?

>> BTW, can't we use ServletContext#getEffectiveMajorVersion() to
>> determine the spec-version number?
> 
> Sure we can, but JspC doesn't provide a ServletContext...

It kind of does:
  
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JspCServletContext.java?view=markup
but it also has its own versions of WebXml and JspConfig, as well as the 
JspCompilationContext and JspRuntimeContext. This is one of the areas I found 
confusing :)

As I was proposing in my other post, if we could make the compilation process 
driven entirely off a ServletContext we can separate the JSP processing from 
the context setup which should simplify its implementation. JspC would then 
handle setup of a build-time JspCServletContext in the same way Catalina sets 
up the runtime ServletContext.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: mod_jk, JSESSION_ID and load-balancing

2013-06-26 Thread Henri Gomez
Rainer, you rocks !

I'll test it today, more feedback to come :)

Thanks


2013/6/26 Rainer Jung 

> Hi Henri,
>
> you can find a dev snapshot at:
>
> http://people.apache.org/~rjung/mod_jk-dev/source/jk-1.2.38-dev/
>
> You know those are not releases.
>
> The updated documentation is at:
>
>
> http://people.apache.org/~rjung/mod_jk-dev/docs/jk-1.2.38-dev/reference/workers.html
>
> look for "set_session_cookie".
>
> I did some basic tests. If it doesn't seem to work:
>
> - turn debug logging on (JkLogLevel debug) on a not to busy system
>
> - use a client (browser) for which you can trace outgoing and incoming
> headers, e.g. firefox with firebug or similar tools
>
> If mod_jk crashes please try to get a core dump and from that a stack.
>
> Basic configuration in your case:
>
> worker.balancer.type=lb
> ... normal lb setup ...
> worker.balancer.set_session_cookie=true
> worker.balancer.session_cookie=HENRICOOKIE
> worker.balancer.session_cookie_path=/nexus
>
> The name of the cookie ("HENRICOOKIE") is arbitrary but it should differ
> from any other cookie used, especially don't choose "JSESSIONID".
>
> The session cookie path "/nexus" must be chosen to fit your application
> URI. If the balancer serves multiple applications and you want mod_jk
> cookies for all of them, you could use "/". In that case the client will
> use the same node for all applications.
>
> On the first request mod_jk should send back a cookie containing a dot
> (".") and the name (route) of the chosen target worker. As long as the
> client presents the cookie during follow up requests, the cookie will no
> longer be sent by the server. If the cookie is missing, or the server
> needs to do a request failover to another worker, a new cookie will be
> send to the client.
>
> As usual you can log an incoming cookie in the access log using
> %{HENRICOOKIE}C (adjust name) and the outgoing Cookie using
> %{Set-Cookie}o (Set-Cookie is the header name).
>
> Finally: don't recommend this as a general setup. Built in Tomcat
> session management and jvmRoute handling works very well and is
> generally understood. Letting mod_jk handle the cookie is just a
> workaround if a web framework or webapp breaks Tomcat's session ID
> generation.
>
> Have fun and let me know whether this already works for you.
>
> BTW: I'm pretty busy on Thursday, so quite possible I can not react
> immediately.
>
> Regards,
>
> Rainer
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>