svn commit: r1444684 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java
Author: markt Date: Mon Feb 11 08:59:28 2013 New Revision: 1444684 URL: http://svn.apache.org/r1444684 Log: OutputStream and Writer support Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java?rev=1444684r1=1444683r2=1444684view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java Mon Feb 11 08:59:28 2013 @@ -218,8 +218,8 @@ public abstract class WsRemoteEndpointBa sm.getString(wsRemoteEndpoint.concurrentMessageSend)); } try { -TextMessageSendHandler tmsh = new TextMessageSendHandler( -completion, text, true, encoder, encoderBuffer, this); +TextMessageSendHandler tmsh = new TextMessageSendHandler(completion, +CharBuffer.wrap(text), true, encoder, encoderBuffer, this); tmsh.write(); } finally { writeLock.unlock(); @@ -230,25 +230,27 @@ public abstract class WsRemoteEndpointBa @Override public void sendPartialString(String fragment, boolean isLast) throws IOException { -boolean locked = writeLock.tryLock(); -if (!locked) { -throw new IllegalStateException( -sm.getString(wsRemoteEndpoint.concurrentMessageSend)); -} -try { -FutureToSendHandler f2sh = new FutureToSendHandler(); -TextMessageSendHandler tmsh = new TextMessageSendHandler( -f2sh, fragment, isLast, encoder, encoderBuffer, this); -tmsh.write(); -f2sh.get(); -} catch (InterruptedException | ExecutionException e) { -throw new IOException(e); -} finally { -writeLock.unlock(); -} +sendPartialString(CharBuffer.wrap(fragment), isLast); } +@Override +public OutputStream getSendStream() throws IOException { +return new WsOuputStream(this); +} + + +@Override +public Writer getSendWriter() throws IOException { +return new WsWriter(this); +} + + + + + + + /** * Sends a control message, blocking until the message is sent. @@ -279,6 +281,27 @@ public abstract class WsRemoteEndpointBa } +void sendPartialString(CharBuffer fragment, boolean isLast) +throws IOException { +boolean locked = writeLock.tryLock(); +if (!locked) { +throw new IllegalStateException( +sm.getString(wsRemoteEndpoint.concurrentMessageSend)); +} +try { +FutureToSendHandler f2sh = new FutureToSendHandler(); +TextMessageSendHandler tmsh = new TextMessageSendHandler(f2sh, +fragment, isLast, encoder, encoderBuffer, this); +tmsh.write(); +f2sh.get(); +} catch (InterruptedException | ExecutionException e) { +throw new IOException(e); +} finally { +writeLock.unlock(); +} +} + + private void sendMessage(byte opCode, ByteBuffer payload, boolean last, SendHandler completion) { @@ -337,18 +360,6 @@ public abstract class WsRemoteEndpointBa @Override -public OutputStream getSendStream() throws IOException { -// TODO Auto-generated method stub -return null; -} - -@Override -public Writer getSendWriter() throws IOException { -// TODO Auto-generated method stub -return null; -} - -@Override public void sendObject(Object o) throws IOException, EncodeException { // TODO Auto-generated method stub @@ -513,11 +524,11 @@ public abstract class WsRemoteEndpointBa private final WsRemoteEndpointBase endpoint; private volatile boolean isDone = false; -public TextMessageSendHandler(SendHandler handler, String message, +public TextMessageSendHandler(SendHandler handler, CharBuffer message, boolean isLast, CharsetEncoder encoder, ByteBuffer encoderBuffer, WsRemoteEndpointBase endpoint) { this.handler = handler; -this.message = CharBuffer.wrap(message); +this.message = message; this.isLast = isLast; this.encoder = encoder.reset(); this.buffer = encoderBuffer; @@ -707,4 +718,92 @@ public abstract class WsRemoteEndpointBa return result; } } + + +private static class WsOuputStream extends OutputStream { + +private final WsRemoteEndpointBase endpoint; +private final ByteBuffer buffer = ByteBuffer.allocate(8192); + +
Re: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId()
On 11/02/2013 01:05, Williams, Nick wrote: As some of you know, I've been experimenting with Tomcat trunk (8.0) and the latest specs. I understand, of course, that this is all far from complete. While playing around this weekend, I noticed three things: - Tomcat trunk still has EL 2.2 instead of the new EL 3.0 - javax.servlet.http.HttpSessionIdListener (possibly others, this is just the one I noticed) is missing from servlet-api.jar - HttpServletRequest#changeSessionId() is not yet implemented Is anyone on the list currently working on any of these three things, Not to my knowledge. and if so, do you have any idea when some reasonably-stable iteration of them will be checked in to trunk? EL 3.0 will be a fair amount of work. The ID change stuff is trivial. Mark Of course, I know it's entirely possible that simply nobody has even looked at them yet, and that's understandable this early in the game. Nick This e-mail may contain privileged or confidential information. If you are not the intended recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s); and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s). Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions, corruption or virus in this message or any attachments. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1444684 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java
On 11/02/2013 08:59, ma...@apache.org wrote: Author: markt Date: Mon Feb 11 08:59:28 2013 New Revision: 1444684 URL: http://svn.apache.org/r1444684 Log: OutputStream and Writer support I have a unit test for this but it has highlighted a problem with the current locking approach. I'm working on a new locking implementation. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Tomcat Wiki] Update of FAQ/Linux_Unix by KonstantinKolinko
Dear Wiki user, You have subscribed to a wiki page or wiki category on Tomcat Wiki for change notification. The FAQ/Linux_Unix page has been changed by KonstantinKolinko: http://wiki.apache.org/tomcat/FAQ/Linux_Unix?action=diffrev1=9rev2=10 Comment: Add an answer to the question of using pre-packaged versions of Tomcat. == Preface == == Questions == + 1. [[#Q5|I have Tomcat x.y.z installed as part of my OS. Is it good to use?]] 1. [[#Q1|When I run ps (on Linux), why do I see my java process a bazillion times!]] 1. [[#Q2|How do I run without an X server and still get graphics?]] 1. [[#Q3|Tomcat dies after I log out!]] 1. [[#Q4|Catalina.log contains : SEVERE: StandardServer.await: create[8005] : Throwable occurred: java.net.BindException: The socket name is not available on this system.]] + == Answers == + Anchor(Q5)'''I have Tomcat x.y.z installed as part of my OS. Is it good to use?''' + + Many Linux distributions provide a pre-packaged version of Apache Tomcat. + + These packages work fine and are easy to install for a normal single-instance case, + but they make it more difficult for more specific use cases, + and more difficult for people on the [[FAQ/Tomcat_User|Tomcat User mailing list]] to help you. + That is because each of these packages distributes the files of Tomcat + in different places on the disk, sets different environment variables, + sets different links from one directory to the other in the filesystem, etc.. + So it would be better to install a standard tomcat downloaded from + the website [[http://tomcat.apache.org/]], to some directory like `/opt/tomcat`, + and follow the instructions that are given in the RUNNING.txt file. + + This way, everyone here knows what you are talking about and has a good idea of where things are. + + Several notes: + + * Download a binary version. Either a tar.gz or a zip file is fine. There is usually no need to re-compile Tomcat from the source code. + * The tar.gz files use GNU extensions to the tar file format. You need a GNU-compatible version of `tar` to unpack them. + * Learn how to run Tomcat with separate values of `CATALINA_HOME` and `CATALINA_BASE`, as explained in RUNNING.txt. This will simplify further upgrades and maintenance. + Anchor(Q1)'''When I run ps (on Linux), why do I see my java process a bazillion times!''' Linux implemented threads as processes. Due to other gory details that is beyond the scope of this FAQ - the ps command doesn't work correctly with respect to threads. You can get more gory details [[http://www.onlamp.com/pub/a/onlamp/2002/11/07/linux_threads.html|here]] and [[http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html#D|here]] . - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1444737 - /tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java
Author: jfclere Date: Mon Feb 11 11:03:50 2013 New Revision: 1444737 URL: http://svn.apache.org/r1444737 Log: Make the requestURI string is also reset. Modified: tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java Modified: tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java?rev=1444737r1=1444736r2=1444737view=diff == --- tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java (original) +++ tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java Mon Feb 11 11:03:50 2013 @@ -448,6 +448,7 @@ public class RewriteValve extends ValveB urlString = urlString.substring(0, queryIndex); } // Set the new URL +request.getCoyoteRequest().requestURI().setString(null); CharChunk chunk = request.getCoyoteRequest().requestURI().getCharChunk(); chunk.recycle(); if (context) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat Native 1.1.27
On 08.02.2013 14:43, Mladen Turk wrote: Version 1.1.27 is bug fixing release. The proposed release artefacts can be found at [1], and the build was done using tag [2]. The VOTE will remain open for at least 48 hours. The Apache Tomcat Native 1.1.27 is [X] Stable, go ahead and release [ ] Broken because of ... +1 to release Detailed results (- indicates things which we could improve). Though the list is long, it is again shorter than for the previous release. Overall I'm still +1 for stable, because I didn't find regressions. But there is room for improvement. Please note especially the remark about the KEYS file. + Tested with APR 1.4.6 and OpenSSL 1.0.1c. Java version 1.7.0_13 for pure tcnative ests/examples, Tomcat testsuite taken from TC 7 tested with 1.6.0_39, native part configured against Java 1.5.0_22. + Platforms Solaris 8+10 Sparc, SLES 10, 32 and 64 Bits, SLES 11 64 Bits, RHEL 5+6 64 Bits (no pure tcnative tests on Solaris 8, because no Java 7 available) + MD5 OK + signatures OK - key not in all KEYS files: I found it in /tomcat/native/branches/1.1.x/KEYS and on people.a.o, but it should also be added to http://archive.apache.org/dist/tomcat/tomcat-connectors/KEYS and /tomcat/tomcat-connectors/KEYS on the mirrors. + gz and zip for sources consistent - Except for different permissions: zip seems to also contain group write permissions. Not a real problem, but it's a bit strange that perms differ between the archive (no regression). + source dist consistent with svn tag + config-guess and config.sub up to date. Thanks! + recreated release with jnirelease script, results are consistent with source dist, except for minor expected diffs in CHANGELOG.txt, build-outputs.mk and generated docs (whitespace and attribute ordering) + make succeeds and builds lib (no warnings) + ant test succeeds - all unit tests contained in TC 7 head run successful with APR connector and this version of tcnative. Execptions are due to specifics of the systems used for the tests: - some tribes test on my RHEL 5 system fail. Not a regression, probably some multicast setup issue. - TestMaxConnections: failed only on Solaris 8 for bio and nio, not apr, likely a timing issue on a slow system. - TestMapper: only performance test fails on slow Solaris 8 system - ant part of build (no regressions, cited from 1.1.24 tests): - No mentioning of running ant download before tests. Without it test compilation fails. - ant run-ssl-server: Could't we include a test certificates in the test folder? What should the test produce, if run successfully? - ant run-local-server: Creates a unix socket \\.\PIPE\test in the examples directory, then waits. How is the test expected to work? And the file name doesn't seem to be appropriate for Unix. - run-echo, run-ssl-server and run-local-server: I couldn't figure out, what those were actually supposed to show (what is a positive result vs. a negative one). Last time sebb responded to the announcement mail: - 8 --- Please include a brief synopsis (1 or 2 sentences) of the purpose of the TLP/Product in all announcements sent outside the TLP mailing lists. The developers and users will (presumably) know what the product is about, but others are unlikely to know. S. P.S. Just about every other TLP includes this information, including HTTD... - 8 --- You might want to add such type of info to the announcement for 1.1.27. Regards, Rainer - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat Native 1.1.27
On 02/11/2013 12:26 PM, Rainer Jung wrote: On 08.02.2013 14:43, Mladen Turk wrote: - key not in all KEYS files: I found it in /tomcat/native/branches/1.1.x/KEYS and on people.a.o, but it should also be added to http://archive.apache.org/dist/tomcat/tomcat-connectors/KEYS and /tomcat/tomcat-connectors/KEYS on the mirrors. Yeah, I was planning to update those together with this release since it'll synced at once. - ant part of build (no regressions, cited from 1.1.24 tests): - No mentioning of running ant download before tests. Without it test compilation fails. - ant run-ssl-server: Could't we include a test certificates in the test folder? What should the test produce, if run successfully? - ant run-local-server: Creates a unix socket \\.\PIPE\test in the examples directory, then waits. How is the test expected to work? And the file name doesn't seem to be appropriate for Unix. - run-echo, run-ssl-server and run-local-server: I couldn't figure out, what those were actually supposed to show (what is a positive result vs. a negative one). IMO we should axe all those tests (or have one or two that actually work) There we made merely for development purposes and since then API and usage diverged. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1444762 - in /tomcat/trunk/java/org/apache/catalina/storeconfig: IStoreConfig.java StoreConfig.java WebResourceRootSF.java
Author: markt Date: Mon Feb 11 13:33:37 2013 New Revision: 1444762 URL: http://svn.apache.org/r1444762 Log: Fix a handful of Javadoc warnings Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/IStoreConfig.java tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfig.java tomcat/trunk/java/org/apache/catalina/storeconfig/WebResourceRootSF.java Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/IStoreConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/IStoreConfig.java?rev=1444762r1=1444761r2=1444762view=diff == --- tomcat/trunk/java/org/apache/catalina/storeconfig/IStoreConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/storeconfig/IStoreConfig.java Mon Feb 11 13:33:37 2013 @@ -83,9 +83,6 @@ public interface IStoreConfig { *Number of spaces to indent this element * @param aServer *Object to be stored - * - * @exception Exception - *if an exception occurs while storing */ void store(PrintWriter aWriter, int indent, Server aServer); @@ -98,9 +95,6 @@ public interface IStoreConfig { *Number of spaces to indent this element * @param aService *Object to be stored - * - * @exception Exception - *if an exception occurs while storing */ void store(PrintWriter aWriter, int indent, Service aService); @@ -113,9 +107,6 @@ public interface IStoreConfig { *Number of spaces to indent this element * @param aHost *Object to be stored - * - * @exception Exception - *if an exception occurs while storing */ void store(PrintWriter aWriter, int indent, Host aHost); @@ -124,9 +115,6 @@ public interface IStoreConfig { * * @param aContext *Object to be stored - * - * @exception Exception - *if an exception occurs while storing */ void store(Context aContext); @@ -139,9 +127,6 @@ public interface IStoreConfig { *Number of spaces to indent this element * @param aContext *Object to be stored - * - * @exception Exception - *if an exception occurs while storing */ void store(PrintWriter aWriter, int indent, Context aContext); } \ No newline at end of file Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfig.java?rev=1444762r1=1444761r2=1444762view=diff == --- tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfig.java Mon Feb 11 13:33:37 2013 @@ -95,9 +95,7 @@ public class StoreConfig implements ISto } /** - * Store current Server - * - * @see org.apache.catalina.ServerFactory#getServer() + * Store current Server. */ @Override public synchronized void storeConfig() { Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/WebResourceRootSF.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/WebResourceRootSF.java?rev=1444762r1=1444761r2=1444762view=diff == --- tomcat/trunk/java/org/apache/catalina/storeconfig/WebResourceRootSF.java (original) +++ tomcat/trunk/java/org/apache/catalina/storeconfig/WebResourceRootSF.java Mon Feb 11 13:33:37 2013 @@ -34,8 +34,6 @@ public class WebResourceRootSF extends S *PrintWriter to which we are storing * @param indent *Number of spaces to indent this element - * @param aCluster - *Cluster whose properties are being stored * * @exception Exception *if an exception occurs while storing - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1444768 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties WsRemoteEndpointBase.java WsSession.java
Author: markt Date: Mon Feb 11 14:03:35 2013 New Revision: 1444768 URL: http://svn.apache.org/r1444768 Log: Implement new approach to locking Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java?rev=1444768r1=1444767r2=1444768view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java Mon Feb 11 14:03:35 2013 @@ -31,6 +31,11 @@ public class Constants { public static final byte OPCODE_PING = 0x09; public static final byte OPCODE_PONG = 0x0A; +// Internal OP Codes +// RFC 6455 limits OP Codes to 4 bits so these should never clash +// Always set bit 4 so these will be treated as control codes +static final byte INTERNAL_OPCODE_FLUSH = 0x18; + // Client connection public static final String HOST_HEADER_NAME = Host; public static final String UPGRADE_HEADER_NAME = Upgrade; 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=1444768r1=1444767r2=1444768view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Mon Feb 11 14:03:35 2013 @@ -13,10 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -messageSendStateMachine.changeType=When sending a fragmented message, all fragments bust be of the same type -messageSendStateMachine.closed=Message will not be sent because the WebSocket session has been closed -messageSendStateMachine.inProgress=Message will not be sent because the WebSocket session is currently sending another message - # 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. # Messages are encoded using UTF-8 where a single character may be encoded in @@ -35,7 +31,10 @@ wsFrame.oneByteCloseCode=The client sent wsFrame.textMessageTooBig=The decoded text message was too big for the output buffer and the endpoint does not support partial messages wsFrame.wrongRsv=The client frame set the reserved bits to [{0}] which was not supported by this endpoint +wsRemoteEndpoint.closed=Message will not be sent because the WebSocket session has been closed +wsRemoteEndpoint.changeType=When sending a fragmented message, all fragments bust be of the same type wsRemoteEndpoint.concurrentMessageSend=Messages may not be sent concurrently even when using the asynchronous send messages. The client must wait for the previous message to complete before sending the next. +wsRemoteEndpoint.inProgress=Message will not be sent because the WebSocket session is currently sending another message wsSession.duplicateHandlerBinary=A binary message handler has already been configured wsSession.duplicateHandlerPong=A pong message handler has already been configured Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java?rev=1444768r1=1444767r2=1444768view=diff == --- tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java Mon Feb 11 14:03:35 2013 @@ -24,14 +24,14 @@ import java.nio.CharBuffer; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; +import java.util.ArrayDeque; +import java.util.Queue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.ReentrantLock; import javax.websocket.EncodeException; import javax.websocket.RemoteEndpoint; @@ -45,10 +45,18 @@ public abstract class WsRemoteEndpointBa private static final StringManager sm = StringManager.getManager(Constants.PACKAGE_NAME); -private final ReentrantLock writeLock = new
svn commit: r1444769 - in /tomcat/trunk/test/org/apache/tomcat/websocket: TestWsRemoteEndpoint.java TesterSingleMessageClient.java
Author: markt Date: Mon Feb 11 14:03:53 2013 New Revision: 1444769 URL: http://svn.apache.org/r1444769 Log: Add Writer test Added: tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java (with props) Modified: tomcat/trunk/test/org/apache/tomcat/websocket/TesterSingleMessageClient.java Added: tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java?rev=1444769view=auto == --- tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java (added) +++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java Mon Feb 11 14:03:53 2013 @@ -0,0 +1,110 @@ +/* + * 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 java.io.Writer; +import java.net.URI; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import javax.websocket.ContainerProvider; +import javax.websocket.DefaultClientConfiguration; +import javax.websocket.Session; +import javax.websocket.WebSocketContainer; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.Context; +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.websocket.TesterSingleMessageClient.AsyncHandler; +import org.apache.tomcat.websocket.TesterSingleMessageClient.AsyncText; +import org.apache.tomcat.websocket.TesterSingleMessageClient.TesterEndpoint; + +public class TestWsRemoteEndpoint extends TomcatBaseTest { + +private static final String SEQUENCE = ABCDE; +private static final int S_LEN = SEQUENCE.length(); +private static final String TEST_MESSAGE_5K; + +static { +StringBuilder sb = new StringBuilder(S_LEN * 1024); +for (int i = 0; i 1024; i++) { +sb.append(SEQUENCE); +} +TEST_MESSAGE_5K = sb.toString(); +} + +@Test +public void testWriter() throws Exception { +Tomcat tomcat = getTomcatInstance(); +// Must have a real docBase - just use temp +Context ctx = +tomcat.addContext(, System.getProperty(java.io.tmpdir)); +ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); + +WebSocketContainer wsContainer = +ContainerProvider.createClientContainer(); + +tomcat.start(); + +Session wsSession = wsContainer.connectToServer(TesterEndpoint.class, +new DefaultClientConfiguration(), new URI(http://localhost:; + +getPort() + TesterEchoServer.Config.PATH_ASYNC)); + +CountDownLatch latch = new CountDownLatch(1); +wsSession.getUserProperties().put(latch, latch); +AsyncHandler? handler = new AsyncText(latch); + +wsSession.addMessageHandler(handler); + +Writer w = wsSession.getRemote().getSendWriter(); + +for (int i = 0; i 8; i++) { +w.write(TEST_MESSAGE_5K); +} + +w.close(); + +boolean latchResult = handler.getLatch().await(10, TimeUnit.SECONDS); + +Assert.assertTrue(latchResult); + +ListString messages = (ListString) handler.getMessages(); + +int offset = 0; +int i = 0; +for (String message : messages) { +// First may be a fragment +Assert.assertEquals(SEQUENCE.substring(offset, S_LEN), +message.substring(0, S_LEN - offset)); +i = S_LEN - offset; +while (i + S_LEN message.length()) { +if (!SEQUENCE.equals(message.substring(i, i + S_LEN))) { +Assert.fail(); +} +i += S_LEN; +} +offset = message.length() - i; +if (!SEQUENCE.substring(0, offset).equals(message.substring(i))) { +Assert.fail(); +} +} +} +} Propchange: tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java --
svn commit: r1444808 - in /tomcat/trunk: java/javax/websocket/ java/org/apache/tomcat/websocket/ java/org/apache/tomcat/websocket/server/ test/org/apache/tomcat/websocket/
Author: markt Date: Mon Feb 11 14:57:27 2013 New Revision: 1444808 URL: http://svn.apache.org/r1444808 Log: Update to draft v12 of WebSocket API Align current implementation with draft Modified: tomcat/trunk/java/javax/websocket/CloseReason.java tomcat/trunk/java/javax/websocket/ContainerProvider.java tomcat/trunk/java/javax/websocket/DefaultClientConfiguration.java tomcat/trunk/java/javax/websocket/RemoteEndpoint.java tomcat/trunk/java/javax/websocket/Session.java tomcat/trunk/java/javax/websocket/WebSocketContainer.java tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java tomcat/trunk/java/org/apache/tomcat/websocket/server/ServerContainerImpl.java tomcat/trunk/java/org/apache/tomcat/websocket/server/WsProtocolHandler.java tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java Modified: tomcat/trunk/java/javax/websocket/CloseReason.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/CloseReason.java?rev=1444808r1=1444807r2=1444808view=diff == --- tomcat/trunk/java/javax/websocket/CloseReason.java (original) +++ tomcat/trunk/java/javax/websocket/CloseReason.java Mon Feb 11 14:57:27 2013 @@ -34,6 +34,12 @@ public class CloseReason { return reasonPhrase; } +@Override +public String toString() { +return CloseReason: code [ + closeCode.getCode() + +], reason [ + reasonPhrase + ]; +} + public interface CloseCode { int getCode(); } @@ -62,6 +68,52 @@ public class CloseReason { this.code = code; } +public static CloseCode getCloseCode(final int code) { +if (code 2999 code 5000) { +return new CloseCode() { +@Override +public int getCode() { +return code; +} +}; +} +switch (code) { +case 1000: +return CloseCodes.NORMAL_CLOSURE; +case 1001: +return CloseCodes.GOING_AWAY; +case 1002: +return CloseCodes.PROTOCOL_ERROR; +case 1003: +return CloseCodes.CANNOT_ACCEPT; +case 1004: +return CloseCodes.RESERVED; +case 1005: +return CloseCodes.NO_STATUS_CODE; +case 1006: +return CloseCodes.CLOSED_ABNORMALLY; +case 1007: +return CloseCodes.NOT_CONSISTENT; +case 1008: +return CloseCodes.VIOLATED_POLICY; +case 1009: +return CloseCodes.TOO_BIG; +case 1010: +return CloseCodes.NO_EXTENSION; +case 1011: +return CloseCodes.UNEXPECTED_CONDITION; +case 1012: +return CloseCodes.SERVICE_RESTART; +case 1013: +return CloseCodes.TRY_AGAIN_LATER; +case 1015: +return CloseCodes.TLS_HANDSHAKE_FAILURE; +default: +throw new IllegalArgumentException( +Invalid close code: [ + code + ]); +} +} + @Override public int getCode() { return code; Modified: tomcat/trunk/java/javax/websocket/ContainerProvider.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/ContainerProvider.java?rev=1444808r1=1444807r2=1444808view=diff == --- tomcat/trunk/java/javax/websocket/ContainerProvider.java (original) +++ tomcat/trunk/java/javax/websocket/ContainerProvider.java Mon Feb 11 14:57:27 2013 @@ -20,7 +20,7 @@ package javax.websocket; * Provides access to the implementation. This version of the API is hard-coded * to use the Apache Tomcat WebSocket implementation. */ -public class ContainerProvider { +public abstract class ContainerProvider { private static final String DEFAULT_PROVIDER_CLASS_NAME = org.apache.tomcat.websocket.WsWebSocketContainer; @@ -40,7 +40,7 @@ public class ContainerProvider { * Create a new ClientContainer used to create outgoing WebSocket * connections. */ -public static WebSocketContainer createClientContainer() { +public static WebSocketContainer getWebSocketContainer() { WebSocketContainer result = null; try { result = clazz.newInstance(); Modified:
RE: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId()
On 11/02/2013 01:05, Williams, Nick wrote: As some of you know, I've been experimenting with Tomcat trunk (8.0) and the latest specs. I understand, of course, that this is all far from complete. While playing around this weekend, I noticed three things: - Tomcat trunk still has EL 2.2 instead of the new EL 3.0 - javax.servlet.http.HttpSessionIdListener (possibly others, this is just the one I noticed) is missing from servlet-api.jar - HttpServletRequest#changeSessionId() is not yet implemented Is anyone on the list currently working on any of these three things, Not to my knowledge. and if so, do you have any idea when some reasonably-stable iteration of them will be checked in to trunk? EL 3.0 will be a fair amount of work. The ID change stuff is trivial. Yea. I read the EL 3.0 specification last night. The lambda expressions and LINQ support are pretty cool, but I can definitely see how that's going to be a LOT of work... Agreed that the ID change stuff is trivial. I was thinking about writing the change myself and submitting it to the list. I looked through the Get Involved section of the website and found info about submitting patches, code formatting, tools to use, etc. However, there's not a whole lot of info on working on the next specification. If someone has the time to indulge me, I had a couple questions, like: 1) Where do y'all get the javax.* code that's in your repository? Do you write it from scratch based on the spec, or do you download it from somewhere? It's obviously not consistent with the classes in the javax.servlet:javax.servlet-api:3.1-b05 Maven artifact, but I don't know what's involved in updating that. 2) Where do y'all get the XSD files in http://svn.apache.org/repos/asf/tomcat/trunk/java/javax/servlet/resources/ and what's involved in adding new ones / updating? I noticed the Servlet 3.1 XSDs have not been added yet (which was surprising to me, since the deployment descriptor in my web app using web-app_3_1.xsd works). Don't know if just nobody has gotten around to it yet, or if there's a specific reason they're not there yet (Do you always wait until the spec is final? Do you put beta XSDs in there during development and update when the spec goes final?). There are 3.1 XSDs at http://java.net/nonav/projects/glassfish/sources/svn/show/trunk/main/appserver/deployment/schemas/src/main/resources/glassfish/lib/schemas, but that's just a guess. Nick Mark This e-mail may contain privileged or confidential information. If you are not the intended recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s); and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s). Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions, corruption or virus in this message or any attachments. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId()
On 11/02/2013 16:00, Williams, Nick wrote: 1) Where do y'all get the javax.* code that's in your repository? The sources have varied over time (at one point Tomcat was the reference implementation). These days it is essentially a manual process to create them from the spec. For WebSocket I automate it a little by using javap on the spec repository and on Tomcat and then fixing the diffs to the public API by hand. 2) Where do y'all get the XSD files in http://svn.apache.org/repos/asf/tomcat/trunk/java/javax/servlet/resources/ Again, sources have varied over time. They aren't required unless XML validation is enabled so we tend to add them once the spec is final. We add the CDDL licensed versions and make sure the LICENCE and NOTICE file are updated as necessary. Take a look at the svn history for the Servlet 3.0 files. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
RE: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId()
-Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Monday, February 11, 2013 10:46 AM To: Tomcat Developers List Subject: Re: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId() 1) Where do y'all get the javax.* code that's in your repository? The sources have varied over time (at one point Tomcat was the reference implementation). These days it is essentially a manual process to create them from the spec. Fascinating. Years ago I used to think the spec included a bunch of already-compiled interfaces and you just copied the spec jar to your implementation and then implemented the spec. I got the idea a while ago that it wasn't quite that simple, but I had no idea y'all literally just wrote the javax.* interfaces and classes from scratch based on the spec. For WebSocket I automate it a little by using javap on the spec repository and on Tomcat and then fixing the diffs to the public API by hand. Is the spec repository public? I looked around a bit and I found some jars (or is that what you meant, since you're using javap?), but no repository. Take a look at the svn history for the Servlet 3.0 files. I just did. That was very helpful, thanks. Nick This e-mail may contain privileged or confidential information. If you are not the intended recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s); and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s). Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions, corruption or virus in this message or any attachments. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Question about bug 51526
Hi, I would like to work on this enhancement request [1]. What do you think? Is it Ok to provide implementation for it in Tomcat 7? Thanks Violeta [1] https://issues.apache.org/bugzilla/show_bug.cgi?id=51526 - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
RE: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId()
-Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Monday, February 11, 2013 10:46 AM To: Tomcat Developers List Subject: Re: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId() For WebSocket I automate it a little by using javap on the spec repository and on Tomcat and then fixing the diffs to the public API by hand. Here's what I did. Tell me if this sounds about right. I may be way off base here. I compiled Tomcat trunk from latest and copied servlet-api.jar and javax.servlet-api-3.1-b05.jar (from Maven, updated January 10) into the same directory. I ran the following commands, which gave me an index of sorts of the classes in the JAR files. jar -tf servlet-api.jar | grep class | sed 's/.class//g' servlet-api.jar.index jar -tf javax.servlet-api-3.1-b05.jar | grep class | sed 's/.class//g' javax.servlet-api-3.1-b05.jar.index I then re-ordered the files in one of the index files so that they were in the same order (the one compiled on my system had sub-directories before files, the other one didn't, so that would throw off a compare). I then ran javap against both JAR files: javap -classpath servlet-api.jar -s $(cat servlet-api.jar.index) servlet-api.jar.contents javap -classpath javax.servlet-api-3.1-b05.jar -s $(cat javax.servlet-api-3.1-b05.jar.index) javax.servlet-api-3.1-b05.jar.contents I then compared servlet-api.jar.contents and javax.servlet-api-3.1-b05.jar.contents (I used FileMerge) and came up with this: javax.servlet.http.HttpServletRequest: changeSessionId() missing in Tomcat javax.servlet.http.HttpServletRequest: public abstract void upgrade(javax.servlet.http.ProtocolHandler) throws IOException in Tomcat should be: public abstract T extends javax.servlet.http.HttpUpgradeHandler T upgrade(java.lang.ClassT) throws IOException javax.servlet.http.HttpServletRequestWrapper: changeSessionId() missing javax.servlet.http.HttpServletRequestWrapper: public void upgrade(javax.servlet.http.ProtocolHandler) throws IOException in Tomcat should be: public T extends javax.servlet.http.HttpUpgradeHandler T upgrade(java.lang.ClassT) throws IOException javax.servlet.http.HttpSessionIdListener: missing in Tomcat javax.servlet.http.HttpUpgradeHandler: missing in Tomcat javax.servlet.http.NoBodyOutputStream: public boolean canWrite() in Tomcat should be: public boolean isReady() javax.servlet.http.NoBodyResponse: overridden method setContentLengthLong(long) in Tomcat is not overridden in spec javax.servlet.http.NoBodyResponse: overridden method setHeader(String, String) in Tomcat is not overridden in spec javax.servlet.http.NoBodyResponse: overridden method addheader(String, String) in Tomcat is not overridden in spec javax.servlet.http.NoBodyResponse: overridden method setIntHeader(String, int) in Tomcat is not overridden in spec javax.servlet.http.NoBodyResponse: overridden method addIntHeader(String, int) in Tomcat is not overridden in spec javax.servlet.http.NoBodyResponse: static initializer in spec not present in Tomcat (is this even a problem?) javax.servlet.http.ProtocolHandler: superfluous Tomcat class does not exist in specification javax.servlet.http.WebConnection: should extend java.lang.AutoCloseable, does not in Tomcat javax.servlet.GenericServlet: static initializer in spec not present in Tomcat (is this even a problem?) javax.servlet.HttpConstraintElement: static initializer in Tomcat not present in spec (is this even a problem?) javax.servlet.HttpMethodConstraintElement: static initializer in Tomcat not present in spec (is this even a problem?) javax.servlet.ServletOutputStream: public boolean canWrite() in Tomcat should be: public boolean isReady() A lot of that is WebSocket related, methinks (upgrade, upgrade handler, no body response, protocol handler), so those are yours, and I don't think the static initializers matter (though I could be wrong). The rest of it (change session ID, session ID change listener, WebConnection needing to extend AutoCloseable, and the two canWrites needing to be isReady) seem like some pretty simple things that I could knock out in one evening, assuming my contributions wouldn't be stepping on anyone's toes. Before I actually do any work on anything I'd love some feedback on my analysis. Nick This e-mail may contain privileged or confidential information. If you are not the intended recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s); and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s). Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions, corruption or virus in this message or any attachments. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId()
On 11/02/2013 18:22, Williams, Nick wrote: -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Monday, February 11, 2013 10:46 AM To: Tomcat Developers List Subject: Re: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId() 1) Where do y'all get the javax.* code that's in your repository? The sources have varied over time (at one point Tomcat was the reference implementation). These days it is essentially a manual process to create them from the spec. Fascinating. Years ago I used to think the spec included a bunch of already-compiled interfaces and you just copied the spec jar to your implementation and then implemented the spec. I got the idea a while ago that it wasn't quite that simple, but I had no idea y'all literally just wrote the javax.* interfaces and classes from scratch based on the spec. We have to so we have an ALv2 licensed version of the API. For WebSocket I automate it a little by using javap on the spec repository and on Tomcat and then fixing the diffs to the public API by hand. Is the spec repository public? I looked around a bit and I found some jars (or is that what you meant, since you're using javap?), but no repository. http://java.net/projects/servlet-spec/ You'll almost certainly need to register to access it but it should be readable once you do. Mark Take a look at the svn history for the Servlet 3.0 files. I just did. That was very helpful, thanks. Nick This e-mail may contain privileged or confidential information. If you are not the intended recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s); and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s). Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions, corruption or virus in this message or any attachments. - 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
svn commit: r1444946 - in /tomcat/trunk: java/javax/servlet/http/ java/org/apache/catalina/connector/ java/org/apache/catalina/websocket/ java/org/apache/coyote/ java/org/apache/coyote/ajp/ java/org/a
Author: markt Date: Mon Feb 11 20:24:03 2013 New Revision: 1444946 URL: http://svn.apache.org/r1444946 Log: Rename ProtocolHandler to HttpUpgradeHandler Added: tomcat/trunk/java/javax/servlet/http/HttpUpgradeHandler.java - copied, changed from r1444731, tomcat/trunk/java/javax/servlet/http/ProtocolHandler.java Removed: tomcat/trunk/java/javax/servlet/http/ProtocolHandler.java Modified: tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java tomcat/trunk/java/javax/servlet/http/WebConnection.java tomcat/trunk/java/org/apache/catalina/connector/Request.java tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java tomcat/trunk/java/org/apache/catalina/websocket/StreamHandler.java tomcat/trunk/java/org/apache/catalina/websocket/WebSocketServlet.java tomcat/trunk/java/org/apache/catalina/websocket/WsHttpServletRequestWrapper.java tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java tomcat/trunk/java/org/apache/coyote/Processor.java tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.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 tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractProcessor.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprProcessor.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/BioProcessor.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/NioProcessor.java tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java tomcat/trunk/java/org/apache/tomcat/websocket/server/WsProtocolHandler.java tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServlet.java tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java Modified: tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java?rev=1444946r1=1444945r2=1444946view=diff == --- tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java (original) +++ tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java Mon Feb 11 20:24:03 2013 @@ -501,5 +501,5 @@ public interface HttpServletRequest exte * * @since Servlet 3.1 */ -public void upgrade(ProtocolHandler handler) throws java.io.IOException; +public void upgrade(HttpUpgradeHandler handler) throws java.io.IOException; } Modified: tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java?rev=1444946r1=1444945r2=1444946view=diff == --- tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java (original) +++ tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java Mon Feb 11 20:24:03 2013 @@ -355,13 +355,13 @@ public class HttpServletRequestWrapper e * {@inheritDoc} * p * The default behavior of this method is to return - * {@link HttpServletRequest#upgrade(ProtocolHandler)} + * {@link HttpServletRequest#upgrade(HttpUpgradeHandler)} * on the wrapped request object. * * @since Servlet 3.1 */ @Override -public void upgrade(ProtocolHandler handler) throws java.io.IOException { +public void upgrade(HttpUpgradeHandler handler) throws java.io.IOException { this._getHttpServletRequest().upgrade(handler); } } Copied: tomcat/trunk/java/javax/servlet/http/HttpUpgradeHandler.java (from r1444731, tomcat/trunk/java/javax/servlet/http/ProtocolHandler.java) URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpUpgradeHandler.java?p2=tomcat/trunk/java/javax/servlet/http/HttpUpgradeHandler.javap1=tomcat/trunk/java/javax/servlet/http/ProtocolHandler.javar1=1444731r2=1444946rev=1444946view=diff == --- tomcat/trunk/java/javax/servlet/http/ProtocolHandler.java (original) +++ tomcat/trunk/java/javax/servlet/http/HttpUpgradeHandler.java Mon Feb 11 20:24:03 2013 @@ -21,13 +21,13 @@ package javax.servlet.http; * * @since Servlet 3.1 */ -public interface ProtocolHandler { +public interface HttpUpgradeHandler { /** * This method is called once the request/response pair where - * {@link HttpServletRequest#upgrade(ProtocolHandler)} is called has + * {@link HttpServletRequest#upgrade(HttpUpgradeHandler)} is called has
svn commit: r1444951 - in /tomcat/trunk: java/javax/servlet/ java/javax/servlet/http/ java/org/apache/catalina/connector/ java/org/apache/catalina/filters/ java/org/apache/catalina/ssi/ java/org/apach
Author: markt Date: Mon Feb 11 20:28:56 2013 New Revision: 1444951 URL: http://svn.apache.org/r1444951 Log: Rename canWrite() - isReady() Modified: tomcat/trunk/java/javax/servlet/ServletOutputStream.java tomcat/trunk/java/javax/servlet/http/HttpServlet.java tomcat/trunk/java/org/apache/catalina/connector/CoyoteOutputStream.java tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java tomcat/trunk/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/Util.java tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointServer.java tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java tomcat/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java Modified: tomcat/trunk/java/javax/servlet/ServletOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletOutputStream.java?rev=1444951r1=1444950r2=1444951view=diff == --- tomcat/trunk/java/javax/servlet/ServletOutputStream.java (original) +++ tomcat/trunk/java/javax/servlet/ServletOutputStream.java Mon Feb 11 20:28:56 2013 @@ -278,7 +278,7 @@ public abstract class ServletOutputStrea * TODO SERVLET 3.1 * @return TODO */ -public abstract boolean canWrite(); +public abstract boolean isReady(); /** * TODO SERVLET 3.1 Modified: tomcat/trunk/java/javax/servlet/http/HttpServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpServlet.java?rev=1444951r1=1444950r2=1444951view=diff == --- tomcat/trunk/java/javax/servlet/http/HttpServlet.java (original) +++ tomcat/trunk/java/javax/servlet/http/HttpServlet.java Mon Feb 11 20:28:56 2013 @@ -868,7 +868,7 @@ class NoBodyOutputStream extends Servlet } @Override -public boolean canWrite() { +public boolean isReady() { // TODO SERVLET 3.1 return false; } Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteOutputStream.java?rev=1444951r1=1444950r2=1444951view=diff == --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteOutputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteOutputStream.java Mon Feb 11 20:28:56 2013 @@ -110,7 +110,7 @@ public class CoyoteOutputStream } @Override -public boolean canWrite() { +public boolean isReady() { return ob.canWrite(); } Modified: tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java?rev=1444951r1=1444950r2=1444951view=diff == --- tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java (original) +++ tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java Mon Feb 11 20:28:56 2013 @@ -997,7 +997,7 @@ public class ExpiresFilter extends Filte * TODO SERVLET 3.1 */ @Override -public boolean canWrite() { +public boolean isReady() { // TODO Auto-generated method stub return false; } Modified: tomcat/trunk/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java?rev=1444951r1=1444950r2=1444951view=diff == --- tomcat/trunk/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java Mon Feb 11 20:28:56 2013 @@ -68,7 +68,7 @@ public class ByteArrayServletOutputStrea * TODO SERVLET 3.1 */ @Override -public boolean canWrite() { +public boolean isReady() { // TODO Auto-generated method stub return false; } Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java?rev=1444951r1=1444950r2=1444951view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java (original) +++
Re: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId()
On 11/02/2013 19:38, Williams, Nick wrote: -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Monday, February 11, 2013 10:46 AM To: Tomcat Developers List Subject: Re: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId() For WebSocket I automate it a little by using javap on the spec repository and on Tomcat and then fixing the diffs to the public API by hand. Here's what I did. Tell me if this sounds about right. I may be way off base here. Looks OK to me. snip/ I then compared servlet-api.jar.contents and javax.servlet-api-3.1-b05.jar.contents (I used FileMerge) and came up with this: javax.servlet.http.HttpServletRequest: changeSessionId() missing in Tomcat Yep. javax.servlet.http.HttpServletRequest: public abstract void upgrade(javax.servlet.http.ProtocolHandler) throws IOException in Tomcat should be: public abstract T extends javax.servlet.http.HttpUpgradeHandler T upgrade(java.lang.ClassT) throws IOException I argued for (and got) a name change from ProtocolHandler to HttpUpgradeHandler that hasn't been implemented yet. Name changes are usually easier for committers to handle though the IDE since the effort is minimal but the diff can be big and reviewing a large diff is a pain. I've just implemented this. I haven't done anything about the method signature change. javax.servlet.http.HttpServletRequestWrapper: changeSessionId() missing Yep. Missing feature. javax.servlet.http.HttpServletRequestWrapper: public void upgrade(javax.servlet.http.ProtocolHandler) throws IOException in Tomcat should be: public T extends javax.servlet.http.HttpUpgradeHandler T upgrade(java.lang.ClassT) throws IOException javax.servlet.http.HttpSessionIdListener: missing in Tomcat javax.servlet.http.HttpUpgradeHandler: missing in Tomcat Missing features. javax.servlet.http.NoBodyOutputStream: public boolean canWrite() in Tomcat should be: public boolean isReady() Another naming change that I hadn't caught up with. Done. javax.servlet.http.NoBodyResponse: overridden method setContentLengthLong(long) in Tomcat is not overridden in spec javax.servlet.http.NoBodyResponse: overridden method setHeader(String, String) in Tomcat is not overridden in spec javax.servlet.http.NoBodyResponse: overridden method addheader(String, String) in Tomcat is not overridden in spec javax.servlet.http.NoBodyResponse: overridden method setIntHeader(String, int) in Tomcat is not overridden in spec javax.servlet.http.NoBodyResponse: overridden method addIntHeader(String, int) in Tomcat is not overridden in spec Not an issue. javax.servlet.http.NoBodyResponse: static initializer in spec not present in Tomcat (is this even a problem?) This sort of thing is not an issue. It is only public and protected API we need to worry about. javax.servlet.http.ProtocolHandler: superfluous Tomcat class does not exist in specification See above. javax.servlet.http.WebConnection: should extend java.lang.AutoCloseable, does not in Tomcat Missing feature. javax.servlet.GenericServlet: static initializer in spec not present in Tomcat (is this even a problem?) javax.servlet.HttpConstraintElement: static initializer in Tomcat not present in spec (is this even a problem?) javax.servlet.HttpMethodConstraintElement: static initializer in Tomcat not present in spec (is this even a problem?) See above. javax.servlet.ServletOutputStream: public boolean canWrite() in Tomcat should be: public boolean isReady() Rename. See above. Fixed. A lot of that is WebSocket related, methinks (upgrade, upgrade handler, no body response, protocol handler), so those are yours, and I don't think the static initializers matter (though I could be wrong). The rest of it (change session ID, session ID change listener, WebConnection needing to extend AutoCloseable, and the two canWrites needing to be isReady) seem like some pretty simple things that I could knock out in one evening, assuming my contributions wouldn't be stepping on anyone's toes. Nope. This is all Servlet 3.1 stuff. Before I actually do any work on anything I'd love some feedback on my analysis. See above. The biggest part of the work in Servlet 3.1 is the non-blocking IO support. Filip wrote an implementation for NIO only. The other two connectors are not implemented. Further, after using the non-blocking IO for WebSockets I think there is a issue in that the underlying assumption that there is only ever one thread accessing a socket is not correct. Removing that limitation in the main connector code is going to be non-trivial. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Question about bug 51526
On 11/02/2013 18:23, Violeta Georgieva wrote: Hi, I would like to work on this enhancement request [1]. What do you think? Is it Ok to provide implementation for it in Tomcat 7? For addWebapp, processing META-INF/context.xml seems reasonable to me. I don't have an issue with that feature being back-ported from trunk to 7.0.x. Other committers may disagree. Mark Thanks Violeta [1] https://issues.apache.org/bugzilla/show_bug.cgi?id=51526 - 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: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId()
(I'm replying to both your emails here. Forgive me.) -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Monday, February 11, 2013 2:38 PM To: Tomcat Developers List Subject: Re: EL 3.0, HttpSessionIdListener, HttpServletRequest#changeSessionId() Fascinating. Years ago I used to think the spec included a bunch of already-compiled interfaces and you just copied the spec jar to your implementation and then implemented the spec. I got the idea a while ago that it wasn't quite that simple, but I had no idea y'all literally just wrote the javax.* interfaces and classes from scratch based on the spec. We have to so we have an ALv2 licensed version of the API. Makes sense. Is the spec repository public? I looked around a bit and I found some jars (or is that what you meant, since you're using javap?), but no repository. http://java.net/projects/servlet-spec/ You'll almost certainly need to register to access it but it should be readable once you do. Low and behold, I was already registered and didn't know it. Unfortunately, You are not allowed to do that (read scm). I argued for (and got) a name change from ProtocolHandler to HttpUpgradeHandler that hasn't been implemented yet. Name changes are usually easier for committers to handle though the IDE since the effort is minimal but the diff can be big and reviewing a large diff is a pain. I've just implemented this. I noticed. Five minutes after I did all of my analysis there was this HUGE check-in by someone named Mark T that invalidated it all. :-P I haven't done anything about the method signature change. Yea, I figure that requires some more work yet. By the way, the HttpUpgradeHandler you checked in is missing the public abstract void destroy() method, but I'm sure you probably already knew that. javax.servlet.http.HttpServletRequestWrapper: changeSessionId() missing Yep. Missing feature. I'll work on this one. javax.servlet.http.HttpSessionIdListener: missing in Tomcat And this one as well, since it goes with changeSessionId() javax.servlet.http.HttpUpgradeHandler: missing in Tomcat Missing features. Not anymore, you just added it. :-) snip / The diff since your lash check-ins shows it to be much closer to the spec now. This e-mail may contain privileged or confidential information. If you are not the intended recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s); and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s). Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions, corruption or virus in this message or any attachments. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
When to notify of changed session IDs?
After discussing with Mark T, I'm working on implementing HttpServletRequest.changeSessionId() and the calling of HttpSessionIdListeners as introduced in the Servlet 3.1 specification. I'd like to help and it seemed like a trivial enough item for me to tackle (I may regret saying that :-P). Tomcat already has some utilities built-in for changing session IDs, so that helped me significantly. Currently I'm seeing that there are a couple places where session IDs can already change in Tomcat: - Request is authenticated via some container-provided mechanism and changeSessionIdOnAuthentication is enabled - A session ID is changed on one node in a cluster and it notifies the other nodes to do the same When any of these happen, Context.fireContainerEvent() is called with Context.CHANGE_SESSION_ID_EVENT. The Servlet 3.1 spec document doesn't deal with the new HttpSessionIdListener directly, but the javadoc for Servlet 3.1 says that all HttpSessionIdListeners will be of session ID changes. It doesn't say when HttpServletRequest.changeSessionId() is called, it says about HttpSession ID changes. So, from where I standing, this means to me: - When HttpServletRequest.changeSessionId() is called and changes the session ID, OR the container authenticates a request and changeSessionIdOnAuthentication is enabled resulting in the session ID changing, OR a session ID is changed on one node in a cluster and it notifies the other nodes to do the same, or a session ID is changed for any other reason, HttpSessionIdListeners should be notified. - When HttpServletRequest.changeSessionId() is called and changes the session Id, Context.fireContainerEvent() should be called with Context.CHANGE_SESSION_ID_EVENT just like if the session ID were changed some other way. Does anyone disagree with this? This e-mail may contain privileged or confidential information. If you are not the intended recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s); and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s). Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions, corruption or virus in this message or any attachments. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
RE: When to notify of changed session IDs?
-Original Message- From: Williams, Nick [mailto:nicholas.willi...@ul.com] Sent: Monday, February 11, 2013 5:24 PM To: Tomcat Developers List (dev@tomcat.apache.org) Subject: When to notify of changed session IDs? After discussing with Mark T, I'm working on implementing HttpServletRequest.changeSessionId() and the calling of HttpSessionIdListeners as introduced in the Servlet 3.1 specification. I'd like to help and it seemed like a trivial enough item for me to tackle (I may regret saying that :-P). Tomcat already has some utilities built-in for changing session IDs, so that helped me significantly. Currently I'm seeing that there are a couple places where session IDs can already change in Tomcat: - Request is authenticated via some container-provided mechanism and changeSessionIdOnAuthentication is enabled - A session ID is changed on one node in a cluster and it notifies the other nodes to do the same When any of these happen, Context.fireContainerEvent() is called with Context.CHANGE_SESSION_ID_EVENT. The Servlet 3.1 spec document doesn't deal with the new HttpSessionIdListener directly, but the javadoc for Servlet 3.1 says that all HttpSessionIdListeners will be of session ID changes. It doesn't say when HttpServletRequest.changeSessionId() is called, it says about HttpSession ID changes. So, from where I standing, this means to me: - When HttpServletRequest.changeSessionId() is called and changes the session ID, OR the container authenticates a request and changeSessionIdOnAuthentication is enabled resulting in the session ID changing, OR a session ID is changed on one node in a cluster and it notifies the other nodes to do the same, or a session ID is changed for any other reason, HttpSessionIdListeners should be notified. - When HttpServletRequest.changeSessionId() is called and changes the session Id, Context.fireContainerEvent() should be called with Context.CHANGE_SESSION_ID_EVENT just like if the session ID were changed some other way. Does anyone disagree with this? With the above assumptions that I believe are correct, I have completed the changes necessary for this to work. It is compiling and running without any issues that I can see on my machine, I can successfully change a session ID by calling HttpServletRequest.changeSessionId(), and HttpSessionIdListeners are notified when I change a session ID. Everything appears to be working perfectly. I tried to run all of the Junit tests locally, but when it completed 30 minutes later I had dozens of failures and dozens of errors. After reviewing the messages carefully, I am 99.9% sure that none of these are due to changes I made. I don't think I have my local environment set up right to run unit tests. (I would appreciate some guidance on this if anyone has any.) The majority of the failures were due to java.lang.ClassNotFoundException: org.apache.tomcat.util.http.ValuesEnumerator. I am quite comfortable saying I didn't cause that, but I'm certainly not sure what did. I have attached a diff file for my changes, which I'm not sure will get through because I don't know whether the developer's list allows attachments. I know the user's list doesn't. But seeing as how this is new development (Servlet 3.1) and not a bug, I didn't have anything else to attach the diff on. I'd appreciate feedback on the diff and any information anyone has about next steps. This e-mail may contain privileged or confidential information. If you are not the intended recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s); and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s). Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions, corruption or virus in this message or any attachments. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 51314] JavaScript interpreted as Java when included in JSP
https://issues.apache.org/bugzilla/show_bug.cgi?id=51314 venu trainee.v...@cravaka.com changed: What|Removed |Added CC||trainee.v...@cravaka.com -- 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 54551] New: javascript
https://issues.apache.org/bugzilla/show_bug.cgi?id=54551 Bug ID: 54551 Summary: javascript Product: Tomcat 6 Version: unspecified Hardware: PC Status: NEW Severity: critical Priority: P1 Component: Examples Assignee: dev@tomcat.apache.org Reporter: trainee.v...@cravaka.com CC: ram...@cravaka.com Classification: Unclassified -- 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 54551] javascript
https://issues.apache.org/bugzilla/show_bug.cgi?id=54551 Chuck Caldarale chuck.caldar...@unisys.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID OS||All --- Comment #1 from Chuck Caldarale chuck.caldar...@unisys.com --- Bugzilla is not a playground. -- 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: [VOTE] Release Apache Tomcat Native 1.1.27
On 02/08/2013 02:43 PM, Mladen Turk wrote: The Apache Tomcat Native 1.1.27 is [X] Stable, go ahead and release [ ] Broken because of ... My vote, FTR Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org