Package org.apache.clerezza.triaxrs.blackbox.jaf.resources

Examples of org.apache.clerezza.triaxrs.blackbox.jaf.resources.JafSerializableObj


    uri.setPath("/");
    String[] headervalues = new String[1];
    headervalues[0] = "application/testobj";
    request.setHeader(HeaderName.CONTENT_TYPE, headervalues);

    JafSerializableObj testObj = new JafSerializableObj("foo", "bar");
   
    // Serialize testObj
    final ByteArrayOutputStream bous = new ByteArrayOutputStream();
    ObjectOutput out = new ObjectOutputStream(bous);
    out.writeObject(testObj);
View Full Code Here


    request.setMethod(Method.GET);
    ResponseImpl response = new ResponseImpl();
    handler.handle(request, response);
    response.consumeBody();
   
        JafSerializableObj testobj = null;
       
        //deserialize object
        try {
      InputStream is = new ByteArrayInputStream(response.getBodyBytes());
      ObjectInput oi = new ObjectInputStream(is);
      testobj = (JafSerializableObj) oi.readObject();
      oi.close();
    } catch (ClassNotFoundException e) {
      System.out.println("TestJAFProvider: " + e.toString());
      assertTrue(false);
    } catch (StreamCorruptedException e) {
      System.out.println("TestJAFProvider: " + e.toString());
      e.printStackTrace();
      assertTrue(false);
    }

    assertEquals("Object", testobj.getField1());
    assertEquals("Test", testobj.getField2());
  }
View Full Code Here

    }

    @GET
    @Produces("application/testobj")
    public JafSerializableObj createTestObj() {
      return new JafSerializableObj("Object", "Test");
    }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.triaxrs.blackbox.jaf.resources.JafSerializableObj

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.