Examples of marshallToJSON()


Examples of com.sun.jersey.api.json.JSONMarshaller.marshallToJSON()

    JSONJAXBContext context =
      new JSONJAXBContext(JSONConfiguration.natural().build(),
        FilterModel.class);
    JSONMarshaller marshaller = context.createJSONMarshaller();
    StringWriter writer = new StringWriter();
    marshaller.marshallToJSON(new FilterModel(filter), writer);
    return writer.toString();
  }

  private static final byte[] COLUMN_DIVIDER = Bytes.toBytes(":");
View Full Code Here

Examples of com.sun.jersey.api.json.JSONMarshaller.marshallToJSON()

            throws JAXBException {

        JSONMarshaller jsonMarshaller = JSONJAXBContext.getJSONMarshaller(m);
        if(isFormattedOutput())
            jsonMarshaller.setProperty(JSONMarshaller.FORMATTED, true);
        jsonMarshaller.marshallToJSON(t, new OutputStreamWriter(entityStream, c));
    }
}
View Full Code Here

Examples of com.sun.jersey.api.json.JSONMarshaller.marshallToJSON()

            Marshaller m, OutputStream entityStream)
            throws JAXBException {
        JSONMarshaller jsonMarshaller = JSONJAXBContext.getJSONMarshaller(m);
        if(isFormattedOutput())
            jsonMarshaller.setProperty(JSONMarshaller.FORMATTED, true);
        jsonMarshaller.marshallToJSON(t, new OutputStreamWriter(entityStream, c));
    }
}
View Full Code Here

Examples of com.sun.jersey.api.json.JSONMarshaller.marshallToJSON()

        Cat c2 = new Cat("Bar", "Puss");
        one.addCat(c2);
       
        one.setProp("testProp");
       
        jm.marshallToJSON(one, sw);
        String jsonResult = sw.toString();
        System.out.println(jsonResult);
       
        String excpectedResult = "{\"cats\":[{\"name\":\"Foo\",\"nickName\":\"Kitty\"},{\"name\":\"Bar\",\"nickName\":\"Puss\"}],\"prop\":\"testProp\"}";
        assertEquals(excpectedResult, jsonResult);
View Full Code Here

Examples of com.sun.jersey.api.json.JSONMarshaller.marshallToJSON()

        IntArray one = new IntArray();
        one.intArray = new int[] {1};
        one.integerArray = new Integer[] {2};
        one.number = 3;
       
        jm.marshallToJSON(one, sw);
        String jsonResult = sw.toString();
        System.out.println(jsonResult);
       
        String expectedResult = "{\"intArray\":[1].\"integerArray\":[2],\"number\":3}";
        assertEquals(expectedResult, jsonResult);
View Full Code Here

Examples of com.sun.jersey.api.json.JSONMarshaller.marshallToJSON()

        NamespaceBean beanTwo;

        final StringWriter sw = new StringWriter();

        jm.marshallToJSON(one, sw);

        System.out.println(String.format("%s", sw));

        beanTwo = ju.unmarshalFromJSON(new StringReader(sw.toString()), NamespaceBean.class);
View Full Code Here

Examples of com.sun.jersey.api.json.JSONMarshaller.marshallToJSON()

                super.write(str);
            }
        };

        Bean b = new Bean("A", "B", "C");
        jm.marshallToJSON(b, w);
    }
}
View Full Code Here

Examples of com.sun.jersey.api.json.JSONMarshaller.marshallToJSON()

        final JSONUnmarshaller ju = ctx.createJSONUnmarshaller();
        final StringWriter sw = new StringWriter();

        final MyResponse one = JSONTestHelper.createTestInstance(MyResponse.class);

        jm.marshallToJSON(one, sw);

        System.out.println(String.format("%s", sw));

        MyResponse two;
        two =  ju.unmarshalFromJSON(new StringReader(sw.toString()), MyResponse.class);
View Full Code Here

Examples of com.sun.jersey.api.json.JSONMarshaller.marshallToJSON()

        for (Object originalBean : beans) {
            printAsXml(originalBean);

            StringWriter sWriter = new StringWriter();
            marshaller.marshallToJSON(originalBean, sWriter);

            System.out.println(sWriter.toString());
            assertEquals(originalBean, unmarshaller.unmarshalFromJSON(new StringReader(sWriter.toString()), originalBean.getClass()));
        }
    }
View Full Code Here

Examples of org.glassfish.jersey.jettison.JettisonMarshaller.marshallToJSON()

        JettisonMarshaller jsonMarshaller = JettisonJaxbContext.getJSONMarshaller(m);
        if (isFormattedOutput()) {
            jsonMarshaller.setProperty(JettisonMarshaller.FORMATTED, true);
        }
        jsonMarshaller.marshallToJSON(t, new OutputStreamWriter(entityStream, c));
    }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.