use of org.eclipse.jetty.websocket.jsr356.endpoints.JsrEndpointEventDriver in project jetty.project by eclipse.
the class JsrServerExtendsEndpointImpl method create.
@Override
public EventDriver create(Object websocket, WebSocketPolicy policy) {
if (!(websocket instanceof EndpointInstance)) {
throw new IllegalStateException(String.format("Websocket %s must be an %s", websocket.getClass().getName(), EndpointInstance.class.getName()));
}
EndpointInstance ei = (EndpointInstance) websocket;
JsrEndpointEventDriver driver = new JsrEndpointEventDriver(policy, ei);
ServerEndpointConfig config = (ServerEndpointConfig) ei.getConfig();
if (config instanceof PathParamServerEndpointConfig) {
PathParamServerEndpointConfig ppconfig = (PathParamServerEndpointConfig) config;
driver.setPathParameters(ppconfig.getPathParamMap());
}
return driver;
}
use of org.eclipse.jetty.websocket.jsr356.endpoints.JsrEndpointEventDriver in project jetty.project by eclipse.
the class JsrSessionTest method initSession.
@Before
public void initSession() {
container = new ClientContainer();
String id = JsrSessionTest.class.getSimpleName();
URI requestURI = URI.create("ws://localhost/" + id);
WebSocketPolicy policy = WebSocketPolicy.newClientPolicy();
ClientEndpointConfig config = new EmptyClientEndpointConfig();
DummyEndpoint websocket = new DummyEndpoint();
SimpleEndpointMetadata metadata = new SimpleEndpointMetadata(websocket.getClass());
// Executor executor = null;
EndpointInstance ei = new EndpointInstance(websocket, config, metadata);
EventDriver driver = new JsrEndpointEventDriver(policy, ei);
DummyConnection connection = new DummyConnection();
session = new JsrSession(container, id, requestURI, driver, connection);
}
Aggregations