Package org.xmlBlaster.client.protocol.http.common

Examples of org.xmlBlaster.client.protocol.http.common.ObjectOutputStreamMicro


         if(callbackInterceptor != null) {
            callbackInterceptor.update(sessionId, updateKey, content, updateQos);
         }

         ByteArrayOutputStream dump = new ByteArrayOutputStream(1024);
         ObjectOutputStreamMicro out = new ObjectOutputStreamMicro(dump);

         out.writeObject(I_XmlBlasterAccessRaw.UPDATE_NAME.toString()); // "update"
         out.writeObject(sessionId);

         Hashtable qosMap = updateQos.getData().toJXPath();
         out.writeObject(qosMap);

         Hashtable keyMap = updateKey.getData().toJXPath();
         out.writeObject(keyMap);

         out.writeObject(Base64.encode(content));

         pushToApplet(dump.toByteArray());
         if (log.isLoggable(Level.FINE)) log.fine("Sent update message '" + updateKey.getOid() + "' content='" + new String(content) + "' to applet");
      }
      catch(Exception e) {
View Full Code Here


    *              one time
    */
   public void ping(String state) throws XmlBlasterException {
      try {
         ByteArrayOutputStream dump = new ByteArrayOutputStream(1024);
         ObjectOutputStreamMicro out = new ObjectOutputStreamMicro(dump);

         out.writeObject(I_XmlBlasterAccessRaw.PING_NAME); // "ping"
         out.writeObject("<qos id='"+state+"'/>");

         pushToApplet(dump.toByteArray());
         if (log.isLoggable(Level.FINE)) log.fine("Sent ping '" + state + "' to applet");
      }
      catch (IOException e) {
View Full Code Here

    * @param actionType A type with the applet knows how to read, "subscribe" etc. for subscribe return QoS
    */
   private void writeResponse(HttpServletResponse res, String actionType, Object obj) throws IOException {
      //this.initialGlobal.getLog("servlet").trace("AppletServlet", "writeResponse actionType=" + actionType + " obj=" + obj.getClass().getName());
      ByteArrayOutputStream dump = new ByteArrayOutputStream(1024);
      ObjectOutputStreamMicro objectOut = new ObjectOutputStreamMicro(dump);
      objectOut.writeObject(actionType); // "subscribe" etc.
      if (obj != null) {
         objectOut.writeObject(obj);
      }
      boolean isChunked = false; // All in one line
      String base64 = Base64.encode(dump.toByteArray());
      PrintWriter out = res.getWriter();
      out.println(base64);
View Full Code Here

   }

   public void testVectorIO() {
      try {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStreamMicro oosm = new ObjectOutputStreamMicro(baos);
        
         Hashtable key = new Hashtable();
         key.put("one", "1");
         key.put("two", "2");
         key.put("three", "3");
         key.put("four", "4");
        
         Hashtable qos = new Hashtable();
         qos.put("one-qos", "1");
         qos.put("two-qos", "2");
         qos.put("three-qos", "3");
        
         byte[] content = "This is the content".getBytes();
         Msg msg = new Msg(key, content, qos);
         Vector inVec = new Vector();
         inVec.add(key);
         inVec.add(qos);
         inVec.add(content);
         inVec.add(key);
         inVec.add(qos);
         inVec.add(content);
         oosm.writeObject(inVec);
        
         ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
         ObjectInputStreamMicro oism = new ObjectInputStreamMicro(bais);
         Object obj = oism.readObject();
         assertTrue("hashtable is not of type 'Vector', it is " + obj.getClass().getName(), obj instanceof Vector);
View Full Code Here

   }

   public void testHashtableIO() {
      try {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStreamMicro oosm = new ObjectOutputStreamMicro(baos);
        
         Hashtable hashtable = new Hashtable();
         hashtable.put("one", "1");
         hashtable.put("two", "2");
         hashtable.put("three", "3");
         hashtable.put("four", "4");
        
         oosm.writeObject(hashtable);
         ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
         ObjectInputStreamMicro oism = new ObjectInputStreamMicro(bais);
         Object obj = oism.readObject();
         assertTrue("hashtable is not of type 'Hashtable', it is " + obj.getClass().getName(), obj instanceof Hashtable);
         Hashtable table = (Hashtable)obj;
View Full Code Here

   }

   public void testStringIO() {
      try {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStreamMicro oosm = new ObjectOutputStreamMicro(baos);
        
         String testString = "this is\n\na simple\nmultiline string\n";
         oosm.writeObject(testString);
         ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
         ObjectInputStreamMicro oism = new ObjectInputStreamMicro(bais);
         Object obj = oism.readObject();
         assertTrue("string is not of type 'String', it is " + obj.getClass().getName(), obj instanceof String);
         String response = (String)obj;
View Full Code Here

   }

   public void testMessageIO() {
      try {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStreamMicro oosm = new ObjectOutputStreamMicro(baos);

         String oid = "someOid";        
         String key = "<key oid='100'></key>";
         String qos = "<qos><persistent/></qos>";
         byte[] content = "This is the content".getBytes();
View Full Code Here

TOP

Related Classes of org.xmlBlaster.client.protocol.http.common.ObjectOutputStreamMicro

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.