org.apache.catalina.Manager.add()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(95)

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

Manager.add介绍

[英]Add this Session to the set of active Sessions for this Manager.
[中]将此会话添加到此管理器的活动会话集中。

代码示例

代码示例来源:origin: apache/geode

@Override
public void setPrincipal(Principal principal) {
 super.setPrincipal(principal);
 // Put the session into the region to serialize the principal
 if (getManager() != null) {
  // TODO convert this to a delta
  getManager().add(this);
  DeltaSessionManager mgr = (DeltaSessionManager) getManager();
  if (mgr.getLogger().isDebugEnabled()) {
   mgr.getLogger().debug(this + ": Cached principal: " + principal);
   // mgr.logCurrentStack();
  }
 }
}

代码示例来源:origin: magro/memcached-session-manager

/**
 * Set a new id for this session.<br/>
 * Before setting the new id, it removes itself from the associated
 * manager. After the new id is set, this session adds itself to the
 * session manager.
 *
 * @param id
 *            the new session id
 */
protected void setIdForRelocate( final String id ) {
  if ( this.id == null ) {
    throw new IllegalStateException( "There's no session id set." );
  }
  if ( this.manager == null ) {
    throw new IllegalStateException( "There's no manager set." );
  }
  /*
   * and mark it as a node-failure-session, so that remove(session) does
   * not try to remove it from memcached... (the session is removed and
   * added when the session id is changed)
   */
  setNote( MemcachedSessionService.NODE_FAILURE, Boolean.TRUE );
  manager.remove( this );
  removeNote( MemcachedSessionService.NODE_FAILURE );
  this.id = id;
  manager.add( this );
}

代码示例来源:origin: stackoverflow.com

public class TestLifecycle extends MyAppScreen implements FieldChangeListener {
  private final ABNTextEdit txt1;
  private final ButtonField btn1;
  private final ButtonField btn2;

  public TestLifecycle() {

    final Manager manager = getMainManager();

    txt1 = new ABNTextEdit();
    manager.add(txt1);

    btn1 = new ButtonField("Dialog", ButtonField.CONSUME_CLICK);
    btn1.setChangeListener(this);
    manager.add(btn1);

    btn2 = new ButtonField("Screen", ButtonField.CONSUME_CLICK);
    btn2.setChangeListener(this);
    manager.add(btn2);
  }

  public void fieldChanged(final Field field, final int context) {
    if (field == btn1) {
      Dialog.alert("Example alert");
    } else if (field == btn2) {
      UiApplication.getUiApplication().pushScreen(new TestLifecycle());
    }
  }
}

代码示例来源:origin: stackoverflow.com

public class ManyToManyTest {
  public static void main(String[] args) {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("JPA");
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    Project p1 = new Project("Project 1");
    Project p2 = new Project("Project 2");
    Project p3 = new Project("Project 3");

    Manager m1 = new Manager("Jon");
    m1.add(p1);
    m1.add(p2);
    m1.add(p3);

    Manager m2 = new Manager("Kone");
    m2.add(p2); 
    m2.add(p3);

    em.persist(m1);
    em.persist(m2);

    System.out.println("Success..");
    em.getTransaction().commit();
    em.close();

  }
}

代码示例来源:origin: stackoverflow.com

public class MyScreen extends MainScreen {

  MyScreen() {

    Background screenColor = BackgroundFactory.createSolidBackground(Color.Black);
    Manager backg= getMainManager();
    backg.setBackground(screenColor);

    EditField edit = new EditField("", "", 100, Field.FOCUSABLE){
      protected void paint(Graphics g) {
        g.setColor(Color.WHITE);
        super.paint(g);
      }
    };
    Background fieldColor = BackgroundFactory.createSolidBackground(Color.BLACK);
    edit.setBackground(fieldColor);

    backg.add(edit);
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Set the session identifier for this session.
 *
 * @param id The new session identifier
 */
@Override
public void setId(String id) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  tellNew();
}

代码示例来源:origin: jboss.web/jbossweb

/**
 * Set the session identifier for this session.
 *
 * @param id The new session identifier
 */
public void setId(String id) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  tellNew();
}

代码示例来源:origin: tomcat/catalina

/**
 * Set the session identifier for this session.
 *
 * @param id The new session identifier
 */
public void setId(String id) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  tellNew();
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * {@inheritDoc}
 */
@Override
public void setId(String id, boolean notify) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  if (notify) {
    tellNew();
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Set the session identifier for this session.
 *
 * @param id The new session identifier
 */
@Override
public void setId(String id) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  tellNew();
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * {@inheritDoc}
 */
@Override
public void setId(String id, boolean notify) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  if (notify) {
    tellNew();
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * {@inheritDoc}
 */
@Override
public void setId(String id, boolean notify) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  if (notify) {
    tellNew();
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Set the session identifier for this session.
 *
 * @param id The new session identifier
 */
@Override
public void setId(String id) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  tellNew();
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * {@inheritDoc}
 */
@Override
public void setId(String id, boolean notify) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  if (notify) {
    tellNew();
  }
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * {@inheritDoc}
 */
@Override
public void setId(String id, boolean notify) {
  if ((this.id != null) && (manager != null))
    manager.remove(this);
  this.id = id;
  if (manager != null)
    manager.add(this);
  if (notify) {
    tellNew();
  }
}

代码示例来源:origin: stackoverflow.com

final Field button1 = new GradientButtonField(Color.DARKGRAY, Color.BLUE, 
   "Click Me!", Color.WHITE);
final Field button2 =  new GradientButtonField(Color.DARKGRAY, Color.BLUE, 
   "Click Me, Too!", Color.WHITE);
Manager mgr = new Manager(Manager.NO_VERTICAL_SCROLL) {
  public int getPreferredHeight() {
   return Display.getHeight();
  }
  public int getPreferredWidth() {
   return Display.getWidth();
  }
  protected void sublayout(int maxWidth, int maxHeight) {
   setExtent(getPreferredWidth(), getPreferredHeight());
   layoutChild(button1, 160, 80);
   setPositionChild(button1, 20, 50);
   layoutChild(button2, 120, 60);
   setPositionChild(button2, 20, 150);
  }
};
button1.setChangeListener(new FieldChangeListener() {
  public void fieldChanged(Field field, int context) {
   Dialog.alert("clicked!");               
  }
});
mgr.add(button1);
mgr.add(button2);
add(mgr);

代码示例来源:origin: de.javakaffee.msm/memcached-session-manager

/**
 * Set a new id for this session.<br/>
 * Before setting the new id, it removes itself from the associated
 * manager. After the new id is set, this session adds itself to the
 * session manager.
 *
 * @param id
 *            the new session id
 */
protected void setIdForRelocate( final String id ) {
  if ( this.id == null ) {
    throw new IllegalStateException( "There's no session id set." );
  }
  if ( this.manager == null ) {
    throw new IllegalStateException( "There's no manager set." );
  }
  /*
   * and mark it as a node-failure-session, so that remove(session) does
   * not try to remove it from memcached... (the session is removed and
   * added when the session id is changed)
   */
  setNote( MemcachedSessionService.NODE_FAILURE, Boolean.TRUE );
  manager.remove( this );
  removeNote( MemcachedSessionService.NODE_FAILURE );
  this.id = id;
  manager.add( this );
}

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * Set the session identifier for this session.
 *
 * @param id The new session identifier
 */
public void setId(String id) {
  if ((this.id != null) && (manager != null))
      manager.remove(this);
  String oldId = this.id;
  this.id = id;
  if (manager != null)
    manager.add(this);
  if (oldId == null) {
    tellNew();
  } else {
    // Notify interested session event listeners
    fireSessionEvent(Session.SESSION_ID_CHANGED_EVENT, oldId);
  }
}

代码示例来源:origin: stackoverflow.com

description = new LabelField("This is a very looooooooooong description", 
   LabelField.ELLIPSIS);
row.add(description);
balance = new LabelField("1,500,000,000 USD");
row.add(balance);
add(row);

代码示例来源:origin: org.apache.geode/geode-modules

public void setPrincipal(Principal principal) {
 super.setPrincipal(principal);
 // Put the session into the region to serialize the principal
 if (getManager() != null) {
  // TODO convert this to a delta
  getManager().add(this);
  DeltaSessionManager mgr = (DeltaSessionManager) getManager();
  if (mgr.getLogger().isDebugEnabled()) {
   mgr.getLogger().debug(this + ": Cached principal: " + principal);
   // mgr.logCurrentStack();
  }
 }
}

相关文章