com.vaadin.ui.UI.getPushConfiguration()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中com.vaadin.ui.UI.getPushConfiguration()方法的一些代码示例,展示了UI.getPushConfiguration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UI.getPushConfiguration()方法的具体详情如下:
包路径:com.vaadin.ui.UI
类名称:UI
方法名:getPushConfiguration

UI.getPushConfiguration介绍

[英]Retrieves the object used for configuring the push channel.
[中]检索用于配置推送通道的对象。

代码示例

代码示例来源:origin: com.vaadin/vaadin-server

/**
 * Returns the internal push connection object used by this UI. This method
 * should only be called by the framework.
 * <p>
 * This method is not intended to be overridden. If it is overridden, care
 * should be taken since this method might be called in situations where
 * {@link UI#getCurrent()} does not return this UI.
 *
 * @return the push connection used by this UI, or {@code null} if push is
 *         not available.
 */
public PushConnection getPushConnection() {
  assert !(getPushConfiguration().getPushMode().isEnabled()
      && pushConnection == null);
  return pushConnection;
}

代码示例来源:origin: com.vaadin/vaadin-server

getPushConfiguration().setPushMode(PushMode.DISABLED);

代码示例来源:origin: com.vaadin/vaadin-server

/**
 * Sets the internal push connection object used by this UI. This method
 * should only be called by the framework.
 * <p>
 * The {@code pushConnection} argument must be non-null if and only if
 * {@code getPushConfiguration().getPushMode().isEnabled()}.
 *
 * @param pushConnection
 *            the push connection to use for this UI
 */
public void setPushConnection(PushConnection pushConnection) {
  // If pushMode is disabled then there should never be a pushConnection;
  // if enabled there should always be
  assert (pushConnection == null)
      ^ getPushConfiguration().getPushMode().isEnabled();
  if (pushConnection == this.pushConnection) {
    return;
  }
  if (this.pushConnection != null && this.pushConnection.isConnected()) {
    this.pushConnection.disconnect();
  }
  this.pushConnection = pushConnection;
}

代码示例来源:origin: com.vaadin/vaadin-server

if (!getPushConfiguration().getPushMode().isEnabled()) {
  throw new IllegalStateException("Push not enabled");

代码示例来源:origin: com.vaadin/vaadin-server

PushMode pushMode = ui.getPushConfiguration().getPushMode();
AtmospherePushConnection pushConnection = getConnectionForUI(ui);

代码示例来源:origin: com.vaadin/vaadin-server

.getPushMode();
ui.getPushConfiguration().setPushMode(pushMode);
  ui.getPushConfiguration().setTransport(transport);

代码示例来源:origin: com.vaadin/vaadin-server

if (ui.getPushConfiguration()
    .getPushMode() == PushMode.AUTOMATIC) {
  Map<Class<?>, CurrentInstance> oldCurrent = CurrentInstance

代码示例来源:origin: com.vaadin/hummingbird-server

/**
 * Returns the internal push connection object used by the related UI. This
 * method should only be called by the framework.
 * <p>
 * This method is not intended to be overridden. If it is overridden, care
 * should be taken since this method might be called in situations where
 * {@link UI#getCurrent()} does not return the UI.
 *
 * @return the push connection used by the UI, or {@code null} if push is
 *         not available.
 */
public PushConnection getPushConnection() {
  assert !(ui.getPushConfiguration().getPushMode().isEnabled()
      && pushConnection == null);
  return pushConnection;
}

代码示例来源:origin: com.vaadin/hummingbird-server

protected UI createAndInitUI(Class<? extends UI> uiClass,
    VaadinRequest request, VaadinSession session) {
  Integer uiId = Integer.valueOf(session.getNextUIid());
  UI ui = ReflectTools.createInstance(uiClass);
  // Initialize some fields for a newly created UI
  ui.getInternals().setSession(session);
  PushMode pushMode = AnnotationReader.getPushMode(uiClass).orElseGet(
      session.getService().getDeploymentConfiguration()::getPushMode);
  ui.getPushConfiguration().setPushMode(pushMode);
  AnnotationReader.getPushTransport(uiClass)
      .ifPresent(ui.getPushConfiguration()::setTransport);
  // Set thread local here so it is available in init
  UI.setCurrent(ui);
  ui.doInit(request, uiId.intValue());
  session.addUI(ui);
  return ui;
}

代码示例来源:origin: peholmst/vaadin4spring

final UI currentUI = UI.getCurrent();
if (currentUI != null) {
  final Transport transport = currentUI.getPushConfiguration().getTransport();
  if (Transport.WEBSOCKET.equals(transport) || Transport.WEBSOCKET_XHR.equals(transport)) {
    LOGGER.warn(

代码示例来源:origin: com.vaadin/hummingbird-server

/**
 * Sets the internal push connection object used by the the related UI. This
 * method should only be called by the framework.
 * <p>
 * The {@code pushConnection} argument must be non-null if and only if
 * {@code getPushConfiguration().getPushMode().isEnabled()}.
 *
 * @param pushConnection
 *            the push connection to use for the UI
 */
public void setPushConnection(PushConnection pushConnection) {
  // If pushMode is disabled then there should never be a pushConnection;
  // if enabled there should always be
  assert (pushConnection == null)
      ^ ui.getPushConfiguration().getPushMode().isEnabled();
  if (pushConnection == this.pushConnection) {
    return;
  }
  if (this.pushConnection != null && this.pushConnection.isConnected()) {
    this.pushConnection.disconnect();
  }
  this.pushConnection = pushConnection;
}

代码示例来源:origin: org.vaadin.spring.extensions/vaadin-spring-ext-security

final UI currentUI = UI.getCurrent();
if (currentUI != null) {
  final Transport transport = currentUI.getPushConfiguration().getTransport();
  if (Transport.WEBSOCKET.equals(transport) || Transport.WEBSOCKET_XHR.equals(transport)) {
    LOGGER.warn(

代码示例来源:origin: com.vaadin/hummingbird-server

ui.getPushConfiguration().setPushMode(PushMode.DISABLED);
setPushConnection(null);

代码示例来源:origin: com.vaadin/hummingbird-server

public PushMode getPushMode() {
  if (pushMode == null) {
    pushMode = getUI().getPushConfiguration().getPushMode();
    if (pushMode == null) {
      pushMode = getRequest().getService()
          .getDeploymentConfiguration().getPushMode();
    }
    if (pushMode.isEnabled()
        && !getRequest().getService().ensurePushAvailable()) {
      /*
       * Fall back if not supported (ensurePushAvailable will log
       * information to the developer the first time this happens)
       */
      pushMode = PushMode.DISABLED;
    }
  }
  return pushMode;
}

代码示例来源:origin: com.vaadin/hummingbird-server

PushMode pushMode = ui.getPushConfiguration().getPushMode();
AtmospherePushConnection pushConnection = getConnectionForUI(ui);

代码示例来源:origin: com.vaadin/hummingbird-server

if (ui.getPushConfiguration()
    .getPushMode() == PushMode.AUTOMATIC) {
  Map<Class<?>, CurrentInstance> oldCurrent = CurrentInstance

代码示例来源:origin: com.vaadin/hummingbird-server

if (!getPushConfiguration().getPushMode().isEnabled()) {
  throw new IllegalStateException("Push not enabled");

相关文章