Package com.sun.jersey.api.json

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


    assertFalse(json.contains("principal"));
    assertFalse(json.contains("encodedPrincipal"));
  }

  private String marshallToJson(AccessToken token) throws JAXBException {
    JSONJAXBContext context = new JSONJAXBContext(AccessToken.class);
    JSONMarshaller marshaller = context.createJSONMarshaller();

    StringWriter writer = new StringWriter();
    marshaller.marshallToJSON(token, writer);

    return writer.toString();
View Full Code Here


  public ZooKeeperAuthenticator(HBaseConfiguration conf,
      ZooKeeperWrapper wrapper) throws IOException {
    this.usersZNode = conf.get("stargate.auth.zk.users", USERS_ZNODE_ROOT);
    this.wrapper = wrapper;
    try {
      this.context = new JSONJAXBContext(JSONConfiguration.natural().build(),
        UserModel.class);
      this.unmarshaller = context.createJSONUnmarshaller();
    } catch (Exception e) {
      throw new IOException(e);
    }
View Full Code Here

   
    public StatusReporter(int period, AtomicBoolean stopping)
        throws IOException {
      super(period, stopping);
        try {
          context = new JSONJAXBContext(StatusModel.class);
          marshaller = context.createJSONMarshaller();
        } catch (JAXBException e) {
          throw new IOException(e);
        }
    }
View Full Code Here

  @Override
  public void setUp() throws Exception {
    super.setUp();
    authenticator = new ZooKeeperAuthenticator(conf);
    ZooKeeper zk = authenticator.wrapper.getZooKeeper();
    JSONJAXBContext context =
      new JSONJAXBContext(JSONConfiguration.natural().build(),
          UserModel.class);
    JSONMarshaller marshaller = context.createJSONMarshaller();
    if (zk.exists(ZooKeeperAuthenticator.USERS_ZNODE_ROOT + "/" +
          ADMIN_TOKEN, null) == null) {
      UserModel model = new UserModel();
      model.name = ADMIN_USERNAME;
      model.admin = true;
View Full Code Here

    return;
  }

  private static String appStateToJSON(AppState state) throws Exception {
    StringWriter sw = new StringWriter();
    JSONJAXBContext ctx = new JSONJAXBContext(AppState.class);
    JSONMarshaller jm = ctx.createJSONMarshaller();
    jm.marshallToJSON(state, sw);
    return sw.toString();
  }
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

          Map props = new HashMap<String, Object>();
          props.put(JSONJAXBContext.JSON_NOTATION, JSONJAXBContext.JSONNotation.MAPPED);
          props.put(JSONJAXBContext.JSON_ROOT_UNWRAPPING, Boolean.TRUE);
          props.put(JSONJAXBContext.JSON_ARRAYS, jsonArray);
          this.types = new HashSet<Class<?>>(Arrays.asList(classTypes));
          this.context = new JSONJAXBContext(classTypes, props);
      }
View Full Code Here

          Map props = new HashMap<String, Object>();
          props.put(JSONJAXBContext.JSON_NOTATION, JSONJAXBContext.JSONNotation.MAPPED);
          props.put(JSONJAXBContext.JSON_ROOT_UNWRAPPING, Boolean.TRUE);
          props.put(JSONJAXBContext.JSON_ARRAYS, jsonArray);
          this.types = new HashSet<Class<?>>(Arrays.asList(classTypes));
          this.context = new JSONJAXBContext(classTypes, props);
      }
View Full Code Here

        Map<String, Object> props = new HashMap<String, Object>();
        //props.put(JSONJAXBContext.JSON_NOTATION, "MAPPED");
        props.put(JSONJAXBContext.JSON_ROOT_UNWRAPPING, Boolean.TRUE);
        props.put(JSONJAXBContext.JSON_NON_STRINGS, "[\"number\"]");

        this.context = new JSONJAXBContext(getJaxbClasses(), props);
    }
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.