You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/10/12 13:47:55 UTC
svn commit: r1397522 - in /tomcat/trunk/java/javax/net: ./ websocket/
websocket/annotations/ websocket/extensions/
Author: markt
Date: Fri Oct 12 11:47:53 2012
New Revision: 1397522
URL: http://svn.apache.org/viewvc?rev=1397522&view=rev
Log:
Add JSR-356 (WebSocket) API.
This is the Early Draft Review - version 6
I have tweaked a few things (mainly generics) to reduce the number of reported errors.
Added:
tomcat/trunk/java/javax/net/
tomcat/trunk/java/javax/net/websocket/
tomcat/trunk/java/javax/net/websocket/ClientContainer.java (with props)
tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java (with props)
tomcat/trunk/java/javax/net/websocket/CloseReason.java (with props)
tomcat/trunk/java/javax/net/websocket/ContainerProvider.java (with props)
tomcat/trunk/java/javax/net/websocket/DecodeException.java (with props)
tomcat/trunk/java/javax/net/websocket/Decoder.java (with props)
tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java (with props)
tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java (with props)
tomcat/trunk/java/javax/net/websocket/EncodeException.java (with props)
tomcat/trunk/java/javax/net/websocket/Encoder.java (with props)
tomcat/trunk/java/javax/net/websocket/Endpoint.java (with props)
tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java (with props)
tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java (with props)
tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java (with props)
tomcat/trunk/java/javax/net/websocket/MessageHandler.java (with props)
tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java (with props)
tomcat/trunk/java/javax/net/websocket/SendHandler.java (with props)
tomcat/trunk/java/javax/net/websocket/SendResult.java (with props)
tomcat/trunk/java/javax/net/websocket/ServerContainer.java (with props)
tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java (with props)
tomcat/trunk/java/javax/net/websocket/Session.java (with props)
tomcat/trunk/java/javax/net/websocket/annotations/
tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java (with props)
tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java (with props)
tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java (with props)
tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java (with props)
tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java (with props)
tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java (with props)
tomcat/trunk/java/javax/net/websocket/extensions/
tomcat/trunk/java/javax/net/websocket/extensions/Extension.java (with props)
tomcat/trunk/java/javax/net/websocket/extensions/Frame.java (with props)
tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java (with props)
tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java (with props)
Added: tomcat/trunk/java/javax/net/websocket/ClientContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ClientContainer.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/ClientContainer.java (added)
+++ tomcat/trunk/java/javax/net/websocket/ClientContainer.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.net.websocket;
+
+import java.util.Set;
+
+import javax.net.websocket.extensions.Extension;
+
+public interface ClientContainer {
+
+ void connectToServer(Endpoint endpoint, ClientEndpointConfiguration olc);
+
+ Set<Session<?>> getActiveSessions();
+
+ long getMaxSessionIdleTimeout();
+
+ void setMaxSessionIdleTimeout(long timeout);
+
+ long getMaxBinaryMessageBufferSize();
+
+ void setMaxBinaryMessageBufferSize(long max);
+
+ long getMaxTextMessageBufferSize();
+
+ void setMaxTextMessageBufferSize(long max);
+
+ Set<Extension> getInstalledExtensions();
+}
Propchange: tomcat/trunk/java/javax/net/websocket/ClientContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java (added)
+++ tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java Fri Oct 12 11:47:53 2012
@@ -0,0 +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.
+ */
+package javax.net.websocket;
+
+import java.util.List;
+
+import javax.net.websocket.extensions.Extension;
+
+public interface ClientEndpointConfiguration extends EndpointConfiguration {
+
+ List<String> getPreferredSubprotocols();
+
+ List<Extension> getExtensions();
+}
Propchange: tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/CloseReason.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/CloseReason.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/CloseReason.java (added)
+++ tomcat/trunk/java/javax/net/websocket/CloseReason.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,57 @@
+/*
+ * 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 javax.net.websocket;
+
+public class CloseReason {
+
+ @SuppressWarnings("unused")
+ public CloseReason(CloseReason.CloseCode closeCode, String reasonPhrase) {
+ // FIXME - These need accessors
+ }
+
+ public interface CloseCode {
+ int getCode();
+ }
+
+ public enum CloseCodes implements CloseReason.CloseCode {
+
+ NORMAL_CLOSURE(1000),
+ GOING_AWAY(1001),
+ PROTOCOL_ERROR(1002),
+ CANNOT_ACCEPT(1003),
+ RESERVED(1004),
+ NO_STATUS_CODE(1005),
+ CLOSED_ABNORMALLY(1006),
+ NOT_CONSISTENT(1007),
+ VIOLATED_POLICY(1008),
+ TOO_BIG(1009),
+ NO_EXTENSION(1010),
+ UNEXPECTED_CONDITION(1011),
+ TLS_HANDSHAKE_FAILURE(1015);
+
+ private int code;
+
+ CloseCodes(int code) {
+ this.code = code;
+ }
+
+ @Override
+ public int getCode() {
+ return code;
+ }
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/CloseReason.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/ContainerProvider.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ContainerProvider.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/ContainerProvider.java (added)
+++ tomcat/trunk/java/javax/net/websocket/ContainerProvider.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,30 @@
+/*
+ * 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 javax.net.websocket;
+
+public class ContainerProvider {
+
+ public static ServerContainer getServerContainer() {
+ // TODO
+ return null;
+ }
+
+ public static ClientContainer getClientContainer() {
+ // TODO
+ return null;
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/ContainerProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/DecodeException.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/DecodeException.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/DecodeException.java (added)
+++ tomcat/trunk/java/javax/net/websocket/DecodeException.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,56 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.nio.ByteBuffer;
+
+public class DecodeException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private ByteBuffer bb;
+ private String encodedString;
+
+ public DecodeException(ByteBuffer bb, String message, Throwable cause) {
+ super(message, cause);
+ this.bb = bb;
+ }
+
+ public DecodeException(String encodedString, String message,
+ Throwable cause) {
+ super(message, cause);
+ this.encodedString = encodedString;
+ }
+
+ public DecodeException(ByteBuffer bb, String message) {
+ super(message);
+ this.bb = bb;
+ }
+
+ public DecodeException(String encodedString, String message) {
+ super(message);
+ this.encodedString = encodedString;
+ }
+
+ public ByteBuffer getBytes() {
+ return bb;
+ }
+
+ public String getText() {
+ return encodedString;
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/DecodeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/Decoder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Decoder.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/Decoder.java (added)
+++ tomcat/trunk/java/javax/net/websocket/Decoder.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,49 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.nio.ByteBuffer;
+
+public interface Decoder {
+
+ interface Binary<T> extends Decoder {
+
+ T decode(ByteBuffer bytes) throws DecodeException;
+
+ boolean willDecode(ByteBuffer bytes);
+ }
+
+ interface BinaryStream<T> extends Decoder {
+
+ T decode(InputStream is) throws DecodeException, IOException;
+ }
+
+ interface Text<T> extends Decoder {
+
+ T decode(String s) throws DecodeException;
+
+ boolean willDecode(String s);
+ }
+
+ interface TextStream<T> extends Decoder {
+
+ T decode(Reader reader) throws DecodeException, IOException;
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/Decoder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java (added)
+++ tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,81 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.net.websocket.extensions.Extension;
+
+public class DefaultClientConfiguration implements ClientEndpointConfiguration {
+ private URI uri;
+ private List<String> preferredSubprotocols = new ArrayList<>();
+ private List<Extension> extensions = new ArrayList<>();
+ private List<Encoder> encoders = new ArrayList<>();
+ private List<Decoder> decoders = new ArrayList<>();
+
+ public DefaultClientConfiguration(URI uri) {
+ this.uri = uri;
+ }
+
+ public URI getURI() {
+ return uri;
+ }
+
+ @Override
+ public List<String> getPreferredSubprotocols() {
+ return preferredSubprotocols;
+ }
+
+ public DefaultClientConfiguration setPreferredSubprotocols(
+ List<String> preferredSubprotocols) {
+ this.preferredSubprotocols = preferredSubprotocols;
+ return this;
+ }
+
+ @Override
+ public List<Extension> getExtensions() {
+ return extensions;
+ }
+
+ public ClientEndpointConfiguration setExtensions(
+ List<Extension> extensions) {
+ this.extensions = extensions;
+ return this;
+ }
+
+ @Override
+ public List<Encoder> getEncoders() {
+ return encoders;
+ }
+
+ public ClientEndpointConfiguration setEncoders(List<Encoder> encoders) {
+ this.encoders = encoders;
+ return this;
+ }
+
+ @Override
+ public List<Decoder> getDecoders() {
+ return decoders;
+ }
+
+ public ClientEndpointConfiguration setDecoders(List<Decoder> decoders) {
+ this.decoders = decoders;
+ return this;
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java (added)
+++ tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,103 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.net.websocket.extensions.Extension;
+
+public class DefaultServerConfiguration implements ServerEndpointConfiguration {
+ private URI uri;
+ private List<String> subprotocols = new ArrayList<>();
+ private List<Extension> extensions = new ArrayList<>();
+ private List<Encoder> encoders = new ArrayList<>();
+ private List<Decoder> decoders = new ArrayList<>();
+
+ protected DefaultServerConfiguration() {
+ }
+
+ public DefaultServerConfiguration(URI uri) {
+ this.uri = uri;
+ }
+
+ public DefaultServerConfiguration setEncoders(List<Encoder> encoders) {
+ this.encoders = encoders;
+ return this;
+ }
+
+ public DefaultServerConfiguration setDecoders(List<Decoder> decoders) {
+ this.decoders = decoders;
+ return this;
+ }
+
+ public DefaultServerConfiguration setSubprotocols(
+ List<String> subprotocols) {
+ this.subprotocols = subprotocols;
+ return this;
+ }
+
+ public DefaultServerConfiguration setExtensions(
+ List<Extension> extensions) {
+ this.extensions = extensions;
+ return this;
+ }
+
+
+ @Override
+ public List<Encoder> getEncoders() {
+ return this.encoders;
+ }
+
+
+ @Override
+ public List<Decoder> getDecoders() {
+ return this.decoders;
+ }
+
+ @Override
+ public String getNegotiatedSubprotocol(List<String> requestedSubprotocols) {
+ // TODO
+ return null;
+ }
+
+
+ @Override
+ public List<Extension> getNegotiatedExtensions(
+ List<Extension> requestedExtensions) {
+ // TODO
+ return null;
+ }
+
+ @Override
+ public boolean checkOrigin(String originHeaderValue) {
+ // TODO
+ return false;
+ }
+
+ @Override
+ public boolean matchesURI(URI uri) {
+ return this.uri.equals(uri);
+ }
+
+ @Override
+ public void modifyHandshake(HandshakeRequest request,
+ HandshakeResponse response) {
+ // TODO
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/EncodeException.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/EncodeException.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/EncodeException.java (added)
+++ tomcat/trunk/java/javax/net/websocket/EncodeException.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,38 @@
+/*
+ * 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 javax.net.websocket;
+
+public class EncodeException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private Object object;
+
+ public EncodeException(String message, Object object) {
+ super(message);
+ this.object = object;
+ }
+
+ public EncodeException(String message, Object object, Throwable cause) {
+ super(message, cause);
+ this.object = object;
+ }
+
+ public Object getObject() {
+ return this.object;
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/EncodeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/Encoder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Encoder.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/Encoder.java (added)
+++ tomcat/trunk/java/javax/net/websocket/Encoder.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,47 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.ByteBuffer;
+
+public interface Encoder {
+
+ interface Text<T> extends Encoder {
+
+ String encode(T object) throws EncodeException;
+ }
+
+ interface TextStream<T> extends Encoder {
+
+ void encode(T object, Writer writer)
+ throws EncodeException, IOException;
+ }
+
+ interface Binary<T> extends Encoder {
+
+ ByteBuffer encode(T object) throws EncodeException;
+ }
+
+ interface BinaryStream<T> extends Encoder {
+
+ void encode(T object, OutputStream os)
+ throws EncodeException, IOException;
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/Encoder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/Endpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Endpoint.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/Endpoint.java (added)
+++ tomcat/trunk/java/javax/net/websocket/Endpoint.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,47 @@
+/*
+ * 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 javax.net.websocket;
+
+public abstract class Endpoint {
+
+ /**
+ * Event that is triggered when a new session starts.
+ *
+ * @param session The new session.
+ */
+ public abstract void onOpen(Session<?> session);
+
+ /**
+ * Event that is triggered when a session has closed.
+ *
+ * @param session The session that has closed
+ * @param closeReason Why the session was closed
+ */
+ public void onClose(Session<?> session, CloseReason closeReason) {
+ // NO-OP by default
+ }
+
+ /**
+ * Event that is triggered when a protocol error occurs.
+ *
+ * @param throwable The exception
+ * @param session The session that experienced the error
+ */
+ public void onError(Throwable throwable, Session<?> session) {
+ // NO-OP by default
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/Endpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java (added)
+++ tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,26 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.util.List;
+
+public interface EndpointConfiguration {
+
+ List<Encoder> getEncoders();
+
+ List<Decoder> getDecoders();
+}
Propchange: tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java (added)
+++ tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.net.websocket;
+
+import java.net.URI;
+import java.security.Principal;
+import java.util.List;
+import java.util.Map;
+
+public interface HandshakeRequest {
+
+ Map<String,List<String>> getHeaders();
+
+ Principal getUserPrincipal();
+
+ URI getRequestURI();
+
+ boolean isUserInRole(String role);
+
+ Object getSession();
+
+ Map<String, String[]> getParameterMap();
+
+ String getQueryString();
+}
Propchange: tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java (added)
+++ tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,25 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.util.List;
+import java.util.Map;
+
+public interface HandshakeResponse {
+
+ Map<String,List<String>> getHeaders();
+}
Propchange: tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/MessageHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/MessageHandler.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/MessageHandler.java (added)
+++ tomcat/trunk/java/javax/net/websocket/MessageHandler.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.nio.ByteBuffer;
+
+public interface MessageHandler {
+
+ interface Text extends MessageHandler {
+
+ void onMessage(String text);
+ }
+
+
+ interface Binary extends MessageHandler {
+
+ void onMessage(ByteBuffer data);
+ }
+
+
+ interface AsyncBinary extends MessageHandler {
+
+ void onMessagePart(ByteBuffer part, boolean last);
+ }
+
+
+ interface AsyncText extends MessageHandler {
+
+ void onMessagePart(String part, boolean last);
+ }
+
+
+ interface DecodedObject<T> extends MessageHandler {
+
+ void onMessage(T customObject);
+ }
+
+ interface BinaryStream extends MessageHandler {
+
+ void onMessage(InputStream is);
+ }
+
+
+ interface CharacterStream extends MessageHandler {
+
+ void onMessage(Reader r);
+ }
+
+
+ interface Pong extends MessageHandler {
+
+ void onPong(ByteBuffer applicationData);
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/MessageHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java (added)
+++ tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,52 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.ByteBuffer;
+import java.util.concurrent.Future;
+
+
+public interface RemoteEndpoint<T> {
+
+ void sendString(String text) throws IOException;
+
+ void sendBytes(ByteBuffer data) throws IOException;
+
+ void sendPartialString(String fragment, boolean isLast) throws IOException;
+
+ void sendPartialBytes(ByteBuffer partialByte, boolean isLast) throws IOException; // or Iterable<byte[]>
+
+ OutputStream getSendStream() throws IOException;
+
+ Writer getSendWriter() throws IOException;
+
+ void sendObject(T o) throws IOException, EncodeException;
+
+ Future<SendResult> sendString(String text, SendHandler completion);
+
+ Future<SendResult> sendBytes(ByteBuffer data, SendHandler completion);
+
+ Future<SendResult> sendObject(T o, SendHandler handler);
+
+ void sendPing(ByteBuffer applicationData);
+
+ void sendPong(ByteBuffer applicationData);
+}
+
Propchange: tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/SendHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/SendHandler.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/SendHandler.java (added)
+++ tomcat/trunk/java/javax/net/websocket/SendHandler.java Fri Oct 12 11:47:53 2012
@@ -0,0 +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 javax.net.websocket;
+
+public interface SendHandler {
+
+ void setResult(SendResult result);
+}
Propchange: tomcat/trunk/java/javax/net/websocket/SendHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/SendResult.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/SendResult.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/SendResult.java (added)
+++ tomcat/trunk/java/javax/net/websocket/SendResult.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.net.websocket;
+
+public class SendResult {
+ private Throwable exception;
+ private boolean ok = true;
+
+ public SendResult(Throwable exception) {
+ this.exception = exception;
+ this.ok = false;
+ }
+
+ public SendResult() {
+ // NO-OP
+ }
+
+ public Throwable getException() {
+ return exception;
+ }
+
+ public boolean isOK() {
+ return ok;
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/SendResult.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/ServerContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ServerContainer.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/ServerContainer.java (added)
+++ tomcat/trunk/java/javax/net/websocket/ServerContainer.java Fri Oct 12 11:47:53 2012
@@ -0,0 +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 javax.net.websocket;
+
+public interface ServerContainer extends ClientContainer {
+
+ void publishServer(Endpoint endpoint, ServerEndpointConfiguration ilc);
+}
Propchange: tomcat/trunk/java/javax/net/websocket/ServerContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java (added)
+++ tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,35 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.net.URI;
+import java.util.List;
+
+import javax.net.websocket.extensions.Extension;
+
+public interface ServerEndpointConfiguration extends EndpointConfiguration {
+
+ String getNegotiatedSubprotocol(List<String> requestedSubprotocols);
+
+ List<Extension> getNegotiatedExtensions(List<Extension> requestedExtensions);
+
+ boolean checkOrigin(String originHeaderValue);
+
+ boolean matchesURI(URI uri);
+
+ void modifyHandshake(HandshakeRequest request, HandshakeResponse response);
+}
Propchange: tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/Session.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Session.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/Session.java (added)
+++ tomcat/trunk/java/javax/net/websocket/Session.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,72 @@
+/*
+ * 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 javax.net.websocket;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.net.websocket.extensions.Extension;
+
+public interface Session<T> {
+
+ ClientContainer getContainer();
+
+ void setEncoders(List<Encoder> encoders);
+
+ void addMessageHandler(MessageHandler listener);
+
+ Set<MessageHandler> getMessageHandlers();
+
+ void removeMessageHandler(MessageHandler listener);
+
+ String getProtocolVersion();
+
+ String getNegotiatedSubprotocol();
+
+ List<Extension> getNegotiatedExtensions();
+
+ boolean isSecure();
+
+ long getInactiveTime();
+
+ boolean isActive();
+
+ long getTimeout();
+
+ void setTimeout(long seconds);
+
+ void setMaximumMessageSize(long length);
+
+ long getMaximumMessageSize();
+
+ RemoteEndpoint<?> getRemote();
+
+ RemoteEndpoint<T> getRemoteL(Class<T> c);
+
+ void close() throws IOException;
+
+ void close(CloseReason closeStatus) throws IOException;
+
+ URI getRequestURI();
+
+ Map<String, String[]> getParameterMap();
+
+ String getQueryString();
+}
Propchange: tomcat/trunk/java/javax/net/websocket/Session.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java (added)
+++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,27 @@
+/*
+ * 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 javax.net.websocket.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface WebSocketClose {
+}
Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java (added)
+++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,35 @@
+/*
+ * 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 javax.net.websocket.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface WebSocketEndpoint {
+
+ public String value();
+
+ public String[] subprotocols() default {};
+
+ public Class<?>[] decoders() default {};
+
+ public Class<?>[] encoders() default {};
+}
Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java (added)
+++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,27 @@
+/*
+ * 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 javax.net.websocket.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface WebSocketError {
+}
Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java (added)
+++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java Fri Oct 12 11:47:53 2012
@@ -0,0 +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.
+ */
+package javax.net.websocket.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface WebSocketMessage {
+ public long maxMessageSize() default -1;
+}
Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java (added)
+++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,27 @@
+/*
+ * 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 javax.net.websocket.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface WebSocketOpen {
+}
Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java (added)
+++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java Fri Oct 12 11:47:53 2012
@@ -0,0 +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.
+ */
+package javax.net.websocket.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface WebSocketPathParam {
+ public String value();
+}
Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/extensions/Extension.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/extensions/Extension.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/extensions/Extension.java (added)
+++ tomcat/trunk/java/javax/net/websocket/extensions/Extension.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,30 @@
+/*
+ * 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 javax.net.websocket.extensions;
+
+import java.util.Map;
+
+public interface Extension {
+
+ String getName();
+
+ Map<String, String> getParameters();
+
+ FrameHandler createIncomingFrameHandler(FrameHandler downstream);
+
+ FrameHandler createOutgoingFrameHandler(FrameHandler upstream);
+}
Propchange: tomcat/trunk/java/javax/net/websocket/extensions/Extension.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/extensions/Frame.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/extensions/Frame.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/extensions/Frame.java (added)
+++ tomcat/trunk/java/javax/net/websocket/extensions/Frame.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,67 @@
+/*
+ * 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 javax.net.websocket.extensions;
+
+import javax.net.websocket.CloseReason;
+
+public interface Frame {
+
+ interface Data extends Frame {
+
+ byte[] getExtensionData();
+
+ interface Text extends Frame.Data {
+
+ String getText();
+
+ interface Continuation extends Frame.Data.Text {
+
+ boolean isLast();
+ }
+ }
+
+ interface Binary extends Frame.Data {
+
+ byte[] getData();
+
+ interface Continuation extends Frame.Data.Binary {
+
+ boolean isLast();
+ }
+ }
+ }
+
+ interface Control extends Frame {
+
+ interface Ping extends Frame.Control {
+
+ byte[] getApplicationData();
+ }
+
+ interface Pong extends Frame.Control {
+
+ byte[] getApplicationData();
+ }
+
+ interface Close extends Frame.Control {
+
+ String getReasonPhrase();
+
+ CloseReason.CloseCode getCloseCode();
+ }
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/extensions/Frame.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java (added)
+++ tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,49 @@
+/*
+ * 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 javax.net.websocket.extensions;
+
+import java.nio.ByteBuffer;
+
+public class FrameBuilder {
+
+ public static FrameBuilder getBuilder() {
+ // TODO
+ return null;
+ }
+
+ public Frame.Data.Text createTextFrame(String s) {
+ // TODO
+ return null;
+ }
+
+ public Frame.Data.Text.Continuation createTextContinuationFrame(
+ String s, boolean isLast) {
+ // TODO
+ return null;
+ }
+
+ public Frame.Data.Binary createBinaryFrame(ByteBuffer bb) {
+ // TODO
+ return null;
+ }
+
+ public Frame.Data.Binary.Continuation createBinaryContinuationFrame(
+ ByteBuffer bb, boolean isLast) {
+ // TODO
+ return null;
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java?rev=1397522&view=auto
==============================================================================
--- tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java (added)
+++ tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java Fri Oct 12 11:47:53 2012
@@ -0,0 +1,33 @@
+/*
+ * 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 javax.net.websocket.extensions;
+
+public abstract class FrameHandler {
+ private FrameHandler nextHandler;
+
+ public FrameHandler(FrameHandler nextHandler) {
+ this.nextHandler = nextHandler;
+ }
+
+ public FrameHandler getNextHandler() {
+ return this.nextHandler;
+ }
+
+ public void handleFrame(Frame f) {
+ this.nextHandler.handleFrame(f);
+ }
+}
Propchange: tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1397522 - in /tomcat/trunk/java/javax/net: ./
websocket/ websocket/annotations/ websocket/extensions/
Posted by sebb <se...@gmail.com>.
On 12 October 2012 13:39, Mark Thomas <ma...@apache.org> wrote:
> On 12/10/2012 13:24, Martin Grigorov wrote:
>
> Please use quoting, particularly when you have a few short comments on a
> very large e-mail. Without quoting, your comments were more effort to find.
>
>>> Added: tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java
>>> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java?rev=1397522&view=auto
>
> <snip/>
>
>>> + Object getSession();
>>
>> ^^
>> Shouldn't this return a Session instead ?
>
> No. That is an HTTP Session object and Object is used to avoid a
> dependency on the Servlet spec. I'll add some Javadoc. (I can't just
> copy the RI's Javadoc because of licensing).
>
>
>>> Added: tomcat/trunk/java/javax/net/websocket/Session.java
>>> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Session.java?rev=1397522&view=auto
>
> <snip/>
>
>>> + RemoteEndpoint<?> getRemote();
>>> +
>>> + RemoteEndpoint<T> getRemoteL(Class<T> c);
>>
>> Is there a typo in the method name ? Is the 'L' needed ?
>
> That is what the spec currently says. It looks like a typo. I've raised
> it with the EG.
In which case it might help to comment this in the code, so people
reading the source are aware?
> Thanks for the review.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1397522 - in /tomcat/trunk/java/javax/net: ./ websocket/
websocket/annotations/ websocket/extensions/
Posted by Mark Thomas <ma...@apache.org>.
On 12/10/2012 13:24, Martin Grigorov wrote:
Please use quoting, particularly when you have a few short comments on a
very large e-mail. Without quoting, your comments were more effort to find.
>> Added: tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java
>> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java?rev=1397522&view=auto
<snip/>
>> + Object getSession();
>
> ^^
> Shouldn't this return a Session instead ?
No. That is an HTTP Session object and Object is used to avoid a
dependency on the Servlet spec. I'll add some Javadoc. (I can't just
copy the RI's Javadoc because of licensing).
>> Added: tomcat/trunk/java/javax/net/websocket/Session.java
>> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Session.java?rev=1397522&view=auto
<snip/>
>> + RemoteEndpoint<?> getRemote();
>> +
>> + RemoteEndpoint<T> getRemoteL(Class<T> c);
>
> Is there a typo in the method name ? Is the 'L' needed ?
That is what the spec currently says. It looks like a typo. I've raised
it with the EG.
Thanks for the review.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1397522 - in /tomcat/trunk/java/javax/net: ./
websocket/ websocket/annotations/ websocket/extensions/
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
On Fri, Oct 12, 2012 at 2:47 PM, <ma...@apache.org> wrote:
> Author: markt
> Date: Fri Oct 12 11:47:53 2012
> New Revision: 1397522
>
> URL: http://svn.apache.org/viewvc?rev=1397522&view=rev
> Log:
> Add JSR-356 (WebSocket) API.
> This is the Early Draft Review - version 6
> I have tweaked a few things (mainly generics) to reduce the number of reported errors.
>
> Added:
> tomcat/trunk/java/javax/net/
> tomcat/trunk/java/javax/net/websocket/
> tomcat/trunk/java/javax/net/websocket/ClientContainer.java (with props)
> tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java (with props)
> tomcat/trunk/java/javax/net/websocket/CloseReason.java (with props)
> tomcat/trunk/java/javax/net/websocket/ContainerProvider.java (with props)
> tomcat/trunk/java/javax/net/websocket/DecodeException.java (with props)
> tomcat/trunk/java/javax/net/websocket/Decoder.java (with props)
> tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java (with props)
> tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java (with props)
> tomcat/trunk/java/javax/net/websocket/EncodeException.java (with props)
> tomcat/trunk/java/javax/net/websocket/Encoder.java (with props)
> tomcat/trunk/java/javax/net/websocket/Endpoint.java (with props)
> tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java (with props)
> tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java (with props)
> tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java (with props)
> tomcat/trunk/java/javax/net/websocket/MessageHandler.java (with props)
> tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java (with props)
> tomcat/trunk/java/javax/net/websocket/SendHandler.java (with props)
> tomcat/trunk/java/javax/net/websocket/SendResult.java (with props)
> tomcat/trunk/java/javax/net/websocket/ServerContainer.java (with props)
> tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java (with props)
> tomcat/trunk/java/javax/net/websocket/Session.java (with props)
> tomcat/trunk/java/javax/net/websocket/annotations/
> tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java (with props)
> tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java (with props)
> tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java (with props)
> tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java (with props)
> tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java (with props)
> tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java (with props)
> tomcat/trunk/java/javax/net/websocket/extensions/
> tomcat/trunk/java/javax/net/websocket/extensions/Extension.java (with props)
> tomcat/trunk/java/javax/net/websocket/extensions/Frame.java (with props)
> tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java (with props)
> tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java (with props)
>
> Added: tomcat/trunk/java/javax/net/websocket/ClientContainer.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ClientContainer.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/ClientContainer.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/ClientContainer.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,42 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements. See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package javax.net.websocket;
> +
> +import java.util.Set;
> +
> +import javax.net.websocket.extensions.Extension;
> +
> +public interface ClientContainer {
> +
> + void connectToServer(Endpoint endpoint, ClientEndpointConfiguration olc);
> +
> + Set<Session<?>> getActiveSessions();
> +
> + long getMaxSessionIdleTimeout();
> +
> + void setMaxSessionIdleTimeout(long timeout);
> +
> + long getMaxBinaryMessageBufferSize();
> +
> + void setMaxBinaryMessageBufferSize(long max);
> +
> + long getMaxTextMessageBufferSize();
> +
> + void setMaxTextMessageBufferSize(long max);
> +
> + Set<Extension> getInstalledExtensions();
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/ClientContainer.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +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.
> + */
> +package javax.net.websocket;
> +
> +import java.util.List;
> +
> +import javax.net.websocket.extensions.Extension;
> +
> +public interface ClientEndpointConfiguration extends EndpointConfiguration {
> +
> + List<String> getPreferredSubprotocols();
> +
> + List<Extension> getExtensions();
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/ClientEndpointConfiguration.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/CloseReason.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/CloseReason.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/CloseReason.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/CloseReason.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,57 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +public class CloseReason {
> +
> + @SuppressWarnings("unused")
> + public CloseReason(CloseReason.CloseCode closeCode, String reasonPhrase) {
> + // FIXME - These need accessors
> + }
> +
> + public interface CloseCode {
> + int getCode();
> + }
> +
> + public enum CloseCodes implements CloseReason.CloseCode {
> +
> + NORMAL_CLOSURE(1000),
> + GOING_AWAY(1001),
> + PROTOCOL_ERROR(1002),
> + CANNOT_ACCEPT(1003),
> + RESERVED(1004),
> + NO_STATUS_CODE(1005),
> + CLOSED_ABNORMALLY(1006),
> + NOT_CONSISTENT(1007),
> + VIOLATED_POLICY(1008),
> + TOO_BIG(1009),
> + NO_EXTENSION(1010),
> + UNEXPECTED_CONDITION(1011),
> + TLS_HANDSHAKE_FAILURE(1015);
> +
> + private int code;
> +
> + CloseCodes(int code) {
> + this.code = code;
> + }
> +
> + @Override
> + public int getCode() {
> + return code;
> + }
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/CloseReason.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/ContainerProvider.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ContainerProvider.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/ContainerProvider.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/ContainerProvider.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,30 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +public class ContainerProvider {
> +
> + public static ServerContainer getServerContainer() {
> + // TODO
> + return null;
> + }
> +
> + public static ClientContainer getClientContainer() {
> + // TODO
> + return null;
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/ContainerProvider.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/DecodeException.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/DecodeException.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/DecodeException.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/DecodeException.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,56 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.nio.ByteBuffer;
> +
> +public class DecodeException extends Exception {
> +
> + private static final long serialVersionUID = 1L;
> +
> + private ByteBuffer bb;
> + private String encodedString;
> +
> + public DecodeException(ByteBuffer bb, String message, Throwable cause) {
> + super(message, cause);
> + this.bb = bb;
> + }
> +
> + public DecodeException(String encodedString, String message,
> + Throwable cause) {
> + super(message, cause);
> + this.encodedString = encodedString;
> + }
> +
> + public DecodeException(ByteBuffer bb, String message) {
> + super(message);
> + this.bb = bb;
> + }
> +
> + public DecodeException(String encodedString, String message) {
> + super(message);
> + this.encodedString = encodedString;
> + }
> +
> + public ByteBuffer getBytes() {
> + return bb;
> + }
> +
> + public String getText() {
> + return encodedString;
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/DecodeException.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/Decoder.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Decoder.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/Decoder.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/Decoder.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,49 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.io.Reader;
> +import java.nio.ByteBuffer;
> +
> +public interface Decoder {
> +
> + interface Binary<T> extends Decoder {
> +
> + T decode(ByteBuffer bytes) throws DecodeException;
> +
> + boolean willDecode(ByteBuffer bytes);
> + }
> +
> + interface BinaryStream<T> extends Decoder {
> +
> + T decode(InputStream is) throws DecodeException, IOException;
> + }
> +
> + interface Text<T> extends Decoder {
> +
> + T decode(String s) throws DecodeException;
> +
> + boolean willDecode(String s);
> + }
> +
> + interface TextStream<T> extends Decoder {
> +
> + T decode(Reader reader) throws DecodeException, IOException;
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/Decoder.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,81 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.net.URI;
> +import java.util.ArrayList;
> +import java.util.List;
> +
> +import javax.net.websocket.extensions.Extension;
> +
> +public class DefaultClientConfiguration implements ClientEndpointConfiguration {
> + private URI uri;
> + private List<String> preferredSubprotocols = new ArrayList<>();
> + private List<Extension> extensions = new ArrayList<>();
> + private List<Encoder> encoders = new ArrayList<>();
> + private List<Decoder> decoders = new ArrayList<>();
> +
> + public DefaultClientConfiguration(URI uri) {
> + this.uri = uri;
> + }
> +
> + public URI getURI() {
> + return uri;
> + }
> +
> + @Override
> + public List<String> getPreferredSubprotocols() {
> + return preferredSubprotocols;
> + }
> +
> + public DefaultClientConfiguration setPreferredSubprotocols(
> + List<String> preferredSubprotocols) {
> + this.preferredSubprotocols = preferredSubprotocols;
> + return this;
> + }
> +
> + @Override
> + public List<Extension> getExtensions() {
> + return extensions;
> + }
> +
> + public ClientEndpointConfiguration setExtensions(
> + List<Extension> extensions) {
> + this.extensions = extensions;
> + return this;
> + }
> +
> + @Override
> + public List<Encoder> getEncoders() {
> + return encoders;
> + }
> +
> + public ClientEndpointConfiguration setEncoders(List<Encoder> encoders) {
> + this.encoders = encoders;
> + return this;
> + }
> +
> + @Override
> + public List<Decoder> getDecoders() {
> + return decoders;
> + }
> +
> + public ClientEndpointConfiguration setDecoders(List<Decoder> decoders) {
> + this.decoders = decoders;
> + return this;
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/DefaultClientConfiguration.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,103 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.net.URI;
> +import java.util.ArrayList;
> +import java.util.List;
> +
> +import javax.net.websocket.extensions.Extension;
> +
> +public class DefaultServerConfiguration implements ServerEndpointConfiguration {
> + private URI uri;
> + private List<String> subprotocols = new ArrayList<>();
> + private List<Extension> extensions = new ArrayList<>();
> + private List<Encoder> encoders = new ArrayList<>();
> + private List<Decoder> decoders = new ArrayList<>();
> +
> + protected DefaultServerConfiguration() {
> + }
> +
> + public DefaultServerConfiguration(URI uri) {
> + this.uri = uri;
> + }
> +
> + public DefaultServerConfiguration setEncoders(List<Encoder> encoders) {
> + this.encoders = encoders;
> + return this;
> + }
> +
> + public DefaultServerConfiguration setDecoders(List<Decoder> decoders) {
> + this.decoders = decoders;
> + return this;
> + }
> +
> + public DefaultServerConfiguration setSubprotocols(
> + List<String> subprotocols) {
> + this.subprotocols = subprotocols;
> + return this;
> + }
> +
> + public DefaultServerConfiguration setExtensions(
> + List<Extension> extensions) {
> + this.extensions = extensions;
> + return this;
> + }
> +
> +
> + @Override
> + public List<Encoder> getEncoders() {
> + return this.encoders;
> + }
> +
> +
> + @Override
> + public List<Decoder> getDecoders() {
> + return this.decoders;
> + }
> +
> + @Override
> + public String getNegotiatedSubprotocol(List<String> requestedSubprotocols) {
> + // TODO
> + return null;
> + }
> +
> +
> + @Override
> + public List<Extension> getNegotiatedExtensions(
> + List<Extension> requestedExtensions) {
> + // TODO
> + return null;
> + }
> +
> + @Override
> + public boolean checkOrigin(String originHeaderValue) {
> + // TODO
> + return false;
> + }
> +
> + @Override
> + public boolean matchesURI(URI uri) {
> + return this.uri.equals(uri);
> + }
> +
> + @Override
> + public void modifyHandshake(HandshakeRequest request,
> + HandshakeResponse response) {
> + // TODO
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/DefaultServerConfiguration.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/EncodeException.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/EncodeException.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/EncodeException.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/EncodeException.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,38 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +public class EncodeException extends Exception {
> +
> + private static final long serialVersionUID = 1L;
> +
> + private Object object;
> +
> + public EncodeException(String message, Object object) {
> + super(message);
> + this.object = object;
> + }
> +
> + public EncodeException(String message, Object object, Throwable cause) {
> + super(message, cause);
> + this.object = object;
> + }
> +
> + public Object getObject() {
> + return this.object;
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/EncodeException.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/Encoder.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Encoder.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/Encoder.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/Encoder.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,47 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.io.IOException;
> +import java.io.OutputStream;
> +import java.io.Writer;
> +import java.nio.ByteBuffer;
> +
> +public interface Encoder {
> +
> + interface Text<T> extends Encoder {
> +
> + String encode(T object) throws EncodeException;
> + }
> +
> + interface TextStream<T> extends Encoder {
> +
> + void encode(T object, Writer writer)
> + throws EncodeException, IOException;
> + }
> +
> + interface Binary<T> extends Encoder {
> +
> + ByteBuffer encode(T object) throws EncodeException;
> + }
> +
> + interface BinaryStream<T> extends Encoder {
> +
> + void encode(T object, OutputStream os)
> + throws EncodeException, IOException;
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/Encoder.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/Endpoint.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Endpoint.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/Endpoint.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/Endpoint.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,47 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +public abstract class Endpoint {
> +
> + /**
> + * Event that is triggered when a new session starts.
> + *
> + * @param session The new session.
> + */
> + public abstract void onOpen(Session<?> session);
> +
> + /**
> + * Event that is triggered when a session has closed.
> + *
> + * @param session The session that has closed
> + * @param closeReason Why the session was closed
> + */
> + public void onClose(Session<?> session, CloseReason closeReason) {
> + // NO-OP by default
> + }
> +
> + /**
> + * Event that is triggered when a protocol error occurs.
> + *
> + * @param throwable The exception
> + * @param session The session that experienced the error
> + */
> + public void onError(Throwable throwable, Session<?> session) {
> + // NO-OP by default
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/Endpoint.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,26 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.util.List;
> +
> +public interface EndpointConfiguration {
> +
> + List<Encoder> getEncoders();
> +
> + List<Decoder> getDecoders();
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/EndpointConfiguration.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,39 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements. See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package javax.net.websocket;
> +
> +import java.net.URI;
> +import java.security.Principal;
> +import java.util.List;
> +import java.util.Map;
> +
> +public interface HandshakeRequest {
> +
> + Map<String,List<String>> getHeaders();
> +
> + Principal getUserPrincipal();
> +
> + URI getRequestURI();
> +
> + boolean isUserInRole(String role);
> +
> + Object getSession();
^^
Shouldn't this return a Session instead ?
> +
> + Map<String, String[]> getParameterMap();
> +
> + String getQueryString();
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/HandshakeRequest.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,25 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.util.List;
> +import java.util.Map;
> +
> +public interface HandshakeResponse {
> +
> + Map<String,List<String>> getHeaders();
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/HandshakeResponse.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/MessageHandler.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/MessageHandler.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/MessageHandler.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/MessageHandler.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,70 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.io.InputStream;
> +import java.io.Reader;
> +import java.nio.ByteBuffer;
> +
> +public interface MessageHandler {
> +
> + interface Text extends MessageHandler {
> +
> + void onMessage(String text);
> + }
> +
> +
> + interface Binary extends MessageHandler {
> +
> + void onMessage(ByteBuffer data);
> + }
> +
> +
> + interface AsyncBinary extends MessageHandler {
> +
> + void onMessagePart(ByteBuffer part, boolean last);
> + }
> +
> +
> + interface AsyncText extends MessageHandler {
> +
> + void onMessagePart(String part, boolean last);
> + }
> +
> +
> + interface DecodedObject<T> extends MessageHandler {
> +
> + void onMessage(T customObject);
> + }
> +
> + interface BinaryStream extends MessageHandler {
> +
> + void onMessage(InputStream is);
> + }
> +
> +
> + interface CharacterStream extends MessageHandler {
> +
> + void onMessage(Reader r);
> + }
> +
> +
> + interface Pong extends MessageHandler {
> +
> + void onPong(ByteBuffer applicationData);
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/MessageHandler.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,52 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.io.IOException;
> +import java.io.OutputStream;
> +import java.io.Writer;
> +import java.nio.ByteBuffer;
> +import java.util.concurrent.Future;
> +
> +
> +public interface RemoteEndpoint<T> {
> +
> + void sendString(String text) throws IOException;
> +
> + void sendBytes(ByteBuffer data) throws IOException;
> +
> + void sendPartialString(String fragment, boolean isLast) throws IOException;
> +
> + void sendPartialBytes(ByteBuffer partialByte, boolean isLast) throws IOException; // or Iterable<byte[]>
> +
> + OutputStream getSendStream() throws IOException;
> +
> + Writer getSendWriter() throws IOException;
> +
> + void sendObject(T o) throws IOException, EncodeException;
> +
> + Future<SendResult> sendString(String text, SendHandler completion);
> +
> + Future<SendResult> sendBytes(ByteBuffer data, SendHandler completion);
> +
> + Future<SendResult> sendObject(T o, SendHandler handler);
> +
> + void sendPing(ByteBuffer applicationData);
> +
> + void sendPong(ByteBuffer applicationData);
> +}
> +
>
> Propchange: tomcat/trunk/java/javax/net/websocket/RemoteEndpoint.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/SendHandler.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/SendHandler.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/SendHandler.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/SendHandler.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +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 javax.net.websocket;
> +
> +public interface SendHandler {
> +
> + void setResult(SendResult result);
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/SendHandler.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/SendResult.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/SendResult.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/SendResult.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/SendResult.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,39 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements. See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package javax.net.websocket;
> +
> +public class SendResult {
> + private Throwable exception;
> + private boolean ok = true;
> +
> + public SendResult(Throwable exception) {
> + this.exception = exception;
> + this.ok = false;
> + }
> +
> + public SendResult() {
> + // NO-OP
> + }
> +
> + public Throwable getException() {
> + return exception;
> + }
> +
> + public boolean isOK() {
> + return ok;
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/SendResult.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/ServerContainer.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ServerContainer.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/ServerContainer.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/ServerContainer.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +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 javax.net.websocket;
> +
> +public interface ServerContainer extends ClientContainer {
> +
> + void publishServer(Endpoint endpoint, ServerEndpointConfiguration ilc);
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/ServerContainer.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,35 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.net.URI;
> +import java.util.List;
> +
> +import javax.net.websocket.extensions.Extension;
> +
> +public interface ServerEndpointConfiguration extends EndpointConfiguration {
> +
> + String getNegotiatedSubprotocol(List<String> requestedSubprotocols);
> +
> + List<Extension> getNegotiatedExtensions(List<Extension> requestedExtensions);
> +
> + boolean checkOrigin(String originHeaderValue);
> +
> + boolean matchesURI(URI uri);
> +
> + void modifyHandshake(HandshakeRequest request, HandshakeResponse response);
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/ServerEndpointConfiguration.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/Session.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/Session.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/Session.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/Session.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,72 @@
> +/*
> + * 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 javax.net.websocket;
> +
> +import java.io.IOException;
> +import java.net.URI;
> +import java.util.List;
> +import java.util.Map;
> +import java.util.Set;
> +
> +import javax.net.websocket.extensions.Extension;
> +
> +public interface Session<T> {
> +
> + ClientContainer getContainer();
> +
> + void setEncoders(List<Encoder> encoders);
> +
> + void addMessageHandler(MessageHandler listener);
> +
> + Set<MessageHandler> getMessageHandlers();
> +
> + void removeMessageHandler(MessageHandler listener);
> +
> + String getProtocolVersion();
> +
> + String getNegotiatedSubprotocol();
> +
> + List<Extension> getNegotiatedExtensions();
> +
> + boolean isSecure();
> +
> + long getInactiveTime();
> +
> + boolean isActive();
> +
> + long getTimeout();
> +
> + void setTimeout(long seconds);
> +
> + void setMaximumMessageSize(long length);
> +
> + long getMaximumMessageSize();
> +
> + RemoteEndpoint<?> getRemote();
> +
> + RemoteEndpoint<T> getRemoteL(Class<T> c);
Is there a typo in the method name ? Is the 'L' needed ?
> +
> + void close() throws IOException;
> +
> + void close(CloseReason closeStatus) throws IOException;
> +
> + URI getRequestURI();
> +
> + Map<String, String[]> getParameterMap();
> +
> + String getQueryString();
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/Session.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,27 @@
> +/*
> + * 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 javax.net.websocket.annotations;
> +
> +import java.lang.annotation.ElementType;
> +import java.lang.annotation.Retention;
> +import java.lang.annotation.RetentionPolicy;
> +import java.lang.annotation.Target;
> +
> +@Retention(RetentionPolicy.RUNTIME)
> +@Target(ElementType.METHOD)
> +public @interface WebSocketClose {
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketClose.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,35 @@
> +/*
> + * 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 javax.net.websocket.annotations;
> +
> +import java.lang.annotation.ElementType;
> +import java.lang.annotation.Retention;
> +import java.lang.annotation.RetentionPolicy;
> +import java.lang.annotation.Target;
> +
> +@Retention(RetentionPolicy.RUNTIME)
> +@Target(ElementType.TYPE)
> +public @interface WebSocketEndpoint {
> +
> + public String value();
> +
> + public String[] subprotocols() default {};
> +
> + public Class<?>[] decoders() default {};
> +
> + public Class<?>[] encoders() default {};
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketEndpoint.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,27 @@
> +/*
> + * 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 javax.net.websocket.annotations;
> +
> +import java.lang.annotation.ElementType;
> +import java.lang.annotation.Retention;
> +import java.lang.annotation.RetentionPolicy;
> +import java.lang.annotation.Target;
> +
> +@Retention(RetentionPolicy.RUNTIME)
> +@Target(ElementType.METHOD)
> +public @interface WebSocketError {
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketError.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +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.
> + */
> +package javax.net.websocket.annotations;
> +
> +import java.lang.annotation.ElementType;
> +import java.lang.annotation.Retention;
> +import java.lang.annotation.RetentionPolicy;
> +import java.lang.annotation.Target;
> +
> +@Retention(RetentionPolicy.RUNTIME)
> +@Target(ElementType.METHOD)
> +public @interface WebSocketMessage {
> + public long maxMessageSize() default -1;
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketMessage.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,27 @@
> +/*
> + * 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 javax.net.websocket.annotations;
> +
> +import java.lang.annotation.ElementType;
> +import java.lang.annotation.Retention;
> +import java.lang.annotation.RetentionPolicy;
> +import java.lang.annotation.Target;
> +
> +@Retention(RetentionPolicy.RUNTIME)
> +@Target(ElementType.METHOD)
> +public @interface WebSocketOpen {
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketOpen.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +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.
> + */
> +package javax.net.websocket.annotations;
> +
> +import java.lang.annotation.ElementType;
> +import java.lang.annotation.Retention;
> +import java.lang.annotation.RetentionPolicy;
> +import java.lang.annotation.Target;
> +
> +@Retention(RetentionPolicy.RUNTIME)
> +@Target(ElementType.METHOD)
> +public @interface WebSocketPathParam {
> + public String value();
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/annotations/WebSocketPathParam.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/extensions/Extension.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/extensions/Extension.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/extensions/Extension.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/extensions/Extension.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,30 @@
> +/*
> + * 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 javax.net.websocket.extensions;
> +
> +import java.util.Map;
> +
> +public interface Extension {
> +
> + String getName();
> +
> + Map<String, String> getParameters();
> +
> + FrameHandler createIncomingFrameHandler(FrameHandler downstream);
> +
> + FrameHandler createOutgoingFrameHandler(FrameHandler upstream);
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/extensions/Extension.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/extensions/Frame.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/extensions/Frame.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/extensions/Frame.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/extensions/Frame.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,67 @@
> +/*
> + * 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 javax.net.websocket.extensions;
> +
> +import javax.net.websocket.CloseReason;
> +
> +public interface Frame {
> +
> + interface Data extends Frame {
> +
> + byte[] getExtensionData();
> +
> + interface Text extends Frame.Data {
> +
> + String getText();
> +
> + interface Continuation extends Frame.Data.Text {
> +
> + boolean isLast();
> + }
> + }
> +
> + interface Binary extends Frame.Data {
> +
> + byte[] getData();
> +
> + interface Continuation extends Frame.Data.Binary {
> +
> + boolean isLast();
> + }
> + }
> + }
> +
> + interface Control extends Frame {
> +
> + interface Ping extends Frame.Control {
> +
> + byte[] getApplicationData();
> + }
> +
> + interface Pong extends Frame.Control {
> +
> + byte[] getApplicationData();
> + }
> +
> + interface Close extends Frame.Control {
> +
> + String getReasonPhrase();
> +
> + CloseReason.CloseCode getCloseCode();
> + }
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/extensions/Frame.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,49 @@
> +/*
> + * 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 javax.net.websocket.extensions;
> +
> +import java.nio.ByteBuffer;
> +
> +public class FrameBuilder {
> +
> + public static FrameBuilder getBuilder() {
> + // TODO
> + return null;
> + }
> +
> + public Frame.Data.Text createTextFrame(String s) {
> + // TODO
> + return null;
> + }
> +
> + public Frame.Data.Text.Continuation createTextContinuationFrame(
> + String s, boolean isLast) {
> + // TODO
> + return null;
> + }
> +
> + public Frame.Data.Binary createBinaryFrame(ByteBuffer bb) {
> + // TODO
> + return null;
> + }
> +
> + public Frame.Data.Binary.Continuation createBinaryContinuationFrame(
> + ByteBuffer bb, boolean isLast) {
> + // TODO
> + return null;
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/extensions/FrameBuilder.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java?rev=1397522&view=auto
> ==============================================================================
> --- tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java (added)
> +++ tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java Fri Oct 12 11:47:53 2012
> @@ -0,0 +1,33 @@
> +/*
> + * 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 javax.net.websocket.extensions;
> +
> +public abstract class FrameHandler {
> + private FrameHandler nextHandler;
> +
> + public FrameHandler(FrameHandler nextHandler) {
> + this.nextHandler = nextHandler;
> + }
> +
> + public FrameHandler getNextHandler() {
> + return this.nextHandler;
> + }
> +
> + public void handleFrame(Frame f) {
> + this.nextHandler.handleFrame(f);
> + }
> +}
>
> Propchange: tomcat/trunk/java/javax/net/websocket/extensions/FrameHandler.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org