Package org.xmlBlaster.client.qos

Examples of org.xmlBlaster.client.qos.ConnectQos


      }

      try {
         //------------------ Login -------------------------------------------------
         if (actionType.equals("login") || actionType.equals("connect")) {
            ConnectQos connectQos;
            if (actionType.equals("connect")) {
               String qos = Util.getParameter(req, "xmlBlaster.connectQos", null);
               if (qos == null || qos.length() < 1)
                  throw new XmlBlasterException(glob, ErrorCode.USER_CONFIGURATION, ME, "Missing connect QoS. Pass xmlBlaster.connectQos='<qos> ... </qos>' with your URL in your POST in a hidden form field or in your cookie.");
               connectQos = new ConnectQos(glob, glob.getConnectQosFactory().readObject(qos));
            }
            else {
               String loginName = Util.getParameter(req, "xmlBlaster.loginName", null);    // "Joe";
               if (loginName == null || loginName.length() < 1)
                  throw new XmlBlasterException(glob, ErrorCode.USER_CONFIGURATION, ME, "Missing login name. Pass xmlBlaster.loginName=xy with your URL or in your cookie.");
               String passwd = Util.getParameter(req, "xmlBlaster.passwd", null)// "secret";
               if (passwd == null || passwd.length() < 1)
                  throw new XmlBlasterException(glob, ErrorCode.USER_CONFIGURATION, ME, "Missing passwd");
               connectQos = new ConnectQos(glob, loginName, passwd);
            }

            ME  = "BlasterHttpProxyServlet-" + req.getRemoteAddr() + "-" +
                  connectQos.getSessionName().getLoginName() + "-" + sessionId;

            I_XmlBlasterAccess xmlBlasterAccess = glob.getXmlBlasterAccess();
            HttpPushHandler pushHandler = new HttpPushHandler(req, res, sessionId,
                                                     connectQos.getSessionName().getRelativeName(),
                                                     xmlBlasterAccess);

            xmlBlasterAccess.connect(connectQos, pushHandler);
            if (!session.isNew()) {
               pushHandler.startPing();
            }
            else {
               log.info("Login action, browser has not yet joined this sessionId (cookie), so first pings pong may return an invalid sessionId");
               pushHandler.startPing(); // This is too early here, we need to start the ping thread later?
            }

            BlasterHttpProxy.addHttpPushHandler( sessionId, pushHandler );

            // Don't fall out of doGet() to keep the HTTP connection open
            log.info("Waiting forever, permanent HTTP connection from " +
                           req.getRemoteHost() + "/" + req.getRemoteAddr() +
                           ", sessionName=" + connectQos.getSessionName().getRelativeName() + " sessionId=" + sessionId +
                           "', protocol='" + req.getProtocol() +
                           "', agent='" + req.getHeader("User-Agent") +
                           "', referer='" + req.getHeader("Referer") +
                           "'.");
View Full Code Here


      {
         this.xmlBlasterImpl = xmlBlasterImpl;
         this.authenticate = authenticate;
         String loginName = glob.getProperty().get("__sys__GuiQuery.loginName", "__sys__GuiQuery");
         String passwd = glob.getProperty().get("__sys__GuiQuery.password", "secret");
         ConnectQos connectQos = new ConnectQos(authenticate.getGlobal());
         connectQos.loadClientPlugin("htpasswd", "1.0", loginName, passwd);
         connectQos.getSessionQos().setSessionTimeout(0L);
         // TODO: Port to use "LOCAL" protocol to connect
         this.addressServer = new AddressServer(authenticate.getGlobal(), "NATIVE", authenticate.getGlobal().getId(), (java.util.Properties)null);
         String ret = authenticate.connect(addressServer, connectQos.toXml(), null); // synchronous access only, no callback.
         ConnectReturnQos retQos = new ConnectReturnQos(authenticate.getGlobal(), ret);
         this.secretSessionId = retQos.getSecretSessionId();
         log.info("login for '" + loginName + "' successful.");
      }
View Full Code Here

      String sessionName = props.getProperty("sessionName", loginName
          + "/1");
      String password = props.getProperty("password", passwd);
      Global glob = new Global(props);
      this.xmlBlasterAccess = glob.getXmlBlasterAccess();
      ConnectQos qos = new ConnectQos(glob, sessionName, password);
      this.xmlBlasterAccess.connect(qos, new I_Callback() {
        public String update(String cbSessionId, UpdateKey updateKey,
            byte[] content, UpdateQos updateQos) {
          log("PullServler.update(): Ignoring update "
              + updateKey.getOid());
View Full Code Here

      throws XmlBlasterException, IOException, ServletException {
      if (qos == null || qos.length() < 1)
         throw new XmlBlasterException(this.initialGlobal, ErrorCode.USER_CONFIGURATION, ME, "Missing connect QoS. Pass xmlBlaster.connectQos='<qos> ... </qos>' with your URL in your POST in a hidden form field or in your cookie.");

      Global glob = this.initialGlobal.getClone(null);
      ConnectQos connectQos;
      boolean warnAuth = false;
      if (qos.toLowerCase().indexOf("securityservice") >= 0) {
         connectQos = new ConnectQos(glob, glob.getConnectQosFactory().readObject(qos)); // Applet provides authentication
      }
      else {
         connectQos = new ConnectQos(glob)// User servlets default authentication setting
         warnAuth = true;
      }
      ME  += connectQos.getSessionName().getLoginName() + "-" + session.getId();
           
      if (warnAuth)
         log.warning("Login action, applet has not supplied connect QoS authentication information - we login with the servlets default authentication settings");
      else
         log.info("Login action with applet supplied connect QoS authentication information");

      I_XmlBlasterAccess xmlBlasterAccess = glob.getXmlBlasterAccess();
      PushHandler pushHandler = new PushHandler(req, res, session.getId(),
                                               connectQos.getSessionName().getRelativeName(),
                                               xmlBlasterAccess, this.timeout);
      xmlBlasterAccess.connect(connectQos, pushHandler);
      pushHandler.startPing();
      String key = "PushHandler"+getParameter(req, "appletInstanceCount", "0");
      session.setAttribute(key, pushHandler);

      // Don't fall out of doGet() to keep the HTTP connection open
      log.info("Waiting forever, permanent HTTP connection from " +
                     req.getRemoteHost() + "/" + req.getRemoteAddr() +
                     ", sessionName=" + connectQos.getSessionName().getRelativeName() + " sessionId=" + session.getId() +
                     "', protocol='" + req.getProtocol() +
                     "', agent='" + req.getHeader("User-Agent") +
                     "', referer='" + req.getHeader("Referer") +
                     "', storing PushHandler with key '" + key +
                     "'.");
View Full Code Here

   {
      try {
         senderConnection = glob.getXmlBlasterAccess(); // Find orb

         String passwd = "secret";
         ConnectQos qos = new ConnectQos(glob, senderName, passwd);
         if (log.isLoggable(Level.FINE))
           log.fine("the connect qos is: " + qos.toXml());
        
         CallbackAddress cbAddress = new CallbackAddress(this.glob);
         cbAddress.setSecretSessionId(cbSessionId); // to protect our callback server - see method update()
         qos.addCallbackAddress(cbAddress);

         senderConnection.connect(qos, this); // Login to xmlBlaster
      }
      catch (Exception e) {
          log.severe("Login failed: " + e.toString());
View Full Code Here

   protected void setUp() {
      try {
         this.msgInterceptor = new MsgInterceptor(glob, log, null);
         this.senderConnection = glob.getXmlBlasterAccess();
         String passwd = "secret";
         ConnectQos qos = new ConnectQos(glob, senderName, passwd);
         this.senderConnection.connect(qos, this.msgInterceptor);
      }
      catch (Exception e) {
          log.severe("Login failed: " + e.toString());
          fail("Login failed: " + e.toString());
View Full Code Here

   {
      try {
         numPublish = glob.getProperty().get("numPublish", 100);
         senderConnection = glob.getXmlBlasterAccess();   // Find orb
         String passwd = "secret";
         ConnectQos connectQos = new ConnectQos(glob, senderName, passwd);
         senderConnection.connect(connectQos, null); // Login to xmlBlaster
      }
      catch (Exception e) {
          log.severe(e.toString());
          e.printStackTrace();
View Full Code Here

      log.info("Setting up test ...");
      numReceived = 0;
      try {
         oneConnection = glob.getXmlBlasterAccess(); // Find orb
         String passwd = "secret";
         ConnectQos connectQos = new ConnectQos(glob, oneName, passwd);
         oneConnection.connect(connectQos, this); // Login to xmlBlaster
      }
      catch (Exception e) {
          log.severe("Login failed: " + e.toString());
          e.printStackTrace();
View Full Code Here

         sub.loginName = "Joe-" + ii;

         try {
            Global globSub = glob.getClone(null);
            sub.connection = globSub.getXmlBlasterAccess();
            ConnectQos loginQosW = new ConnectQos(globSub, sub.loginName, passwd); // "<qos></qos>"; During login this is manipulated (callback address added)
            sub.connection.connect(loginQosW, this);
         }
         catch (Exception e) {
             log.severe("Login failed: " + e.toString());
             assertTrue("Login failed: " + e.toString(), false);
View Full Code Here

      numReceived = 0;
      try {
         Global globOne = glob.getClone(null);
         oneConnection = globOne.getXmlBlasterAccess(); // Find orb
         String passwd = "secret";
         ConnectQos qos = new ConnectQos(globOne, oneName, passwd);
         oneConnection.connect(qos, this); // Login to xmlBlaster
      }
      catch (Exception e) {
          log.severe("Login failed: " + e.toString());
          e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.xmlBlaster.client.qos.ConnectQos

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.