Package net.zschech.gwt.chat.client

Examples of net.zschech.gwt.chat.client.ChatException


   
    // setup the mapping of user names to CometSessions
    if (users.putIfAbsent(username, cometSession) != null) {
      // some one else has already logged in with this user name
      httpSession.invalidate();
      throw new ChatException("User: " + username + " already logged in");
    }
  }
View Full Code Here


  @Override
  public void logout(String username) throws ChatException {
    // check if there is a HTTP session setup.
    HttpSession httpSession = getThreadLocalRequest().getSession(false);
    if (httpSession == null) {
      throw new ChatException("User: " + username + " is not logged in: no http session");
    }
   
    // check if there is a Comet session setup. In a larger application the HTTP session may have been
    // setup via other means.
    CometSession cometSession = CometServlet.getCometSession(httpSession, false);
    if (cometSession == null) {
      throw new ChatException("User: " + username + " is not logged in: no comet session");
    }
   
    // check the user name parameter matches the HTTP sessions user name
    if (!username.equals(httpSession.getAttribute("username"))) {
      throw new ChatException("User: " + username + " is not logged in on this session");
    }
   
    // remove the mapping of user name to CometSession
    users.remove(username, cometSession);
    httpSession.invalidate();
View Full Code Here

  @Override
  public void send(String message) throws ChatException {
    // check if there is a HTTP session setup.
    HttpSession httpSession = getThreadLocalRequest().getSession(false);
    if (httpSession == null) {
      throw new ChatException("not logged in: no http session");
    }
   
    // get the user name for the HTTP session.
    String username = (String) httpSession.getAttribute("username");
    if (username == null) {
      throw new ChatException("not logged in: no http session username");
    }
   
    // create the chat message
    ChatMessage chatMessage = new ChatMessage();
    chatMessage.setUsername(username);
View Full Code Here

  @Override
  public void setStatus(Status status) throws ChatException {
    // check if there is a HTTP session setup.
    HttpSession httpSession = getThreadLocalRequest().getSession(false);
    if (httpSession == null) {
      throw new ChatException("not logged in: no http session");
    }
   
    // get the user name for the HTTP session.
    String username = (String) httpSession.getAttribute("username");
    if (username == null) {
      throw new ChatException("not logged in: no http session username");
    }
   
    // create the chat message
    StatusUpdate statusUpdate = new StatusUpdate();
    statusUpdate.setUsername(username);
View Full Code Here

TOP

Related Classes of net.zschech.gwt.chat.client.ChatException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.