mirror of
https://github.com/jetty/jetty.project.git
synced 2025-02-28 19:09:10 +00:00
Initial pass at fixing build for websocket PFD
This commit is contained in:
parent
8ec9ac4d64
commit
96df602e9e
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||
<artifactId>websocket-parent</artifactId>
|
||||
<version>9.0.0-SNAPSHOT</version>
|
||||
<version>9.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -24,7 +24,7 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.drafts</groupId>
|
||||
<artifactId>javax.websocket-client-api</artifactId>
|
||||
<version>0.0.012.draft-SNAPSHOT</version>
|
||||
<version>1.0.0.PFD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
|
@ -18,19 +18,21 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.websocket.ClientEndpointConfiguration;
|
||||
import javax.websocket.ClientEndpointConfig;
|
||||
import javax.websocket.DeploymentException;
|
||||
import javax.websocket.Endpoint;
|
||||
import javax.websocket.Extension;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketContainer;
|
||||
|
||||
public class JettyWebSocketContainer implements WebSocketContainer
|
||||
{
|
||||
@Override
|
||||
public Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointConfiguration cec, URI path) throws DeploymentException
|
||||
public Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointConfig cec, URI path) throws DeploymentException, IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
@ -43,6 +45,20 @@ public class JettyWebSocketContainer implements WebSocketContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, URI path) throws DeploymentException, IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session connectToServer(Object annotatedEndpointInstance, URI path) throws DeploymentException, IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDefaultAsyncSendTimeout()
|
||||
{
|
||||
@ -57,6 +73,13 @@ public class JettyWebSocketContainer implements WebSocketContainer
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDefaultMaxSessionIdleTimeout()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultMaxTextMessageBufferSize()
|
||||
{
|
||||
@ -65,19 +88,12 @@ public class JettyWebSocketContainer implements WebSocketContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getInstalledExtensions()
|
||||
public Set<Extension> getInstalledExtensions()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxSessionIdleTimeout()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsyncSendTimeout(long timeoutmillis)
|
||||
{
|
||||
@ -92,24 +108,17 @@ public class JettyWebSocketContainer implements WebSocketContainer
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultMaxSessionIdleTimeout(long timeout)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultMaxTextMessageBufferSize(int max)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxSessionIdleTimeout(long timeout)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxTextMessageBufferSize(long max)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,122 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.websocket.RemoteEndpoint;
|
||||
import javax.websocket.SendHandler;
|
||||
|
||||
public class JsrAsyncRemote implements RemoteEndpoint.Async
|
||||
{
|
||||
|
||||
private final org.eclipse.jetty.websocket.api.RemoteEndpoint jettyRemote;
|
||||
|
||||
protected JsrAsyncRemote(org.eclipse.jetty.websocket.api.RemoteEndpoint endpoint)
|
||||
{
|
||||
this.jettyRemote = endpoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBatch() throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBatchingAllowed()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSendTimeout()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Void> sendBinary(ByteBuffer data)
|
||||
{
|
||||
return jettyRemote.sendBytesByFuture(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBinary(ByteBuffer data, SendHandler handler)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Void> sendObject(Object data)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendObject(Object data, SendHandler handler)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPing(ByteBuffer applicationData) throws IOException, IllegalArgumentException
|
||||
{
|
||||
jettyRemote.sendPing(applicationData);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPong(ByteBuffer applicationData) throws IOException, IllegalArgumentException
|
||||
{
|
||||
jettyRemote.sendPong(applicationData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Void> sendText(String text)
|
||||
{
|
||||
return jettyRemote.sendStringByFuture(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendText(String text, SendHandler handler)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchingAllowed(boolean allowed) throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSendTimeout(long timeoutmillis)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
@ -22,18 +22,15 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.websocket.EncodeException;
|
||||
import javax.websocket.RemoteEndpoint;
|
||||
import javax.websocket.SendHandler;
|
||||
import javax.websocket.SendResult;
|
||||
|
||||
public class JsrRemoteEndpoint implements RemoteEndpoint
|
||||
public class JsrBasicRemote implements RemoteEndpoint.Basic
|
||||
{
|
||||
private final org.eclipse.jetty.websocket.api.RemoteEndpoint jettyRemote;
|
||||
|
||||
protected JsrRemoteEndpoint(org.eclipse.jetty.websocket.api.RemoteEndpoint endpoint)
|
||||
protected JsrBasicRemote(org.eclipse.jetty.websocket.api.RemoteEndpoint endpoint)
|
||||
{
|
||||
this.jettyRemote = endpoint;
|
||||
}
|
||||
@ -42,14 +39,6 @@ public class JsrRemoteEndpoint implements RemoteEndpoint
|
||||
public void flushBatch() throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAsyncSendTimeout()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -74,22 +63,16 @@ public class JsrRemoteEndpoint implements RemoteEndpoint
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBytes(ByteBuffer data) throws IOException
|
||||
{
|
||||
jettyRemote.sendBytes(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBytesByCompletion(ByteBuffer data, SendHandler completion)
|
||||
public void sendBinary(ByteBuffer data) throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<SendResult> sendBytesByFuture(ByteBuffer data)
|
||||
public void sendBinary(ByteBuffer partialByte, boolean isLast) throws IOException
|
||||
{
|
||||
Future<Void> jettyFuture = jettyRemote.sendBytesByFuture(data);
|
||||
return new JsrSendResultFuture(jettyFuture);
|
||||
jettyRemote.sendPartialBytes(partialByte,isLast);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,32 +82,6 @@ public class JsrRemoteEndpoint implements RemoteEndpoint
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendObjectByCompletion(Object o, SendHandler handler)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<SendResult> sendObjectByFuture(Object o)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPartialBytes(ByteBuffer partialByte, boolean isLast) throws IOException
|
||||
{
|
||||
jettyRemote.sendPartialBytes(partialByte,isLast);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPartialString(String partialMessage, boolean isLast) throws IOException
|
||||
{
|
||||
jettyRemote.sendPartialString(partialMessage,isLast);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPing(ByteBuffer applicationData) throws IOException, IllegalArgumentException
|
||||
{
|
||||
@ -138,30 +95,16 @@ public class JsrRemoteEndpoint implements RemoteEndpoint
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendString(String text) throws IOException
|
||||
{
|
||||
jettyRemote.sendString(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendStringByCompletion(String text, SendHandler completion)
|
||||
public void sendText(String text) throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<SendResult> sendStringByFuture(String text)
|
||||
public void sendText(String partialMessage, boolean isLast) throws IOException
|
||||
{
|
||||
Future<Void> jettyFuture = jettyRemote.sendStringByFuture(text);
|
||||
return new JsrSendResultFuture(jettyFuture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsyncSendTimeout(long timeoutmillis)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
jettyRemote.sendPartialString(partialMessage,isLast);
|
||||
}
|
||||
|
||||
@Override
|
@ -30,14 +30,9 @@ public class JsrContainerProvider extends ContainerProvider
|
||||
websocketContainer = new JettyWebSocketContainer();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected <T> T getContainer(Class<T> containerClass)
|
||||
protected WebSocketContainer getContainer()
|
||||
{
|
||||
if (WebSocketContainer.class.isAssignableFrom(containerClass))
|
||||
{
|
||||
return (T)websocketContainer;
|
||||
}
|
||||
return null;
|
||||
return websocketContainer;
|
||||
}
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import javax.websocket.SendResult;
|
||||
|
||||
public class JsrSendResultFuture implements Future<SendResult>
|
||||
{
|
||||
private final Future<Void> jettyFuture;
|
||||
|
||||
public JsrSendResultFuture(Future<Void> jettyFuture)
|
||||
{
|
||||
this.jettyFuture = jettyFuture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDone()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendResult get() throws InterruptedException, ExecutionException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendResult get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
@ -22,7 +22,6 @@ import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.security.Principal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -30,7 +29,8 @@ import java.util.Set;
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.Extension;
|
||||
import javax.websocket.MessageHandler;
|
||||
import javax.websocket.RemoteEndpoint;
|
||||
import javax.websocket.RemoteEndpoint.Async;
|
||||
import javax.websocket.RemoteEndpoint.Basic;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketContainer;
|
||||
|
||||
@ -45,7 +45,8 @@ public class JsrSession implements Session
|
||||
private final String id;
|
||||
private List<Extension> negotiatedExtensions;
|
||||
private Map<String, List<String>> jsrParameterMap;
|
||||
private JsrRemoteEndpoint remote;
|
||||
private JsrAsyncRemote asyncRemote;
|
||||
private JsrBasicRemote basicRemote;
|
||||
|
||||
protected JsrSession(JettyWebSocketContainer container, WebSocketSession session, String id)
|
||||
{
|
||||
@ -60,12 +61,38 @@ public class JsrSession implements Session
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
jettySession.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(CloseReason closeStatus) throws IOException
|
||||
{
|
||||
jettySession.close(closeStatus.getCloseCode().getCode(),closeStatus.getReasonPhrase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Async getAsyncRemote()
|
||||
{
|
||||
if (asyncRemote == null)
|
||||
{
|
||||
asyncRemote = new JsrAsyncRemote(jettySession.getRemote());
|
||||
}
|
||||
return asyncRemote;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Basic getBasicRemote()
|
||||
{
|
||||
if (basicRemote == null)
|
||||
{
|
||||
basicRemote = new JsrBasicRemote(jettySession.getRemote());
|
||||
}
|
||||
return basicRemote;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketContainer getContainer()
|
||||
{
|
||||
@ -84,6 +111,13 @@ public class JsrSession implements Session
|
||||
return jettySession.getPolicy().getMaxBinaryMessageSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxIdleTimeout()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTextMessageBufferSize()
|
||||
{
|
||||
@ -131,6 +165,12 @@ public class JsrSession implements Session
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocolVersion()
|
||||
{
|
||||
return jettySession.getProtocolVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryString()
|
||||
{
|
||||
@ -149,7 +189,6 @@ public class JsrSession implements Session
|
||||
return jettySession.getUpgradeRequest().getRequestURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimeout()
|
||||
{
|
||||
return jettySession.getIdleTimeout();
|
||||
@ -169,6 +208,18 @@ public class JsrSession implements Session
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpen()
|
||||
{
|
||||
return jettySession.isOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure()
|
||||
{
|
||||
return jettySession.isSecure();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessageHandler(MessageHandler handler)
|
||||
{
|
||||
@ -184,49 +235,21 @@ public class JsrSession implements Session
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxTextMessageBufferSize(int length)
|
||||
public void setMaxIdleTimeout(long milliseconds)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxTextMessageBufferSize(int length)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setTimeout(long milliseconds)
|
||||
{
|
||||
jettySession.setIdleTimeout(milliseconds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
jettySession.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocolVersion()
|
||||
{
|
||||
return jettySession.getProtocolVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteEndpoint getRemote()
|
||||
{
|
||||
if (remote == null)
|
||||
{
|
||||
remote = new JsrRemoteEndpoint(jettySession.getRemote());
|
||||
}
|
||||
return remote;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpen()
|
||||
{
|
||||
return jettySession.isOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure()
|
||||
{
|
||||
return jettySession.isSecure();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.decoders;
|
||||
|
||||
import javax.websocket.Decoder;
|
||||
import javax.websocket.EndpointConfig;
|
||||
|
||||
public class AbstractDecoder implements Decoder
|
||||
{
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(EndpointConfig config)
|
||||
{
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ import javax.websocket.Decoder;
|
||||
* <p>
|
||||
* Note: delegates to {@link Boolean#parseBoolean(String)} and will only support "true" and "false" as boolean values.
|
||||
*/
|
||||
public class BooleanDecoder implements Decoder.Text<Boolean>
|
||||
public class BooleanDecoder extends AbstractDecoder implements Decoder.Text<Boolean>
|
||||
{
|
||||
@Override
|
||||
public Boolean decode(String s) throws DecodeException
|
||||
|
@ -23,7 +23,7 @@ import java.nio.ByteBuffer;
|
||||
import javax.websocket.DecodeException;
|
||||
import javax.websocket.Decoder;
|
||||
|
||||
public class ByteBufferDecoder implements Decoder.Binary<ByteBuffer>
|
||||
public class ByteBufferDecoder extends AbstractDecoder implements Decoder.Binary<ByteBuffer>
|
||||
{
|
||||
@Override
|
||||
public ByteBuffer decode(ByteBuffer bytes) throws DecodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Decoder;
|
||||
/**
|
||||
* Default implementation of the {@link Text} Message to {@link Byte} decoder
|
||||
*/
|
||||
public class ByteDecoder implements Decoder.Text<Byte>
|
||||
public class ByteDecoder extends AbstractDecoder implements Decoder.Text<Byte>
|
||||
{
|
||||
@Override
|
||||
public Byte decode(String s) throws DecodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Decoder;
|
||||
/**
|
||||
* Default implementation of the {@link Text} Message to {@link Character} decoder
|
||||
*/
|
||||
public class CharacterDecoder implements Decoder.Text<Character>
|
||||
public class CharacterDecoder extends AbstractDecoder implements Decoder.Text<Character>
|
||||
{
|
||||
@Override
|
||||
public Character decode(String s) throws DecodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Decoder;
|
||||
/**
|
||||
* Default implementation of the {@link Text} Message to {@link Double} to decoder
|
||||
*/
|
||||
public class DoubleDecoder implements Decoder.Text<Double>
|
||||
public class DoubleDecoder extends AbstractDecoder implements Decoder.Text<Double>
|
||||
{
|
||||
@Override
|
||||
public Double decode(String s) throws DecodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Decoder;
|
||||
/**
|
||||
* Default implementation of the Text Message to {@link Float} decoder
|
||||
*/
|
||||
public class FloatDecoder implements Decoder.Text<Float>
|
||||
public class FloatDecoder extends AbstractDecoder implements Decoder.Text<Float>
|
||||
{
|
||||
@Override
|
||||
public Float decode(String s) throws DecodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Decoder;
|
||||
/**
|
||||
* Default implementation of the {@link Text} Message to {@link Integer} decoder
|
||||
*/
|
||||
public class IntegerDecoder implements Decoder.Text<Integer>
|
||||
public class IntegerDecoder extends AbstractDecoder implements Decoder.Text<Integer>
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Decoder;
|
||||
/**
|
||||
* Default implementation of the Text Message to {@link Long} decoder
|
||||
*/
|
||||
public class LongDecoder implements Decoder.Text<Long>
|
||||
public class LongDecoder extends AbstractDecoder implements Decoder.Text<Long>
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Decoder;
|
||||
/**
|
||||
* Default implementation of the {@link Text} Message to {@link Short} decoder
|
||||
*/
|
||||
public class ShortDecoder implements Decoder.Text<Short>
|
||||
public class ShortDecoder extends AbstractDecoder implements Decoder.Text<Short>
|
||||
{
|
||||
@Override
|
||||
public Short decode(String s) throws DecodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Decoder;
|
||||
/**
|
||||
* Default implementation of the {@link Text} Message to {@link String} decoder
|
||||
*/
|
||||
public class StringDecoder implements Decoder.Text<String>
|
||||
public class StringDecoder extends AbstractDecoder implements Decoder.Text<String>
|
||||
{
|
||||
@Override
|
||||
public String decode(String s) throws DecodeException
|
||||
|
@ -0,0 +1,35 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.encoders;
|
||||
|
||||
import javax.websocket.Encoder;
|
||||
import javax.websocket.EndpointConfig;
|
||||
|
||||
public abstract class AbstractEncoder implements Encoder
|
||||
{
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(EndpointConfig config)
|
||||
{
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ import javax.websocket.Encoder;
|
||||
/**
|
||||
* Default encoder for {@link Boolean} to {@link Text} Message encoder
|
||||
*/
|
||||
public class BooleanEncoder implements Encoder.Text<Boolean>
|
||||
public class BooleanEncoder extends AbstractEncoder implements Encoder.Text<Boolean>
|
||||
{
|
||||
@Override
|
||||
public String encode(Boolean object) throws EncodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Encoder;
|
||||
/**
|
||||
* Default encoder for {@link Byte} to {@link Text} Message encoder
|
||||
*/
|
||||
public class ByteEncoder implements Encoder.Text<Byte>
|
||||
public class ByteEncoder extends AbstractEncoder implements Encoder.Text<Byte>
|
||||
{
|
||||
@Override
|
||||
public String encode(Byte object) throws EncodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Encoder;
|
||||
/**
|
||||
* Default encoder for {@link Character} to {@link Text} Message encoder
|
||||
*/
|
||||
public class CharacterEncoder implements Encoder.Text<Character>
|
||||
public class CharacterEncoder extends AbstractEncoder implements Encoder.Text<Character>
|
||||
{
|
||||
@Override
|
||||
public String encode(Character object) throws EncodeException
|
||||
|
@ -23,7 +23,7 @@ import java.nio.ByteBuffer;
|
||||
import javax.websocket.EncodeException;
|
||||
import javax.websocket.Encoder;
|
||||
|
||||
public class DefaultBinaryEncoder implements Encoder.Binary<ByteBuffer>
|
||||
public class DefaultBinaryEncoder extends AbstractEncoder implements Encoder.Binary<ByteBuffer>
|
||||
{
|
||||
@Override
|
||||
public ByteBuffer encode(ByteBuffer message) throws EncodeException
|
||||
|
@ -27,7 +27,7 @@ import javax.websocket.Encoder;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
|
||||
public class DefaultBinaryStreamEncoder implements Encoder.BinaryStream<ByteBuffer>
|
||||
public class DefaultBinaryStreamEncoder extends AbstractEncoder implements Encoder.BinaryStream<ByteBuffer>
|
||||
{
|
||||
@Override
|
||||
public void encode(ByteBuffer message, OutputStream out) throws EncodeException, IOException
|
||||
|
@ -21,7 +21,7 @@ package org.eclipse.jetty.websocket.jsr356.encoders;
|
||||
import javax.websocket.EncodeException;
|
||||
import javax.websocket.Encoder;
|
||||
|
||||
public class DefaultTextEncoder implements Encoder.Text<String>
|
||||
public class DefaultTextEncoder extends AbstractEncoder implements Encoder.Text<String>
|
||||
{
|
||||
@Override
|
||||
public String encode(String message) throws EncodeException
|
||||
|
@ -24,7 +24,7 @@ import java.io.Writer;
|
||||
import javax.websocket.EncodeException;
|
||||
import javax.websocket.Encoder;
|
||||
|
||||
public class DefaultTextStreamEncoder implements Encoder.TextStream<String>
|
||||
public class DefaultTextStreamEncoder extends AbstractEncoder implements Encoder.TextStream<String>
|
||||
{
|
||||
@Override
|
||||
public void encode(String message, Writer writer) throws EncodeException, IOException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Encoder;
|
||||
/**
|
||||
* Default encoder for {@link Double} to {@link Text} Message encoder
|
||||
*/
|
||||
public class DoubleEncoder implements Encoder.Text<Double>
|
||||
public class DoubleEncoder extends AbstractEncoder implements Encoder.Text<Double>
|
||||
{
|
||||
@Override
|
||||
public String encode(Double object) throws EncodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Encoder;
|
||||
/**
|
||||
* Default encoder for {@link Float} to {@link Text} Message encoder
|
||||
*/
|
||||
public class FloatEncoder implements Encoder.Text<Float>
|
||||
public class FloatEncoder extends AbstractEncoder implements Encoder.Text<Float>
|
||||
{
|
||||
@Override
|
||||
public String encode(Float object) throws EncodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Encoder;
|
||||
/**
|
||||
* Default encoder for {@link Integer} to {@link Text} Message encoder
|
||||
*/
|
||||
public class IntegerEncoder implements Encoder.Text<Integer>
|
||||
public class IntegerEncoder extends AbstractEncoder implements Encoder.Text<Integer>
|
||||
{
|
||||
@Override
|
||||
public String encode(Integer object) throws EncodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Encoder;
|
||||
/**
|
||||
* Default encoder for {@link Long} to {@link Text} Message encoder
|
||||
*/
|
||||
public class LongEncoder implements Encoder.Text<Long>
|
||||
public class LongEncoder extends AbstractEncoder implements Encoder.Text<Long>
|
||||
{
|
||||
@Override
|
||||
public String encode(Long object) throws EncodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Encoder;
|
||||
/**
|
||||
* Default encoder for {@link Short} to {@link Text} Message encoder
|
||||
*/
|
||||
public class ShortEncoder implements Encoder.Text<Short>
|
||||
public class ShortEncoder extends AbstractEncoder implements Encoder.Text<Short>
|
||||
{
|
||||
@Override
|
||||
public String encode(Short object) throws EncodeException
|
||||
|
@ -24,7 +24,7 @@ import javax.websocket.Encoder;
|
||||
/**
|
||||
* Default encoder for {@link String} to {@link Text} Message encoder
|
||||
*/
|
||||
public class StringEncoder implements Encoder.Text<String>
|
||||
public class StringEncoder extends AbstractEncoder implements Encoder.Text<String>
|
||||
{
|
||||
@Override
|
||||
public String encode(String object) throws EncodeException
|
||||
|
@ -20,7 +20,7 @@ package org.eclipse.jetty.websocket.jsr356.endpoints;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
|
||||
import org.eclipse.jetty.websocket.api.InvalidWebSocketException;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
||||
@ -28,7 +28,7 @@ import org.eclipse.jetty.websocket.common.events.EventDriver;
|
||||
import org.eclipse.jetty.websocket.common.events.EventDriverImpl;
|
||||
|
||||
/**
|
||||
* {@link EventDriverImpl} for {@link WebSocketClient @WebSocketClient} annotated classes
|
||||
* {@link EventDriverImpl} for {@link ClientEndpoint @ClientEndpoint} annotated classes
|
||||
*/
|
||||
public class JsrAnnotatedClientImpl implements EventDriverImpl
|
||||
{
|
||||
@ -39,10 +39,10 @@ public class JsrAnnotatedClientImpl implements EventDriverImpl
|
||||
{
|
||||
Class<?> websocketClass = websocket.getClass();
|
||||
|
||||
WebSocketClient wsclient = websocketClass.getAnnotation(WebSocketClient.class);
|
||||
ClientEndpoint wsclient = websocketClass.getAnnotation(ClientEndpoint.class);
|
||||
if (wsclient == null)
|
||||
{
|
||||
throw new InvalidWebSocketException("Cannot handle @WebSocketClient annotations here");
|
||||
throw new InvalidWebSocketException("Cannot handle @ClientEndpoint annotations here");
|
||||
}
|
||||
|
||||
JsrAnnotatedMetadata metadata = cache.get(websocketClass);
|
||||
@ -59,12 +59,12 @@ public class JsrAnnotatedClientImpl implements EventDriverImpl
|
||||
@Override
|
||||
public String describeRule()
|
||||
{
|
||||
return "class annotated with @" + WebSocketClient.class.getName();
|
||||
return "class annotated with @" + ClientEndpoint.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Object websocket)
|
||||
{
|
||||
return (websocket.getClass().getAnnotation(WebSocketClient.class) != null);
|
||||
return (websocket.getClass().getAnnotation(ClientEndpoint.class) != null);
|
||||
}
|
||||
}
|
||||
|
@ -21,14 +21,14 @@ package org.eclipse.jetty.websocket.jsr356.endpoints;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.EndpointConfiguration;
|
||||
import javax.websocket.EndpointConfig;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.OnError;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.OnOpen;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketClose;
|
||||
import javax.websocket.WebSocketError;
|
||||
import javax.websocket.WebSocketMessage;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
@ -42,7 +42,7 @@ import org.eclipse.jetty.websocket.jsr356.encoders.Encoders;
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.JsrMethodParameters.Param;
|
||||
|
||||
/**
|
||||
* Scanner for javax.websocket {@link WebSocketEndpoint @WebSocketEndpoint} and {@link WebSocketClient @WebSocketClient} annotated websockets
|
||||
* Scanner for javax.websocket {@link WebSocketEndpoint @WebSocketEndpoint} and {@link ClientEndpoint @ClientEndpoint} annotated websockets
|
||||
*/
|
||||
public class JsrAnnotatedClientScanner extends AbstractMethodAnnotationScanner<JsrAnnotatedMetadata>
|
||||
{
|
||||
@ -56,7 +56,7 @@ public class JsrAnnotatedClientScanner extends AbstractMethodAnnotationScanner<J
|
||||
{
|
||||
validOpenParams = new ParamList();
|
||||
validOpenParams.addParams(Session.class);
|
||||
validOpenParams.addParams(EndpointConfiguration.class);
|
||||
validOpenParams.addParams(EndpointConfig.class);
|
||||
|
||||
validCloseParams = new ParamList();
|
||||
validCloseParams.addParams(Session.class);
|
||||
@ -76,10 +76,10 @@ public class JsrAnnotatedClientScanner extends AbstractMethodAnnotationScanner<J
|
||||
{
|
||||
this.pojo = websocket;
|
||||
|
||||
WebSocketClient anno = websocket.getAnnotation(WebSocketClient.class);
|
||||
ClientEndpoint anno = websocket.getAnnotation(ClientEndpoint.class);
|
||||
if (anno == null)
|
||||
{
|
||||
throw new InvalidWebSocketException("Unsupported WebSocket object, missing @" + WebSocketClient.class + " annotation");
|
||||
throw new InvalidWebSocketException("Unsupported WebSocket object, missing @" + ClientEndpoint.class + " annotation");
|
||||
}
|
||||
|
||||
this.encoders = new Encoders(anno.encoders());
|
||||
@ -145,37 +145,37 @@ public class JsrAnnotatedClientScanner extends AbstractMethodAnnotationScanner<J
|
||||
{
|
||||
LOG.debug("onMethodAnnotation({}, {}, {}, {})",metadata,pojo,method,annotation);
|
||||
|
||||
if (isAnnotation(annotation,WebSocketOpen.class))
|
||||
if (isAnnotation(annotation,OnOpen.class))
|
||||
{
|
||||
assertIsPublicNonStatic(method);
|
||||
assertIsReturn(method,Void.TYPE);
|
||||
assertValidJsrSignature(method,WebSocketOpen.class,validOpenParams);
|
||||
assertUnset(metadata.onOpen,WebSocketOpen.class,method);
|
||||
assertValidJsrSignature(method,OnOpen.class,validOpenParams);
|
||||
assertUnset(metadata.onOpen,OnOpen.class,method);
|
||||
metadata.onOpen = new CallableMethod(pojo,method);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAnnotation(annotation,WebSocketClose.class))
|
||||
if (isAnnotation(annotation,OnClose.class))
|
||||
{
|
||||
assertIsPublicNonStatic(method);
|
||||
assertIsReturn(method,Void.TYPE);
|
||||
assertValidJsrSignature(method,WebSocketClose.class,validCloseParams);
|
||||
assertUnset(metadata.onClose,WebSocketClose.class,method);
|
||||
assertValidJsrSignature(method,OnClose.class,validCloseParams);
|
||||
assertUnset(metadata.onClose,OnClose.class,method);
|
||||
metadata.onClose = new CallableMethod(pojo,method);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAnnotation(annotation,WebSocketError.class))
|
||||
if (isAnnotation(annotation,OnError.class))
|
||||
{
|
||||
assertIsPublicNonStatic(method);
|
||||
assertIsReturn(method,Void.TYPE);
|
||||
assertValidJsrSignature(method,WebSocketError.class,validErrorParams);
|
||||
assertUnset(metadata.onError,WebSocketError.class,method);
|
||||
assertValidJsrSignature(method,OnError.class,validErrorParams);
|
||||
assertUnset(metadata.onError,OnError.class,method);
|
||||
metadata.onError = new CallableMethod(pojo,method);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAnnotation(annotation,WebSocketMessage.class))
|
||||
if (isAnnotation(annotation,OnMessage.class))
|
||||
{
|
||||
assertIsPublicNonStatic(method);
|
||||
|
||||
@ -183,7 +183,7 @@ public class JsrAnnotatedClientScanner extends AbstractMethodAnnotationScanner<J
|
||||
if (callable.isTextFormat())
|
||||
{
|
||||
// TEXT
|
||||
assertUnset(metadata.onText,WebSocketMessage.class,method);
|
||||
assertUnset(metadata.onText,OnMessage.class,method);
|
||||
metadata.onText = callable;
|
||||
return;
|
||||
}
|
||||
@ -191,7 +191,7 @@ public class JsrAnnotatedClientScanner extends AbstractMethodAnnotationScanner<J
|
||||
if (callable.isBinaryFormat())
|
||||
{
|
||||
// BINARY
|
||||
assertUnset(metadata.onBinary,WebSocketMessage.class,method);
|
||||
assertUnset(metadata.onBinary,OnMessage.class,method);
|
||||
metadata.onBinary = callable;
|
||||
return;
|
||||
}
|
||||
@ -199,7 +199,7 @@ public class JsrAnnotatedClientScanner extends AbstractMethodAnnotationScanner<J
|
||||
if (callable.isPongFormat())
|
||||
{
|
||||
// PONG
|
||||
assertUnset(metadata.onPong,WebSocketMessage.class,method);
|
||||
assertUnset(metadata.onPong,OnMessage.class,method);
|
||||
metadata.onPong = callable;
|
||||
return;
|
||||
}
|
||||
|
@ -18,10 +18,10 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints;
|
||||
|
||||
import javax.websocket.WebSocketClose;
|
||||
import javax.websocket.WebSocketError;
|
||||
import javax.websocket.WebSocketMessage;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.OnError;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.OnOpen;
|
||||
|
||||
import org.eclipse.jetty.websocket.common.events.annotated.CallableMethod;
|
||||
|
||||
@ -31,27 +31,27 @@ import org.eclipse.jetty.websocket.common.events.annotated.CallableMethod;
|
||||
public class JsrAnnotatedMetadata
|
||||
{
|
||||
/**
|
||||
* Callable for @{@link WebSocketOpen} annotation
|
||||
* Callable for @{@link OnOpen} annotation
|
||||
*/
|
||||
public CallableMethod onOpen;
|
||||
/**
|
||||
* Callable for @{@link WebSocketClose} annotation
|
||||
* Callable for @{@link OnClose} annotation
|
||||
*/
|
||||
public CallableMethod onClose;
|
||||
/**
|
||||
* Callable for @{@link WebSocketError} annotation
|
||||
* Callable for @{@link OnError} annotation
|
||||
*/
|
||||
public CallableMethod onError;
|
||||
/**
|
||||
* Callable for @{@link WebSocketMessage} annotation dealing with Text Message Format
|
||||
* Callable for @{@link OnMessage} annotation dealing with Text Message Format
|
||||
*/
|
||||
public CallableMethod onText;
|
||||
/**
|
||||
* Callable for @{@link WebSocketMessage} annotation dealing with Binary Message Format
|
||||
* Callable for @{@link OnMessage} annotation dealing with Binary Message Format
|
||||
*/
|
||||
public CallableMethod onBinary;
|
||||
/**
|
||||
* Callable for @{@link WebSocketMessage} annotation dealing with Pong Message Format
|
||||
* Callable for @{@link OnMessage} annotation dealing with Pong Message Format
|
||||
*/
|
||||
public CallableMethod onPong;
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.websocket.WebSocketClose;
|
||||
import javax.websocket.WebSocketError;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.OnError;
|
||||
import javax.websocket.OnOpen;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
@ -59,13 +59,13 @@ public class JsrAnnotatedClientScanner_InvalidSignaturesTest
|
||||
List<Class<?>[]> data = new ArrayList<>();
|
||||
|
||||
// @formatter:off
|
||||
data.add(new Class<?>[]{ InvalidCloseIntSocket.class, WebSocketClose.class });
|
||||
data.add(new Class<?>[]{ InvalidErrorErrorSocket.class, WebSocketError.class });
|
||||
data.add(new Class<?>[]{ InvalidErrorExceptionSocket.class, WebSocketError.class });
|
||||
data.add(new Class<?>[]{ InvalidErrorIntSocket.class, WebSocketError.class });
|
||||
data.add(new Class<?>[]{ InvalidOpenCloseReasonSocket.class, WebSocketOpen.class });
|
||||
data.add(new Class<?>[]{ InvalidOpenIntSocket.class, WebSocketOpen.class });
|
||||
data.add(new Class<?>[]{ InvalidOpenSessionIntSocket.class, WebSocketOpen.class });
|
||||
data.add(new Class<?>[]{ InvalidCloseIntSocket.class, OnClose.class });
|
||||
data.add(new Class<?>[]{ InvalidErrorErrorSocket.class, OnError.class });
|
||||
data.add(new Class<?>[]{ InvalidErrorExceptionSocket.class, OnError.class });
|
||||
data.add(new Class<?>[]{ InvalidErrorIntSocket.class, OnError.class });
|
||||
data.add(new Class<?>[]{ InvalidOpenCloseReasonSocket.class, OnOpen.class });
|
||||
data.add(new Class<?>[]{ InvalidOpenIntSocket.class, OnOpen.class });
|
||||
data.add(new Class<?>[]{ InvalidOpenSessionIntSocket.class, OnOpen.class });
|
||||
// @formatter:on
|
||||
|
||||
// TODO: invalid return types
|
||||
|
@ -20,15 +20,15 @@ package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketMessage;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnMessage;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicBinaryMessageByteBufferSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketMessage
|
||||
@OnMessage
|
||||
public void onBinary(ByteBuffer data)
|
||||
{
|
||||
addEvent("onBinary(%s)",data);
|
||||
|
@ -18,17 +18,17 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketClose;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicCloseReasonSessionSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketClose
|
||||
@OnClose
|
||||
public void onClose(CloseReason reason, Session session)
|
||||
{
|
||||
addEvent("onClose(%s,%s)",reason,session);
|
||||
|
@ -18,16 +18,16 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketClose;
|
||||
import javax.websocket.OnClose;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicCloseReasonSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketClose
|
||||
@OnClose
|
||||
public void onClose(CloseReason reason)
|
||||
{
|
||||
addEvent("onClose(%s)", reason);
|
||||
|
@ -18,17 +18,17 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketClose;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicCloseSessionReasonSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketClose
|
||||
@OnClose
|
||||
public void onClose(Session session, CloseReason reason)
|
||||
{
|
||||
addEvent("onClose(%s,%s)",session,reason);
|
||||
|
@ -18,15 +18,15 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketClose;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnClose;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicCloseSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketClose
|
||||
@OnClose
|
||||
public void onClose()
|
||||
{
|
||||
addEvent("onClose()");
|
||||
|
@ -18,16 +18,16 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnError;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketError;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicErrorSessionSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketError
|
||||
@OnError
|
||||
public void onError(Session session)
|
||||
{
|
||||
addEvent("onError(%s)",session);
|
||||
|
@ -18,16 +18,16 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnError;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketError;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicErrorSessionThrowableSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketError
|
||||
@OnError
|
||||
public void onError(Session session, Throwable t)
|
||||
{
|
||||
addEvent("onError(%s,%s)",session,t);
|
||||
|
@ -18,15 +18,15 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketError;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnError;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicErrorSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketError
|
||||
@OnError
|
||||
public void onError()
|
||||
{
|
||||
addEvent("onError()");
|
||||
|
@ -18,16 +18,16 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnError;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketError;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicErrorThrowableSessionSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketError
|
||||
@OnError
|
||||
public void onError(Throwable t, Session session)
|
||||
{
|
||||
addEvent("onError(%s,%s)",t,session);
|
||||
|
@ -18,15 +18,15 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketError;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnError;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicErrorThrowableSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketError
|
||||
@OnError
|
||||
public void onError(Throwable t)
|
||||
{
|
||||
addEvent("onError(%s)",t);
|
||||
|
@ -18,18 +18,18 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.OnOpen;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketClose;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicOpenCloseSessionSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketClose
|
||||
@OnClose
|
||||
public void onClose(CloseReason close, Session session)
|
||||
{
|
||||
addEvent("onClose(%s, %s)",close,session);
|
||||
@ -37,7 +37,7 @@ public class BasicOpenCloseSessionSocket extends TrackingSocket
|
||||
closeLatch.countDown();
|
||||
}
|
||||
|
||||
@WebSocketOpen
|
||||
@OnOpen
|
||||
public void onOpen(Session session)
|
||||
{
|
||||
addEvent("onOpen(%s)",session);
|
||||
|
@ -18,22 +18,22 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketClose;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.OnOpen;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicOpenCloseSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketOpen
|
||||
@OnOpen
|
||||
public void onOpen() {
|
||||
openLatch.countDown();
|
||||
}
|
||||
|
||||
@WebSocketClose
|
||||
@OnClose
|
||||
public void onClose(CloseReason close) {
|
||||
this.closeReason = close;
|
||||
closeLatch.countDown();
|
||||
|
@ -18,16 +18,16 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnOpen;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicOpenSessionSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketOpen
|
||||
@OnOpen
|
||||
public void onOpen(Session session)
|
||||
{
|
||||
openLatch.countDown();
|
||||
|
@ -18,15 +18,15 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnOpen;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicOpenSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketOpen
|
||||
@OnOpen
|
||||
public void onOpen()
|
||||
{
|
||||
openLatch.countDown();
|
||||
|
@ -18,16 +18,16 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.PongMessage;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketMessage;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicPongMessageSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketMessage
|
||||
@OnMessage
|
||||
public void onPong(PongMessage pong)
|
||||
{
|
||||
addEvent("onPong(%s)",pong);
|
||||
|
@ -18,15 +18,15 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketMessage;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnMessage;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class BasicTextMessageStringSocket extends TrackingSocket
|
||||
{
|
||||
@WebSocketMessage
|
||||
@OnMessage
|
||||
public void onText(String message)
|
||||
{
|
||||
addEvent("onText(%s)",message);
|
||||
|
@ -18,18 +18,18 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketClose;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnClose;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class InvalidCloseIntSocket extends TrackingSocket
|
||||
{
|
||||
/**
|
||||
* Invalid Close Method Declaration (parameter type int)
|
||||
*/
|
||||
@WebSocketClose
|
||||
@OnClose
|
||||
public void onClose(int statusCode)
|
||||
{
|
||||
closeLatch.countDown();
|
||||
|
@ -18,18 +18,18 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketError;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnError;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class InvalidErrorErrorSocket extends TrackingSocket
|
||||
{
|
||||
/**
|
||||
* Invalid Error Method Declaration (parameter type Error)
|
||||
*/
|
||||
@WebSocketError
|
||||
@OnError
|
||||
public void onError(Error error)
|
||||
{
|
||||
/* no impl */
|
||||
|
@ -18,18 +18,18 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketError;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnError;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class InvalidErrorExceptionSocket extends TrackingSocket
|
||||
{
|
||||
/**
|
||||
* Invalid Error Method Declaration (parameter type Exception)
|
||||
*/
|
||||
@WebSocketError
|
||||
@OnError
|
||||
public void onError(Exception e)
|
||||
{
|
||||
/* no impl */
|
||||
|
@ -18,18 +18,18 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketError;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnError;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class InvalidErrorIntSocket extends TrackingSocket
|
||||
{
|
||||
/**
|
||||
* Invalid Error Method Declaration (parameter type int)
|
||||
*/
|
||||
@WebSocketError
|
||||
@OnError
|
||||
public void onError(int errorCount)
|
||||
{
|
||||
/* no impl */
|
||||
|
@ -18,19 +18,19 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
import javax.websocket.OnOpen;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class InvalidOpenCloseReasonSocket extends TrackingSocket
|
||||
{
|
||||
/**
|
||||
* Invalid Open Method Declaration (parameter type CloseReason)
|
||||
*/
|
||||
@WebSocketOpen
|
||||
@OnOpen
|
||||
public void onOpen(CloseReason reason)
|
||||
{
|
||||
openLatch.countDown();
|
||||
|
@ -18,18 +18,18 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnOpen;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class InvalidOpenIntSocket extends TrackingSocket
|
||||
{
|
||||
/**
|
||||
* Invalid Open Method Declaration (parameter type int)
|
||||
*/
|
||||
@WebSocketOpen
|
||||
@OnOpen
|
||||
public void onOpen(int value)
|
||||
{
|
||||
openLatch.countDown();
|
||||
|
@ -18,19 +18,19 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.OnOpen;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketOpen;
|
||||
|
||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||
|
||||
@WebSocketClient
|
||||
@ClientEndpoint
|
||||
public class InvalidOpenSessionIntSocket extends TrackingSocket
|
||||
{
|
||||
/**
|
||||
* Invalid Open Method Declaration (parameter of type int)
|
||||
*/
|
||||
@WebSocketOpen
|
||||
@OnOpen
|
||||
public void onOpen(Session session, int count)
|
||||
{
|
||||
openLatch.countDown();
|
||||
|
@ -25,6 +25,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import javax.websocket.DecodeException;
|
||||
import javax.websocket.Decoder;
|
||||
import javax.websocket.EndpointConfig;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
|
||||
@ -73,6 +74,11 @@ public class DualDecoder implements Decoder.Text<Fruit>, Decoder.Binary<Fruit>
|
||||
return fruit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
|
||||
private String getUTF8String(ByteBuffer buf)
|
||||
{
|
||||
int strLen = buf.getInt();
|
||||
@ -83,6 +89,11 @@ public class DualDecoder implements Decoder.Text<Fruit>, Decoder.Binary<Fruit>
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(EndpointConfig config)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean willDecode(ByteBuffer bytes)
|
||||
{
|
||||
|
@ -23,6 +23,7 @@ import java.nio.charset.Charset;
|
||||
|
||||
import javax.websocket.EncodeException;
|
||||
import javax.websocket.Encoder;
|
||||
import javax.websocket.EndpointConfig;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
|
||||
@ -32,6 +33,11 @@ public class FruitBinaryEncoder implements Encoder.Binary<Fruit>
|
||||
// the number of bytes to store a string (1 int)
|
||||
public static final int STRLEN_STORAGE = 4;
|
||||
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuffer encode(Fruit fruit) throws EncodeException
|
||||
{
|
||||
@ -49,6 +55,11 @@ public class FruitBinaryEncoder implements Encoder.Binary<Fruit>
|
||||
return buf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(EndpointConfig config)
|
||||
{
|
||||
}
|
||||
|
||||
private void putString(ByteBuffer buf, String str)
|
||||
{
|
||||
buf.putInt(str.length());
|
||||
|
@ -22,6 +22,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.websocket.DecodeException;
|
||||
import javax.websocket.EndpointConfig;
|
||||
|
||||
public class FruitDecoder implements ExtDecoder<Fruit>
|
||||
{
|
||||
@ -44,6 +45,16 @@ public class FruitDecoder implements ExtDecoder<Fruit>
|
||||
return fruit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(EndpointConfig config)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String id)
|
||||
{
|
||||
|
@ -20,12 +20,23 @@ package org.eclipse.jetty.websocket.jsr356.samples;
|
||||
|
||||
import javax.websocket.EncodeException;
|
||||
import javax.websocket.Encoder;
|
||||
import javax.websocket.EndpointConfig;
|
||||
|
||||
public class FruitTextEncoder implements Encoder.Text<Fruit>
|
||||
{
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encode(Fruit fruit) throws EncodeException
|
||||
{
|
||||
return String.format("%s|%s",fruit.name,fruit.color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(EndpointConfig config)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -20,20 +20,21 @@ package org.eclipse.jetty.websocket.jsr356.samples;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.EncodeException;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketClient;
|
||||
import javax.websocket.WebSocketMessage;
|
||||
|
||||
@WebSocketClient(decoders = { DualDecoder.class })
|
||||
@ClientEndpoint(decoders =
|
||||
{ DualDecoder.class })
|
||||
public class IntSocket
|
||||
{
|
||||
@WebSocketMessage
|
||||
@OnMessage
|
||||
public void onInt(Session session, int value)
|
||||
{
|
||||
try
|
||||
{
|
||||
session.getRemote().sendObject(value);
|
||||
session.getBasicRemote().sendObject(value);
|
||||
}
|
||||
catch (IOException | EncodeException e)
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||
<artifactId>websocket-parent</artifactId>
|
||||
<version>9.0.0-SNAPSHOT</version>
|
||||
<version>9.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -24,7 +24,7 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.drafts</groupId>
|
||||
<artifactId>javax.websocket-api</artifactId>
|
||||
<version>0.0.012.draft-SNAPSHOT</version>
|
||||
<version>1.0.0.PFD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
|
@ -192,7 +192,9 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
|
||||
return extensionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* The idle timeout in milliseconds
|
||||
*/
|
||||
@Override
|
||||
public long getIdleTimeout()
|
||||
{
|
||||
@ -362,12 +364,6 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
|
||||
connection.setMaxIdleTimeout(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaximumMessageSize(long length)
|
||||
{
|
||||
this.maximumMessageSize = length;
|
||||
}
|
||||
|
||||
public void setOutgoingHandler(OutgoingFrames outgoing)
|
||||
{
|
||||
this.outgoingHandler = outgoing;
|
||||
|
@ -603,12 +603,6 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
|
||||
this.extensions = extensions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdleTimeout(long ms)
|
||||
{
|
||||
getEndPoint().setIdleTimeout(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputBufferSize(int inputBufferSize)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user