Running with SecurityManager: CometProcessor servlets throw NoSuchMethodException
Hi all, As of Tomcat 7.0.52 a bug was introduced which caused a regression with CometProcessor servlets being served on Tomcat running with a SecurityManager. I have created a bug report [1] and attached a patch with a proposed fix. If there is anything else you need from me to push this issue forward please let me know. [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=58116 Cheers, -- :: Johnathan Crawford :: Software Architect Sulake Oy | Kaarlenkatu 9-11 | 00510 Helsinki, Finland http://www.sulake.com | tel +358 10 656 7000 | fax +358 10 656 7010 - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1301284 - in /tomcat/tc7.0.x/trunk: ./ webapps/docs/ webapps/examples/WEB-INF/ webapps/examples/WEB-INF/classes/websocket/ webapps/examples/WEB-INF/classes/websocket/chat/ webapps/exa
On 16/03/2012 12:57 AM, ma...@apache.org wrote: Author: markt Date: Thu Mar 15 23:57:00 2012 New Revision: 1301284 Looks like chat.html missed the changeset? URL: http://svn.apache.org/viewvc?rev=1301284view=rev Log: Implement chat example Plus some minor clean-up. Patch provided by Johno Crawford Added: tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/chat/ - copied from r1301280, tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/chat/ tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/echo/ - copied from r1301280, tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/ Removed: tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/EchoStream.java Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/SnakeWebSocketServlet.java tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/web.xml tomcat/tc7.0.x/trunk/webapps/examples/websocket/echo.html tomcat/tc7.0.x/trunk/webapps/examples/websocket/index.html tomcat/tc7.0.x/trunk/webapps/examples/websocket/snake.html Propchange: tomcat/tc7.0.x/trunk/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 15 23:57:00 2012 @@ -1 +1 @@ -/tomcat/trunk:1156115-1157160,1157162-1157859,1157862-1157942,1157945-1160347,1160349-1163716,1163718-1166689,1166691-1174340,1174342-1175596,1175598-1175611,1175613-1175932,1175934-1177783,1177785-1177980,1178006-1180720,1180722-1183094,1183096-1187753,1187755,1187775,1187801,1187806,1187809,1187826-1188312,1188314-1188401,1188646-1188840,1188842-1190176,1190178-1195223,1195225-1195953,1195955,1195957-1201238,1201240-1203345,1203347-1206623,1206625-1208046,1208073,1208096,1208114,1208145,1208772,1209194-1212125,1212127-1220291,1220293,1220295-1221321,1221323-1222328,1222332-1222401,1222405-1222795,1222850-1222950,1222969-1225326,1225328-1225463,1225465,1225627,1225629-1226534,1226536-1228908,1228911-1228923,1228927-1229532,1229534-1230766,1230768-1231625,1231627-1233414,1233419-1235207,1235209-1237425,1237427,1237429-1237977,1237981,1237985,1237995,1238070,1238073,1239024-1239048,1239050-1239062,1239135,1239256,1239258-1239485,1239785-1240046,1240101,1240106,1240109,1240112 ,1240114,1240116,1240118,1240121,1240329,1240474-1240850,1240857,1241087,1241160,1241408-1241822,1241908-1241909,1241912-1242110,1242371-1292130,1292134-1292458,1292464-1292670,1292672-1292776,1292780-1293392,1293397-1297017,1297019-1297963,1297965-1299820,1300111-1300460,1300520-1300948 +/tomcat/trunk:1156115-1157160,1157162-1157859,1157862-1157942,1157945-1160347,1160349-1163716,1163718-1166689,1166691-1174340,1174342-1175596,1175598-1175611,1175613-1175932,1175934-1177783,1177785-1177980,1178006-1180720,1180722-1183094,1183096-1187753,1187755,1187775,1187801,1187806,1187809,1187826-1188312,1188314-1188401,1188646-1188840,1188842-1190176,1190178-1195223,1195225-1195953,1195955,1195957-1201238,1201240-1203345,1203347-1206623,1206625-1208046,1208073,1208096,1208114,1208145,1208772,1209194-1212125,1212127-1220291,1220293,1220295-1221321,1221323-1222328,1222332-1222401,1222405-1222795,1222850-1222950,1222969-1225326,1225328-1225463,1225465,1225627,1225629-1226534,1226536-1228908,1228911-1228923,1228927-1229532,1229534-1230766,1230768-1231625,1231627-1233414,1233419-1235207,1235209-1237425,1237427,1237429-1237977,1237981,1237985,1237995,1238070,1238073,1239024-1239048,1239050-1239062,1239135,1239256,1239258-1239485,1239785-1240046,1240101,1240106,1240109,1240112 ,1240114,1240116,1240118,1240121,1240329,1240474-1240850,1240857,1241087,1241160,1241408-1241822,1241908-1241909,1241912-1242110,1242371-1292130,1292134-1292458,1292464-1292670,1292672-1292776,1292780-1293392,1293397-1297017,1297019-1297963,1297965-1299820,1300111-1300460,1300520-1300948,1301280 Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1301284r1=1301283r2=1301284view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Mar 15 23:57:00 2012 @@ -100,6 +100,14 @@ work with IBM as well as Oracle JVMs. Patch provided by Rohit Kelapure. (markt) /add +add +Add support for the WebSocket protocol (RFC6455). Both streaming and +message based APIs are provided and the implementation currently fully +passes the Autobahn test suite. Also included are several examples. +A significant contribution to this new functionality
Re: WebSocket status
On 8/03/2012 9:10 PM, Mark Thomas wrote: On 08/03/2012 09:12, Johno Crawford wrote: What's next / left on the TODO list Mark? Anything I can help out with? Porting the generic HTTP upgrade followed by the WebSocket code to 7.0.x. I don't think there is much for you to do there. WebSocket needs some documentation. My plan was to keep it light and point to the examples / Javadoc as much as possible. Performance / scalability with large numbers of users / connections needs looking at. If I am not mistaken there was talk about adding buffered readers, is this still on the table? API tweaks will come as folks start to use to but we need to get it into 7.0.x for that to happen. Look at what needs to be done to align with Jetty's API with a view to possibly moving to a shared common API. There is a WebSocket EG starting up and if that comes up with an API quickly, we may just move to that instead. If there are simple changes we can make now to align with Jetty that will make things easier for users so we should consider them. Costin's point re APR and threading. Maybe a chat example app? After all, everyone else seems to have one ;) At first this felt like double work as there had been some talk and progress regarding a chat example [1] however, I was a little concerned about the security of the implementation (no filtering of html entities), it doesn't line up with the current trunk source and I estimated implementation from scratch to be 30 minutes max. Cheers, Johno [1] https://github.com/praus/tomcat/commit/0bfcb572e79ac05001efe134c2d44ba86daed9c8 - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: WebSocket status
On 2/03/2012 2:29 PM, Filip Hanik - Dev Lists wrote: On 3/2/2012 2:13 AM, Mark Thomas wrote: You can't register on a selector using another thread. Bingo. That explains it. Is that documented anywhere? I'm not sure if the java.nio documentation says it, I think it does. The Selector object is not thread safe. trying to manipulate interestops and selectors from multiple threads, can lead to dead locks According to the docs selectors themselves are safe for use by multiple concurrent threads, their keys however, are not [1]. What's next / left on the TODO list Mark? Anything I can help out with? I'm off for the weekend, address the other stuff next week. Enjoy the weekend! Cheers, Johno [1] http://docs.oracle.com/javase/1.5.0/docs/api/java/nio/channels/Selector.html (Concurrency) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1296172 - in /tomcat/trunk/java/org/apache/coyote: AbstractProtocol.java ajp/AbstractAjpProtocol.java http11/Http11AprProtocol.java http11/Http11NioProtocol.java http11/Http11Protocol
Hi Mark, Quick question regarding web socket socket states, using the BIO connector I have observed the socket state never transitions to UPGRADED.. Is this the expected behaviour? Cheers, Johno On 2/03/2012 1:41 PM, ma...@apache.org wrote: Author: markt Date: Fri Mar 2 12:41:54 2012 New Revision: 1296172 URL: http://svn.apache.org/viewvc?rev=1296172view=rev Log: No need for an upgrade specific poll method. Delete some more code :) Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1296172r1=1296171r2=1296172view=diff == --- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Fri Mar 2 12:41:54 2012 @@ -591,7 +591,7 @@ public abstract class AbstractProtocol i release(socket, processor, false, false); } else if (state == SocketState.UPGRADED) { // Need to keep the connection associated with the processor -upgradePoll(socket, processor); +longPoll(socket, processor); } else { // Connection closed. OK to recycle the processor. if (!(processor instanceof UpgradeProcessor)) { @@ -630,8 +630,6 @@ public abstract class AbstractProtocol i ProcessorS processor); protected abstract void longPoll(SocketWrapperS socket, ProcessorS processor); -protected abstract void upgradePoll(SocketWrapperS socket, -ProcessorS processor); protected abstract void release(SocketWrapperS socket, ProcessorS processor, boolean socketClosing, boolean addToPoller); Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java?rev=1296172r1=1296171r2=1296172view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java Fri Mar 2 12:41:54 2012 @@ -91,12 +91,6 @@ public abstract class AbstractAjpProtoco } @Override -protected void upgradePoll(SocketWrapperS socket, -ProcessorS processor) { -// TODO Should never happen. ISE? -} - -@Override protected P createUpgradeProcessor(SocketWrapperS socket, UpgradeInbound inbound) { // TODO should fail - throw IOE Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1296172r1=1296171r2=1296172view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Fri Mar 2 12:41:54 2012 @@ -293,22 +293,20 @@ public class Http11AprProtocol extends A connections.put(socket.getSocket(), processor); if (processor.isAsync()) { +// Async socket.setAsync(true); } else if (processor.isComet() proto.endpoint.isRunning()) { +// Comet ((AprEndpoint) proto.endpoint).getCometPoller().add( socket.getSocket().longValue(), false); +} else { +// Upgraded +((AprEndpoint) proto.endpoint).getPoller().add( +socket.getSocket().longValue(), false); } } @Override -protected void upgradePoll(SocketWrapperLong socket, -ProcessorLong processor) { -connections.put(socket.getSocket(), processor); -((AprEndpoint) proto.endpoint).getPoller().add( -socket.getSocket().longValue(), false); -} - -@Override protected Http11AprProcessor createProcessor() { Http11AprProcessor processor = new Http11AprProcessor( proto.getMaxHttpHeaderSize(), (AprEndpoint)proto.endpoint, Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java URL:
Re: svn commit: r1296172 - in /tomcat/trunk/java/org/apache/coyote: AbstractProtocol.java ajp/AbstractAjpProtocol.java http11/Http11AprProtocol.java http11/Http11NioProtocol.java http11/Http11Protocol
On 2/03/2012 2:52 PM, Mark Thomas wrote: On 02/03/2012 13:17, Johno Crawford wrote: Hi Mark, Quick question regarding web socket socket states, using the BIO connector I have observed the socket state never transitions to UPGRADED.. Is this the expected behaviour? Short answer: yes. Longer answer: In this case state is the state at a particular point in time rather than state as one might think of in terms of a state machine. Because BIO is blocking rather than exiting the loop in StreamInbound#onData() with a state of UPGRADED it blocks waiting for more data to turn up. It it did exit, all that would happen is that 10s of lines of code latter the thread (more likely a different thread) would end up back in StreamInbound#onData() blocking on a read. The current way of looping is just more efficient. HTH, Mark Helps a lot, thanks. I have updated the open close override patch with where I think makes most sense for the calls to happen. If you feel the need to drop the output argument in onOpen that's fine since one could simply just grab it using getWsOutbound(). Whilst working on my new websockets example, one question regarding the text message implementation came to me. What were the reasons for using CharBuffer instead of plain old String? Cheers, J Cheers, Johno On 2/03/2012 1:41 PM, ma...@apache.org wrote: Author: markt Date: Fri Mar 2 12:41:54 2012 New Revision: 1296172 URL: http://svn.apache.org/viewvc?rev=1296172view=rev Log: No need for an upgrade specific poll method. Delete some more code :) Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1296172r1=1296171r2=1296172view=diff == --- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Fri Mar 2 12:41:54 2012 @@ -591,7 +591,7 @@ public abstract class AbstractProtocol i release(socket, processor, false, false); } else if (state == SocketState.UPGRADED) { // Need to keep the connection associated with the processor -upgradePoll(socket, processor); +longPoll(socket, processor); } else { // Connection closed. OK to recycle the processor. if (!(processor instanceof UpgradeProcessor)) { @@ -630,8 +630,6 @@ public abstract class AbstractProtocol i ProcessorS processor); protected abstract void longPoll(SocketWrapperS socket, ProcessorS processor); -protected abstract void upgradePoll(SocketWrapperS socket, -ProcessorS processor); protected abstract void release(SocketWrapperS socket, ProcessorS processor, boolean socketClosing, boolean addToPoller); Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java?rev=1296172r1=1296171r2=1296172view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java Fri Mar 2 12:41:54 2012 @@ -91,12 +91,6 @@ public abstract class AbstractAjpProtoco } @Override -protected void upgradePoll(SocketWrapperS socket, -ProcessorS processor) { -// TODO Should never happen. ISE? -} - -@Override protected P createUpgradeProcessor(SocketWrapperS socket, UpgradeInbound inbound) { // TODO should fail - throw IOE Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1296172r1=1296171r2=1296172view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Fri Mar 2 12:41:54 2012 @@ -293,22 +293,20 @@ public class Http11AprProtocol extends A connections.put(socket.getSocket(), processor); if (processor.isAsync()) { +// Async
Re: svn commit: r1295978 - in /tomcat/trunk/java/org/apache/coyote/http11: Http11NioProtocol.java upgrade/UpgradeNioProcessor.java
On 2/03/2012 12:05 AM, fha...@apache.org wrote: Author: fhanik Date: Thu Mar 1 23:05:51 2012 New Revision: 1295978 URL: http://svn.apache.org/viewvc?rev=1295978view=rev Log: Fix WebSocket's non blocking call http://tomcat.markmail.org/thread/drj7zgq2csfdnvoh#query:+page:1+mid:y4dheqpm2wx5xzba+state:results Looks like the same usage in org.apache.coyote.http11.Http11NioProtocol.Http11ConnectionHandler#longPoll ? Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1295978r1=1295977r2=1295978view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Thu Mar 1 23:05:51 2012 @@ -296,12 +296,7 @@ public class Http11NioProtocol extends A protected void upgradePoll(SocketWrapperNioChannel socket, ProcessorNioChannel processor) { connections.put(socket.getSocket(), processor); - -SelectionKey key = socket.getSocket().getIOChannel().keyFor( -socket.getSocket().getPoller().getSelector()); -key.interestOps(SelectionKey.OP_READ); -((KeyAttachment) socket).interestOps( -SelectionKey.OP_READ); +socket.getSocket().getPoller().add(socket.getSocket()); } } } Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java?rev=1295978r1=1295977r2=1295978view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java Thu Mar 1 23:05:51 2012 @@ -104,12 +104,10 @@ public class UpgradeNioProcessor extends @Override public int read(boolean block, byte[] bytes, int off, int len) throws IOException { -// TODO Implement non-blocking reads. Should be as simple as replacing -// true with block in the two lines below if (len maxRead) { -return readSocket(true, bytes, off, maxRead); +return readSocket(block, bytes, off, maxRead); } else { -return readSocket(true, bytes, off, len); +return readSocket(block, bytes, off, len); } } - 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