Author: kkolinko Date: Thu Feb 9 22:50:52 2012 New Revision: 1242584 URL: http://svn.apache.org/viewvc?rev=1242584&view=rev Log: Fix line ends in the files.
This is technical commit to recover from eoln brokeness from commits via svn-git intergration. See thread on dev@. This commit should not change anything besides the line ends. Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/Constants.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeAprProcessor.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeBioProcessor.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java tomcat/trunk/webapps/examples/websocket/index.html Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/Constants.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/Constants.java?rev=1242584&r1=1242583&r2=1242584&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/Constants.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/Constants.java Thu Feb 9 22:50:52 2012 @@ -1,22 +1,22 @@ -/* - * 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.coyote.http11.upgrade; - -public class Constants { - - public static final String Package = "org.apache.coyote.http11.upgrade"; -} +/* + * 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.coyote.http11.upgrade; + +public class Constants { + + public static final String Package = "org.apache.coyote.http11.upgrade"; +} Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeAprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeAprProcessor.java?rev=1242584&r1=1242583&r2=1242584&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeAprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeAprProcessor.java Thu Feb 9 22:50:52 2012 @@ -1,73 +1,73 @@ -/* - * 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.coyote.http11.upgrade; - -import java.io.IOException; - -import org.apache.tomcat.jni.Socket; -import org.apache.tomcat.util.net.SocketWrapper; - -/** - * Implementation note: The need to extend Http11Processor could probably be - * removed if the Processor interface was expanded to cover all of the methods - * required by the AbstractProtocol. That would simplify the code and further - * reduce the size of instances of this class. - */ -public class UpgradeAprProcessor extends UpgradeProcessor<Long> { - - long socket; - - - public UpgradeAprProcessor(SocketWrapper<Long> wrapper, - UpgradeInbound upgradeInbound) { - super(upgradeInbound); - - this.socket = wrapper.getSocket().longValue(); - } - - - /* - * Output methods - */ - @Override - public void flush() throws IOException { - // NOOP - } - - - @Override - public void write(int b) throws IOException { - Socket.send(socket, new byte[] {(byte) b}, 0, 1); - } - - - /* - * Input methods - */ - @Override - public int read() throws IOException { - byte[] bytes = new byte[1]; - Socket.recv(socket, bytes, 0, 1); - return bytes[0]; - } - - - @Override - public int read(byte[] bytes) throws IOException { - return Socket.recv(socket, bytes, 0, bytes.length); - } -} +/* + * 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.coyote.http11.upgrade; + +import java.io.IOException; + +import org.apache.tomcat.jni.Socket; +import org.apache.tomcat.util.net.SocketWrapper; + +/** + * Implementation note: The need to extend Http11Processor could probably be + * removed if the Processor interface was expanded to cover all of the methods + * required by the AbstractProtocol. That would simplify the code and further + * reduce the size of instances of this class. + */ +public class UpgradeAprProcessor extends UpgradeProcessor<Long> { + + long socket; + + + public UpgradeAprProcessor(SocketWrapper<Long> wrapper, + UpgradeInbound upgradeInbound) { + super(upgradeInbound); + + this.socket = wrapper.getSocket().longValue(); + } + + + /* + * Output methods + */ + @Override + public void flush() throws IOException { + // NOOP + } + + + @Override + public void write(int b) throws IOException { + Socket.send(socket, new byte[] {(byte) b}, 0, 1); + } + + + /* + * Input methods + */ + @Override + public int read() throws IOException { + byte[] bytes = new byte[1]; + Socket.recv(socket, bytes, 0, 1); + return bytes[0]; + } + + + @Override + public int read(byte[] bytes) throws IOException { + return Socket.recv(socket, bytes, 0, bytes.length); + } +} Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeBioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeBioProcessor.java?rev=1242584&r1=1242583&r2=1242584&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeBioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeBioProcessor.java Thu Feb 9 22:50:52 2012 @@ -1,74 +1,74 @@ -/* - * 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.coyote.http11.upgrade; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; - -import org.apache.tomcat.util.net.SocketWrapper; - -/** - * Implementation note: The need to extend Http11Processor could probably be - * removed if the Processor interface was expanded to cover all of the methods - * required by the AbstractProtocol. That would simplify the code and further - * reduce the size of instances of this class. - */ -public class UpgradeBioProcessor extends UpgradeProcessor<Socket> { - - private InputStream inputStream; - private OutputStream outputStream; - - public UpgradeBioProcessor(SocketWrapper<Socket> wrapper, - UpgradeInbound upgradeInbound) throws IOException { - super(upgradeInbound); - - this.inputStream = wrapper.getSocket().getInputStream(); - this.outputStream = wrapper.getSocket().getOutputStream(); - } - - - /* - * Output methods - */ - @Override - public void flush() throws IOException { - outputStream.flush(); - } - - - @Override - public void write(int b) throws IOException { - outputStream.write(b); - } - - - /* - * Input methods - */ - @Override - public int read() throws IOException { - return inputStream.read(); - } - - - @Override - public int read(byte[] bytes) throws IOException { - return inputStream.read(bytes); - } -} +/* + * 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.coyote.http11.upgrade; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.Socket; + +import org.apache.tomcat.util.net.SocketWrapper; + +/** + * Implementation note: The need to extend Http11Processor could probably be + * removed if the Processor interface was expanded to cover all of the methods + * required by the AbstractProtocol. That would simplify the code and further + * reduce the size of instances of this class. + */ +public class UpgradeBioProcessor extends UpgradeProcessor<Socket> { + + private InputStream inputStream; + private OutputStream outputStream; + + public UpgradeBioProcessor(SocketWrapper<Socket> wrapper, + UpgradeInbound upgradeInbound) throws IOException { + super(upgradeInbound); + + this.inputStream = wrapper.getSocket().getInputStream(); + this.outputStream = wrapper.getSocket().getOutputStream(); + } + + + /* + * Output methods + */ + @Override + public void flush() throws IOException { + outputStream.flush(); + } + + + @Override + public void write(int b) throws IOException { + outputStream.write(b); + } + + + /* + * Input methods + */ + @Override + public int read() throws IOException { + return inputStream.read(); + } + + + @Override + public int read(byte[] bytes) throws IOException { + return inputStream.read(bytes); + } +} 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=1242584&r1=1242583&r2=1242584&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java Thu Feb 9 22:50:52 2012 @@ -1,179 +1,179 @@ -/* - * 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.coyote.http11.upgrade; - -import java.io.EOFException; -import java.io.IOException; -import java.nio.channels.Selector; - -import org.apache.tomcat.util.net.NioChannel; -import org.apache.tomcat.util.net.NioEndpoint; -import org.apache.tomcat.util.net.NioSelectorPool; -import org.apache.tomcat.util.net.SocketWrapper; - -/** - * Implementation note: The need to extend Http11Processor could probably be - * removed if the Processor interface was expanded to cover all of the methods - * required by the AbstractProtocol. That would simplify the code and further - * reduce the size of instances of this class. - */ -public class UpgradeNioProcessor extends UpgradeProcessor<NioChannel> { - - private NioChannel nioChannel; - private NioSelectorPool pool; - - public UpgradeNioProcessor(SocketWrapper<NioChannel> wrapper, - UpgradeInbound upgradeInbound, NioSelectorPool pool) { - super(upgradeInbound); - - this.nioChannel = wrapper.getSocket(); - this.pool = pool; - } - - - /* - * Output methods - */ - @Override - public void flush() throws IOException { - NioEndpoint.KeyAttachment att = - (NioEndpoint.KeyAttachment) nioChannel.getAttachment(false); - if (att == null) { - throw new IOException("Key must be cancelled"); - } - long writeTimeout = att.getTimeout(); - Selector selector = null; - try { - selector = pool.get(); - } catch ( IOException x ) { - //ignore - } - try { - do { - if (nioChannel.flush(true, selector, writeTimeout)) { - break; - } - } while (true); - } finally { - if (selector != null) { - pool.put(selector); - } - } - } - - @Override - public void write(int b) throws IOException { - writeToSocket(new byte[] {(byte) b}); - } - - /* - * Input methods - */ - @Override - public int read() throws IOException { - byte[] bytes = new byte[1]; - readSocket(true, bytes, 0, 1); - return bytes[0]; - } - - @Override - public int read(byte[] bytes) throws IOException { - return readSocket(true, bytes, 0, bytes.length); - } - - - /* - * Adapted from the NioInputBuffer. - */ - private int readSocket(boolean block, byte[] bytes, int offset, int len) - throws IOException { - - int nRead = 0; - nioChannel.getBufHandler().getReadBuffer().clear(); - nioChannel.getBufHandler().getReadBuffer().limit(len); - if (block) { - Selector selector = null; - try { - selector = pool.get(); - } catch ( IOException x ) { - // Ignore - } - try { - NioEndpoint.KeyAttachment att = - (NioEndpoint.KeyAttachment) nioChannel.getAttachment(false); - if (att == null) { - throw new IOException("Key must be cancelled."); - } - nRead = pool.read(nioChannel.getBufHandler().getReadBuffer(), - nioChannel, selector, att.getTimeout()); - } catch (EOFException eof) { - nRead = -1; - } finally { - if (selector != null) { - pool.put(selector); - } - } - } else { - nRead = nioChannel.read(nioChannel.getBufHandler().getReadBuffer()); - } - if (nRead > 0) { - nioChannel.getBufHandler().getReadBuffer().flip(); - nioChannel.getBufHandler().getReadBuffer().limit(nRead); - nioChannel.getBufHandler().getReadBuffer().get(bytes, offset, nRead); - return nRead; - } else if (nRead == -1) { - //return false; - throw new EOFException(sm.getString("nio.eof.error")); - } else { - return 0; - } - } - - - /* - * Adapted from the NioOutputBuffer - */ - private synchronized int writeToSocket(byte[] bytes) throws IOException { - - nioChannel.getBufHandler().getWriteBuffer().clear(); - nioChannel.getBufHandler().getWriteBuffer().put(bytes); - nioChannel.getBufHandler().getWriteBuffer().flip(); - - int written = 0; - NioEndpoint.KeyAttachment att = - (NioEndpoint.KeyAttachment) nioChannel.getAttachment(false); - if (att == null) { - throw new IOException("Key must be cancelled"); - } - long writeTimeout = att.getTimeout(); - Selector selector = null; - try { - selector = pool.get(); - } catch ( IOException x ) { - //ignore - } - try { - written = pool.write(nioChannel.getBufHandler().getWriteBuffer(), - nioChannel, selector, writeTimeout, true); - } finally { - if (selector != null) { - pool.put(selector); - } - } - return written; - } -} +/* + * 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.coyote.http11.upgrade; + +import java.io.EOFException; +import java.io.IOException; +import java.nio.channels.Selector; + +import org.apache.tomcat.util.net.NioChannel; +import org.apache.tomcat.util.net.NioEndpoint; +import org.apache.tomcat.util.net.NioSelectorPool; +import org.apache.tomcat.util.net.SocketWrapper; + +/** + * Implementation note: The need to extend Http11Processor could probably be + * removed if the Processor interface was expanded to cover all of the methods + * required by the AbstractProtocol. That would simplify the code and further + * reduce the size of instances of this class. + */ +public class UpgradeNioProcessor extends UpgradeProcessor<NioChannel> { + + private NioChannel nioChannel; + private NioSelectorPool pool; + + public UpgradeNioProcessor(SocketWrapper<NioChannel> wrapper, + UpgradeInbound upgradeInbound, NioSelectorPool pool) { + super(upgradeInbound); + + this.nioChannel = wrapper.getSocket(); + this.pool = pool; + } + + + /* + * Output methods + */ + @Override + public void flush() throws IOException { + NioEndpoint.KeyAttachment att = + (NioEndpoint.KeyAttachment) nioChannel.getAttachment(false); + if (att == null) { + throw new IOException("Key must be cancelled"); + } + long writeTimeout = att.getTimeout(); + Selector selector = null; + try { + selector = pool.get(); + } catch ( IOException x ) { + //ignore + } + try { + do { + if (nioChannel.flush(true, selector, writeTimeout)) { + break; + } + } while (true); + } finally { + if (selector != null) { + pool.put(selector); + } + } + } + + @Override + public void write(int b) throws IOException { + writeToSocket(new byte[] {(byte) b}); + } + + /* + * Input methods + */ + @Override + public int read() throws IOException { + byte[] bytes = new byte[1]; + readSocket(true, bytes, 0, 1); + return bytes[0]; + } + + @Override + public int read(byte[] bytes) throws IOException { + return readSocket(true, bytes, 0, bytes.length); + } + + + /* + * Adapted from the NioInputBuffer. + */ + private int readSocket(boolean block, byte[] bytes, int offset, int len) + throws IOException { + + int nRead = 0; + nioChannel.getBufHandler().getReadBuffer().clear(); + nioChannel.getBufHandler().getReadBuffer().limit(len); + if (block) { + Selector selector = null; + try { + selector = pool.get(); + } catch ( IOException x ) { + // Ignore + } + try { + NioEndpoint.KeyAttachment att = + (NioEndpoint.KeyAttachment) nioChannel.getAttachment(false); + if (att == null) { + throw new IOException("Key must be cancelled."); + } + nRead = pool.read(nioChannel.getBufHandler().getReadBuffer(), + nioChannel, selector, att.getTimeout()); + } catch (EOFException eof) { + nRead = -1; + } finally { + if (selector != null) { + pool.put(selector); + } + } + } else { + nRead = nioChannel.read(nioChannel.getBufHandler().getReadBuffer()); + } + if (nRead > 0) { + nioChannel.getBufHandler().getReadBuffer().flip(); + nioChannel.getBufHandler().getReadBuffer().limit(nRead); + nioChannel.getBufHandler().getReadBuffer().get(bytes, offset, nRead); + return nRead; + } else if (nRead == -1) { + //return false; + throw new EOFException(sm.getString("nio.eof.error")); + } else { + return 0; + } + } + + + /* + * Adapted from the NioOutputBuffer + */ + private synchronized int writeToSocket(byte[] bytes) throws IOException { + + nioChannel.getBufHandler().getWriteBuffer().clear(); + nioChannel.getBufHandler().getWriteBuffer().put(bytes); + nioChannel.getBufHandler().getWriteBuffer().flip(); + + int written = 0; + NioEndpoint.KeyAttachment att = + (NioEndpoint.KeyAttachment) nioChannel.getAttachment(false); + if (att == null) { + throw new IOException("Key must be cancelled"); + } + long writeTimeout = att.getTimeout(); + Selector selector = null; + try { + selector = pool.get(); + } catch ( IOException x ) { + //ignore + } + try { + written = pool.write(nioChannel.getBufHandler().getWriteBuffer(), + nioChannel, selector, writeTimeout, true); + } finally { + if (selector != null) { + pool.put(selector); + } + } + return written; + } +} Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java?rev=1242584&r1=1242583&r2=1242584&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java Thu Feb 9 22:50:52 2012 @@ -1,118 +1,118 @@ -/* - * 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.coyote.http11.upgrade; - -import java.io.IOException; -import java.util.concurrent.Executor; - -import org.apache.coyote.Processor; -import org.apache.coyote.Request; -import org.apache.coyote.http11.Constants; -import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState; -import org.apache.tomcat.util.net.SSLSupport; -import org.apache.tomcat.util.net.SocketStatus; -import org.apache.tomcat.util.net.SocketWrapper; -import org.apache.tomcat.util.res.StringManager; - -public abstract class UpgradeProcessor<S> implements Processor<S> { - - protected static final StringManager sm = - StringManager.getManager(Constants.Package); - - private final UpgradeInbound upgradeInbound; - - protected UpgradeProcessor (UpgradeInbound upgradeInbound) { - this.upgradeInbound = upgradeInbound; - upgradeInbound.setUpgradeProcessor(this); - upgradeInbound.setUpgradeOutbound(new UpgradeOutbound(this)); - } - - // Output methods - public abstract void flush() throws IOException; - public abstract void write(int b) throws IOException; - - // Input methods - public abstract int read() throws IOException; - public abstract int read(byte[] bytes) throws IOException; - - @Override - public final UpgradeInbound getUpgradeInbound() { - return upgradeInbound; - } - - @Override - public final SocketState upgradeDispatch() throws IOException { - return upgradeInbound.onData(); - } - - @Override - public final boolean isUpgrade() { - return true; - } - - @Override - public final void recycle(boolean socketClosing) { - // Currently a NO-OP as upgrade processors are not recycled. - } - - // NO-OP methods for upgrade - @Override - public final Executor getExecutor() { - return null; - } - - @Override - public final SocketState process(SocketWrapper<S> socketWrapper) - throws IOException { - return null; - } - - @Override - public final SocketState event(SocketStatus status) throws IOException { - return null; - } - - @Override - public final SocketState asyncDispatch(SocketStatus status) { - return null; - } - - @Override - public final SocketState asyncPostProcess() { - return null; - } - - @Override - public final boolean isComet() { - return false; - } - - @Override - public final boolean isAsync() { - return false; - } - - @Override - public final Request getRequest() { - return null; - } - - @Override - public final void setSslSupport(SSLSupport sslSupport) { - // NOOP - } -} +/* + * 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.coyote.http11.upgrade; + +import java.io.IOException; +import java.util.concurrent.Executor; + +import org.apache.coyote.Processor; +import org.apache.coyote.Request; +import org.apache.coyote.http11.Constants; +import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState; +import org.apache.tomcat.util.net.SSLSupport; +import org.apache.tomcat.util.net.SocketStatus; +import org.apache.tomcat.util.net.SocketWrapper; +import org.apache.tomcat.util.res.StringManager; + +public abstract class UpgradeProcessor<S> implements Processor<S> { + + protected static final StringManager sm = + StringManager.getManager(Constants.Package); + + private final UpgradeInbound upgradeInbound; + + protected UpgradeProcessor (UpgradeInbound upgradeInbound) { + this.upgradeInbound = upgradeInbound; + upgradeInbound.setUpgradeProcessor(this); + upgradeInbound.setUpgradeOutbound(new UpgradeOutbound(this)); + } + + // Output methods + public abstract void flush() throws IOException; + public abstract void write(int b) throws IOException; + + // Input methods + public abstract int read() throws IOException; + public abstract int read(byte[] bytes) throws IOException; + + @Override + public final UpgradeInbound getUpgradeInbound() { + return upgradeInbound; + } + + @Override + public final SocketState upgradeDispatch() throws IOException { + return upgradeInbound.onData(); + } + + @Override + public final boolean isUpgrade() { + return true; + } + + @Override + public final void recycle(boolean socketClosing) { + // Currently a NO-OP as upgrade processors are not recycled. + } + + // NO-OP methods for upgrade + @Override + public final Executor getExecutor() { + return null; + } + + @Override + public final SocketState process(SocketWrapper<S> socketWrapper) + throws IOException { + return null; + } + + @Override + public final SocketState event(SocketStatus status) throws IOException { + return null; + } + + @Override + public final SocketState asyncDispatch(SocketStatus status) { + return null; + } + + @Override + public final SocketState asyncPostProcess() { + return null; + } + + @Override + public final boolean isComet() { + return false; + } + + @Override + public final boolean isAsync() { + return false; + } + + @Override + public final Request getRequest() { + return null; + } + + @Override + public final void setSslSupport(SSLSupport sslSupport) { + // NOOP + } +} Modified: tomcat/trunk/webapps/examples/websocket/index.html URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/websocket/index.html?rev=1242584&r1=1242583&r2=1242584&view=diff ============================================================================== --- tomcat/trunk/webapps/examples/websocket/index.html (original) +++ tomcat/trunk/webapps/examples/websocket/index.html Thu Feb 9 22:50:52 2012 @@ -1,28 +1,28 @@ -<!-- - 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. ---> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<HTML><HEAD><TITLE>Apache Tomcat WebSocket Examples</TITLE> -<META http-equiv=Content-Type content="text/html"> -</HEAD> -<BODY> -<P> -<H3>Apache Tomcat WebSocket Examples</H3> -<P></P> -<ul> -<li><a href="echo.html">Echo example</a></li> -</ul> +<!-- + 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. +--> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<HTML><HEAD><TITLE>Apache Tomcat WebSocket Examples</TITLE> +<META http-equiv=Content-Type content="text/html"> +</HEAD> +<BODY> +<P> +<H3>Apache Tomcat WebSocket Examples</H3> +<P></P> +<ul> +<li><a href="echo.html">Echo example</a></li> +</ul> </BODY></HTML> \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org