2 * Copyright © 2019 FRINX s.r.o. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.restconf.nb.rfc8040.streams;
10 import java.io.IOException;
11 import java.io.NotSerializableException;
12 import java.io.ObjectInputStream;
13 import java.io.ObjectOutputStream;
14 import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
15 import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
16 import org.opendaylight.restconf.server.spi.RestconfStream;
19 * Web-socket servlet listening on ws or wss schemas for created data-change-event or notification streams.
21 @Deprecated(since = "7.0.0", forRemoval = true)
22 final class WebSocketInitializer extends WebSocketServlet {
24 private static final long serialVersionUID = 1L;
26 private final transient WebSocketFactory creator;
27 private final int idleTimeoutMillis;
29 WebSocketInitializer(final String restconf, final RestconfStream.Registry streamRegistry,
30 final PingExecutor pingExecutor, final StreamsConfiguration configuration) {
31 creator = new WebSocketFactory(restconf, streamRegistry, pingExecutor,
32 configuration.maximumFragmentLength(), configuration.heartbeatInterval());
33 idleTimeoutMillis = configuration.idleTimeout();
37 * Configuration of the web-socket factory - idle timeout and specified factory object.
39 * @param factory Configurable web-socket factory.
42 public void configure(final WebSocketServletFactory factory) {
43 factory.getPolicy().setIdleTimeout(idleTimeoutMillis);
44 factory.setCreator(creator);
48 @SuppressWarnings("static-method")
49 private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
54 @SuppressWarnings("static-method")
55 private void writeObject(final ObjectOutputStream out) throws IOException {
59 private static void throwNSE() throws NotSerializableException {
60 throw new NotSerializableException(WebSocketInitializer.class.getName());