Package com.sun.jersey.api.json

Examples of com.sun.jersey.api.json.JSONJAXBContext


      RemoteExceptionData.class, CapacitySchedulerQueueInfoList.class,
      ResourceInfo.class, UsersInfo.class, UserInfo.class};

  public JAXBContextResolver() throws Exception {
    this.types = new HashSet<Class>(Arrays.asList(cTypes));
    this.context = new JSONJAXBContext(JSONConfiguration.natural()
        .rootUnwrapping(false).build(), cTypes);
  }
View Full Code Here


    TaskAttemptInfo.class, TaskInfo.class, TasksInfo.class,
    TaskAttemptsInfo.class, ConfEntryInfo.class, RemoteExceptionData.class};

  public JAXBContextResolver() throws Exception {
    this.types = new HashSet<Class>(Arrays.asList(cTypes));
    this.context = new JSONJAXBContext(JSONConfiguration.natural().
        rootUnwrapping(false).build(), cTypes);
  }
View Full Code Here

   * @param s the JSON representation of the filter
   * @return the filter
   * @throws Exception
   */
  public static Filter buildFilter(String s) throws Exception {
    JSONJAXBContext context =
      new JSONJAXBContext(JSONConfiguration.natural().build(),
        FilterModel.class);
    JSONUnmarshaller unmarshaller = context.createJSONUnmarshaller();
    FilterModel model = unmarshaller.unmarshalFromJSON(new StringReader(s),
      FilterModel.class);
    return model.build();
  }
View Full Code Here

   * @param filter the filter
   * @return the JSON representation of the filter
   * @throws Exception
   */
  public static String stringifyFilter(final Filter filter) throws Exception {
    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();
  }
View Full Code Here

      ResourceInfo.class, UsersInfo.class, UserInfo.class,
      ApplicationStatisticsInfo.class, StatisticsItemInfo.class};

  public JAXBContextResolver() throws Exception {
    this.types = new HashSet<Class>(Arrays.asList(cTypes));
    this.context = new JSONJAXBContext(JSONConfiguration.natural()
        .rootUnwrapping(false).build(), cTypes);
  }
View Full Code Here

        // TODO we can't use natural with JAXB 2.1.6 or 2.1 for some reason?
        JSONConfiguration.Builder builder = JSONConfiguration.mapped();
        //JSONConfiguration.Builder builder = JSONConfiguration.natural();

        this.packages = org.apache.camel.web.resources.Constants.JAXB_PACKAGES;
        this.context = new JSONJAXBContext(builder.build(), packages);
    }
View Full Code Here

*/
public class AnotherArrayTest extends TestCase {

    public void testAnotherSimpleXmlTypeBean() throws Exception {
       
        final JSONJAXBContext ctx = new JSONJAXBContext(JSONConfiguration.mapped().arrays("cats").build(), AnotherArrayTestBean.class);
        final JSONMarshaller jm = ctx.createJSONMarshaller();
        final StringWriter sw = new StringWriter();

        AnotherArrayTestBean one = new AnotherArrayTestBean();
        Cat c1 = new Cat("Foo", "Kitty");
        one.addCat(c1);
View Full Code Here

*/
public class IntArrayTest extends TestCase {

    public void testBracketsAreNotMissingAndNumbersAreNotQuoted() throws Exception {
       
        final JSONJAXBContext ctx = new JSONJAXBContext(JSONConfiguration.natural().build(), IntArray.class);
        final JSONMarshaller jm = ctx.createJSONMarshaller();
        final StringWriter sw = new StringWriter();

        IntArray one = new IntArray();
        one.intArray = new int[] {1};
        one.integerArray = new Integer[] {2};
View Full Code Here

        tryConfiguration(JSONConfiguration.mapped().xml2JsonNs(ns2json).nsSeparator(':').rootUnwrapping(false).build());
    }

    private void tryConfiguration(JSONConfiguration configuration) throws Exception {

        final JSONJAXBContext ctx = new JSONJAXBContext(configuration, NamespaceBean.class);
        final JSONMarshaller jm = ctx.createJSONMarshaller();
        final JSONUnmarshaller ju = ctx.createJSONUnmarshaller();


        NamespaceBean beanTwo;

        final StringWriter sw = new StringWriter();
View Full Code Here

            assertTrue(caught);
        }
    }

    public void _testException(final String value) throws Exception {
        final JSONJAXBContext ctx = new JSONJAXBContext(
                JSONConfiguration.mapped().build(), Bean.class);
        final JSONMarshaller jm = ctx.createJSONMarshaller();
        final StringWriter sw = new StringWriter();
        final Writer w = new FilterWriter(sw) {
            @Override
            public void write(String str) throws IOException {
                if (str.contains(value))
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.json.JSONJAXBContext

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.