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/12/05 23:52:45 UTC
svn commit: r1417685 - in
/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo:
EchoEndpoint.java EchoEndpointConfiguration.java WsConfigListener.java
Author: markt
Date: Wed Dec 5 22:52:44 2012
New Revision: 1417685
URL: http://svn.apache.org/viewvc?rev=1417685&view=rev
Log:
Update Echo example for API changes
Added:
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpointConfiguration.java (with props)
Modified:
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpoint.java
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java
Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpoint.java?rev=1417685&r1=1417684&r2=1417685&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpoint.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpoint.java Wed Dec 5 22:52:44 2012
@@ -18,30 +18,12 @@ package websocket.echo;
import java.io.IOException;
-import javax.websocket.DefaultServerConfiguration;
import javax.websocket.Endpoint;
-import javax.websocket.EndpointConfiguration;
import javax.websocket.RemoteEndpoint;
-import javax.websocket.ServerEndpointConfiguration;
import javax.websocket.Session;
public class EchoEndpoint extends Endpoint{
- private static ServerEndpointConfiguration config =
- new DefaultServerConfiguration("/websocket/echoProgrammatic") {
-
- @Override
- public boolean checkOrigin(String originHeaderValue) {
- // Accept any
- return true;
- }
- };
-
- @Override
- public EndpointConfiguration getEndpointConfiguration() {
- return config;
- }
-
@Override
public void onOpen(Session session) {
RemoteEndpoint remoteEndpoint = session.getRemote();
Added: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpointConfiguration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpointConfiguration.java?rev=1417685&view=auto
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpointConfiguration.java (added)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpointConfiguration.java Wed Dec 5 22:52:44 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 websocket.echo;
+
+import javax.websocket.DefaultServerConfiguration;
+import javax.websocket.EndpointFactory;
+
+public class EchoEndpointConfiguration
+ extends DefaultServerConfiguration<EchoEndpoint> {
+
+ @Override
+ public boolean checkOrigin(String originHeaderValue) {
+ // No origin checks
+ return true;
+ }
+
+
+ @Override
+ public String getPath() {
+ return "/websocket/echoProgrammatic";
+ }
+
+
+ private static final EndpointFactory<EchoEndpoint> factory =
+ new EchoEndpointFactory();
+
+
+ @Override
+ public EndpointFactory<EchoEndpoint> getEndpointFactory() {
+ return factory;
+ }
+
+
+ private static class EchoEndpointFactory implements
+ EndpointFactory<EchoEndpoint> {
+
+ @Override
+ public EchoEndpoint createEndpoint() {
+ return new EchoEndpoint();
+ }
+ }
+}
Propchange: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpointConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java?rev=1417685&r1=1417684&r2=1417685&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java Wed Dec 5 22:52:44 2012
@@ -33,7 +33,7 @@ public class WsConfigListener implements
(ServerContainerImpl) ContainerProvider.getServerContainer();
sc.setServletContext(sce.getServletContext());
try {
- sc.publishServer(EchoEndpoint.class);
+ sc.publishServer(EchoEndpointConfiguration.class);
} catch (DeploymentException e) {
throw new IllegalStateException(e);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org