Package com.calclab.emite.core.client.packet

Examples of com.calclab.emite.core.client.packet.IPacket


     * @param nodeName
     * @param text
     */
    protected void setTextToChild(final String nodeName, final String text) {
  if (text != null) {
      IPacket node = getFirstChild(nodeName);
      if (node == NoPacket.INSTANCE) {
    node = this.addChild(nodeName, null);
      }
      node.setText(text);
  } else {
      removeChild(getFirstChild(nodeName));
  }
    }
View Full Code Here


  onAuthorized.add(listener);
    }

    public void sendAuthorizationRequest(final AuthorizationTransaction authorizationTransaction) {
  this.currentTransaction = authorizationTransaction;
  final IPacket response = isAnonymous(authorizationTransaction) ? createAnonymousAuthorization()
    : createPlainAuthorization(authorizationTransaction);
  connection.send(response);
  currentTransaction.setState(State.waitingForAuthorization);
    }
View Full Code Here

  connection.send(response);
  currentTransaction.setState(State.waitingForAuthorization);
    }

    private IPacket createAnonymousAuthorization() {
  final IPacket auth = new Packet("auth", XMLNS).With("mechanism", "ANONYMOUS");
  return auth;
    }
View Full Code Here

  final IPacket auth = new Packet("auth", XMLNS).With("mechanism", "ANONYMOUS");
  return auth;
    }

    private IPacket createPlainAuthorization(final AuthorizationTransaction authorizationTransaction) {
  final IPacket auth = new Packet("auth", XMLNS).With("mechanism", "PLAIN");
  final String encoded = encode(authorizationTransaction.uri.getHost(), authorizationTransaction.uri.getNode(),
    authorizationTransaction.getPassword());
  auth.setText(encoded);
  return auth;
    }
View Full Code Here

  }
    }

    public void setBody(final String msg) {
  if (msg != null) {
      final IPacket body = addChild("body", null);
      body.setText(msg);
  }
    }
View Full Code Here

        if (statusCode != 200 && statusCode != 0) {
      running = false;
      onError.fire("Bad status: " + statusCode);
        } else {
      onResponse.fire(content);
      final IPacket response = services.toXML(content);
      if (response != null && "body".equals(response.getName())) {
          handleResponse(response);
      } else {
          onError.fire("Bad response: " + content);
      }
        }
View Full Code Here

  this(type);
  super.setTo(to);
    }

    public IPacket addQuery(final String xmlns) {
  final IPacket query = addChild("query", xmlns);
  return query;
    }
View Full Code Here

TOP

Related Classes of com.calclab.emite.core.client.packet.IPacket

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.