code: public static MessageEmit getMessageObj(final HttpServletRequest request,
                                            final String messageObjAttrName) {
      if (messageObjAttrName == null) {
        // don't set
        return null;
      }
  
      HttpSession sess = request.getSession(false);
  
      if (sess == null) {
        logger.error("No session!!!!!!!");
        return null;
      }
  
      Object o = sess.getAttribute(messageObjAttrName);
      if ((o != null) && (o instanceof MessageEmit)) {
        return (MessageEmit)o;
      }
  
      return null;
    }
docs: Get the existing message object from the session or null.
  
  @param request  Needed to locate session
  @param messageObjAttrName  name of session attribute
  @return MessageEmit null on none found