Package org.jwebsocket.api

Examples of org.jwebsocket.api.WebSocketPacket


   * @param aConnector
   * @param aToken
   * @return
   */
  public WebSocketPacket tokenToPacket(Token aToken) {
    WebSocketPacket lPacket = null;

    if (lSubProt.equals(JWebSocketCommonConstants.SUB_PROT_JSON)) {
      lPacket = JSONProcessor.tokenToPacket(aToken);
    } else if (lSubProt.equals(JWebSocketCommonConstants.SUB_PROT_CSV)) {
      lPacket = CSVProcessor.tokenToPacket(aToken);
View Full Code Here


    }
    return lToken;
  }

  public static WebSocketPacket tokenToPacket(Token aToken) {
    WebSocketPacket lPacket = null;
    try {
      JSONObject lJSON = aToken.getJSONObject();
      String lData = lJSON.toString();
      lPacket = new RawPacket(lData, "UTF-8");
    } catch (UnsupportedEncodingException ex) {
View Full Code Here

            Object lVal = aToken.get(lKey);
            lData +=
                    lKey + "=" + objectToCSV(lVal)
                    + (lIterator.hasNext() ? "," : "");
        }
        WebSocketPacket lPacket = null;
        try {
            lPacket = new RawPacket(lData, "UTF-8");
        } catch (UnsupportedEncodingException ex) {
            // TODO: process exception
            // log.error(ex.getClass().getSimpleName() + ": " + ex.getMessage());
View Full Code Here

   * @param aToken
   * @return
   */
  public WebSocketPacket tokenToPacket(WebSocketConnector aConnector, Token aToken) {
    String lSubProt = aConnector.getHeader().getSubProtocol(JWebSocketCommonConstants.SUB_PROT_DEFAULT);
    WebSocketPacket lPacket = null;
    if (lSubProt.equals(JWebSocketCommonConstants.SUB_PROT_JSON)) {
      lPacket = JSONProcessor.tokenToPacket(aToken);
    } else if (lSubProt.equals(JWebSocketCommonConstants.SUB_PROT_CSV)) {
      lPacket = CSVProcessor.tokenToPacket(aToken);
    } else if (lSubProt.equals(JWebSocketCommonConstants.SUB_PROT_XML)) {
View Full Code Here

      // if filter chain does not response "aborted"
      if (!filterResponse.isRejected()) {
        if (mLog.isDebugEnabled()) {
          mLog.debug("Sending token '" + aToken + "' to '" + aTarget + "'...");
        }
        WebSocketPacket aPacket = tokenToPacket(aTarget, aToken);
        super.sendPacket(aTarget, aPacket);
      } else {
        if (mLog.isDebugEnabled()) {
          mLog.debug("");
        }
View Full Code Here

TOP

Related Classes of org.jwebsocket.api.WebSocketPacket

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.