Codota Logo
org.apache.wicket.protocol.ws.api.registry
Code IndexAdd Codota to your IDE (free)

How to use org.apache.wicket.protocol.ws.api.registry

Best Java code snippets using org.apache.wicket.protocol.ws.api.registry (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: apache/wicket

  @Override
  public void removeConnection(Application application, String sessionId, IKey key)
  {
    setConnection(application, sessionId, key, null);
  }
}
origin: theonedev/onedev

public PageKey(String sessionId, Integer pageId) {
  this.sessionId = sessionId;
  this.pageId = new PageIdKey(pageId);
}

origin: theonedev/onedev

protected IKey getRegistryKey()
{
  IKey key;
  if (Strings.isEmpty(resourceName))
  {
    key = new PageIdKey(pageId);
  }
  else
  {
    key = new ResourceNameKey(resourceName);
  }
  return key;
}
origin: com.giffing.wicket.spring.boot.starter/wicket-spring-boot-starter

@Override
public void send(IWebSocketPushMessage event) {
  Application application = Application.get(WicketWebInitializer.WICKET_FILTERNAME);
  WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
  IWebSocketConnectionRegistry connectionRegistry = webSocketSettings.getConnectionRegistry();
  Collection<IWebSocketConnection> connections = connectionRegistry.getConnections(application);
  log.trace("sending event to {} connections", connections.size());
  for (IWebSocketConnection connection : connections) {
    connection.sendMessage(event);
  }
}
origin: org.apache.wicket/wicket-native-websocket-core

@Override
public void onClose(int closeCode, String message)
{
  IKey key = getRegistryKey();
  broadcastMessage(new ClosedMessage(getApplication(), getSessionId(), key));
  connectionRegistry.removeConnection(getApplication(), getSessionId(), key);
}
origin: org.apache.wicket/wicket-native-websocket-core

String sessionId = connection.getSessionId();
IKey key = connection.getKey();
IWebSocketConnection wsConnection = registry.getConnection(application, sessionId, key);
if (wsConnection == null)
origin: theonedev/onedev

@Override
public void run() {
  for (IWebSocketConnection connection: new SimpleWebSocketConnectionRegistry().getConnections(application)) {
    if (connection.isOpen()) {
      try {
        connection.sendMessage(WebSocketManager.KEEP_ALIVE);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
}

origin: theonedev/onedev

@Override
public void start() {
  scheduledExecutorService.scheduleWithFixedDelay(new Runnable() {
    @Override
    public void run() {
      for (IWebSocketConnection connection: new SimpleWebSocketConnectionRegistry().getConnections(application)) {
        if (connection.isOpen()) {
          try {
            connection.sendMessage(WebSocketManager.KEEP_ALIVE);
          } catch (IOException e) {
            throw new RuntimeException(e);
          }
        }
      }
    }
    
  }, 0, webSocketPolicy.getIdleTimeout()/2, TimeUnit.MILLISECONDS);
}
origin: MarcGiffing/wicket-spring-boot

@Override
public void send(IWebSocketPushMessage event) {
  Application application = Application.get(WicketWebInitializer.WICKET_FILTERNAME);
  WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
  IWebSocketConnectionRegistry connectionRegistry = webSocketSettings.getConnectionRegistry();
  Collection<IWebSocketConnection> connections = connectionRegistry.getConnections(application);
  log.trace("sending event to {} connections", connections.size());
  for (IWebSocketConnection connection : connections) {
    connection.sendMessage(event);
  }
}
origin: apache/wicket

private IKey getRegistryKey()
{
  IKey key;
  if (Strings.isEmpty(resourceName))
  {
    key = new PageIdKey(pageId);
  }
  else
  {
    key = new ResourceNameKey(resourceName);
  }
  return key;
}
origin: org.apache.wicket/wicket-native-websocket-core

  @Override
  public void removeConnection(Application application, String sessionId, IKey key)
  {
    setConnection(application, sessionId, key, null);
  }
}
origin: theonedev/onedev

@Override
public void notifyObserverChange(BasePage page) {
  String sessionId = page.getSession().getId();
  if (sessionId != null) {
    Map<IKey, Collection<String>> sessionPages = observables.get(sessionId);
    if (sessionPages == null) {
      sessionPages = new ConcurrentHashMap<>();
      observables.put(sessionId, sessionPages);
    }
    sessionPages.put(new PageIdKey(page.getPageId()), page.findWebSocketObservables());
  }
}

origin: apache/wicket

@Override
public void onClose(int closeCode, String message)
{
  IKey key = getRegistryKey();
  broadcastMessage(new ClosedMessage(getApplication(), getSessionId(), key));
  connectionRegistry.removeConnection(getApplication(), getSessionId(), key);
}
origin: apache/wicket

String sessionId = connection.getSessionId();
IKey key = connection.getKey();
IWebSocketConnection wsConnection = registry.getConnection(application, sessionId, key);
if (wsConnection == null)
origin: apache/wicket

/**
 * Processes the given message in all pages that have active Web Socket connections.
 * The message is sent as an event to the Page and components of the session allowing the components
 * to be updated.
 *
 * This method can be invoked from any thread, even a non-wicket thread. By default all processing
 * is done in the caller thread. Use
 * {@link WebSocketSettings#setWebSocketPushMessageExecutor(org.apache.wicket.protocol.ws.concurrent.Executor)}
 * to move processing to background threads.
 *
 * If some connections are not in valid state they are silently ignored.
 *
 * @param application
 *            The wicket application
 * @param message
 *            The push message event
 */
public void broadcastAll(Application application, IWebSocketPushMessage message)
{
  Args.notNull(application, "application");
  Args.notNull(message, "message");
  Collection<IWebSocketConnection> wsConnections = registry.getConnections(application);
  if (wsConnections == null)
  {
    return;
  }
  process(application, wsConnections, message);
}
origin: org.apache.wicket/wicket-native-websocket-core

private IKey getRegistryKey()
{
  IKey key;
  if (Strings.isEmpty(resourceName))
  {
    key = new PageIdKey(pageId);
  }
  else
  {
    key = new ResourceNameKey(resourceName);
  }
  return key;
}
origin: theonedev/onedev

@Override
public void removeConnection(Application application, String sessionId, IKey key)
{
  setConnection(application, sessionId, key, null);
}

origin: theonedev/onedev

@Nullable
public static PageKey getPageKey() {
  Page page = getPage();
  if (page != null) {
    String sessionId = page.getSession().getId();
    if (sessionId != null) {
      return new PageKey(sessionId, new PageIdKey(page.getPageId()));
    }
  }
  return null;
}

origin: theonedev/onedev

@Override
public void onClose(int closeCode, String message)
{
  IKey key = getRegistryKey();
  broadcastMessage(new ClosedMessage(getApplication(), getSessionId(), key));
  connectionRegistry.removeConnection(getApplication(), getSessionId(), key);
}
origin: org.apache.wicket/wicket-native-websocket-core

/**
 * Processes the given message in all pages that have active Web Socket connections.
 * The message is sent as an event to the Page and components of the session allowing the components
 * to be updated.
 *
 * This method can be invoked from any thread, even a non-wicket thread. By default all processing
 * is done in the caller thread. Use
 * {@link WebSocketSettings#setWebSocketPushMessageExecutor(org.apache.wicket.protocol.ws.concurrent.Executor)}
 * to move processing to background threads.
 *
 * If some connections are not in valid state they are silently ignored.
 *
 * @param application
 *            The wicket application
 * @param message
 *            The push message event
 */
public void broadcastAll(Application application, IWebSocketPushMessage message)
{
  Args.notNull(application, "application");
  Args.notNull(message, "message");
  Collection<IWebSocketConnection> wsConnections = registry.getConnections(application);
  if (wsConnections == null)
  {
    return;
  }
  process(application, wsConnections, message);
}
org.apache.wicket.protocol.ws.api.registry

Most used classes

  • IWebSocketConnectionRegistry
    Tracks all currently connected WebSocket clients
  • PageIdKey
    A key based on page's id
  • ResourceNameKey
    A key based on shared resource's name
  • SimpleWebSocketConnectionRegistry
    A registry that keeps all currently opened web socket connections in maps in Application's meta data
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now