Examples of JsonConfig


Examples of net.sf.json.JsonConfig

        helper = new Helper();
    }

    public void sendContent(PropFindableResource wrappedResource, String encodedUrl, OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException, NotAuthorizedException {
        log.debug("sendContent: " + encodedUrl);
        JsonConfig cfg = new JsonConfig();
        cfg.setIgnoreTransientFields(true);
        cfg.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);

        JSON json;
        Writer writer = new PrintWriter(out);
        String[] arr;
        if (propertyBuilder == null) {
View Full Code Here

Examples of net.sf.json.JsonConfig

        this.patchHandler = patchHandler;
    }

    public void sendContent( OutputStream out, Range range, Map<String, String> params, String contentType ) throws IOException, NotAuthorizedException {
        log.debug( "sendContent");
        JsonConfig cfg = new JsonConfig();
        cfg.setIgnoreTransientFields( true );
        cfg.setCycleDetectionStrategy( CycleDetectionStrategy.LENIENT );

        List<FieldError> errors = new ArrayList<FieldError>();
        if( resp != null && resp.getErrorProperties() != null ) {
            log.debug( "error props: " + resp.getErrorProperties().size());
            for( Status stat : resp.getErrorProperties().keySet() ) {
View Full Code Here

Examples of net.sf.json.JsonConfig

     * @param contentType
     * @throws IOException
     * @throws NotAuthorizedException
     */
    public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException, NotAuthorizedException {
        JsonConfig cfg = new JsonConfig();
        cfg.setIgnoreTransientFields(true);
        cfg.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);

        NewFile[] arr;
        if (newFiles != null) {
            arr = new NewFile[newFiles.size()];
        } else {
View Full Code Here

Examples of net.sf.json.JsonConfig

    return JSONSerializer.toJava(json, jsonConfig);
  }

  // 灏咼ava瀵硅薄杞崲鎴怞SON瀵硅薄
  public static JSONObject toJSONObject(Object object) {
    JsonConfig jsonConfig = new JsonConfig();
    return (JSONObject) JSONSerializer.toJSON(object, jsonConfig);
  }
View Full Code Here

Examples of net.sf.json.JsonConfig

  public static void main(String[] args) {
    JsDateJsonBeanProcessor beanProcessor = new JsDateJsonBeanProcessor();
        java.sql.Date d = new java.sql.Date(System.currentTimeMillis());

        // 直接序列化
        JsonConfig config = new JsonConfig();
        JSONObject json = beanProcessor.processBean(d, config);
        System.out.println(json.toString());
       
        Vector v = new Vector();
        v.add("1");
View Full Code Here

Examples of net.sf.json.JsonConfig

    Long financeMoneyDetailId = StringUtil.getLongValue(request, "id");
    try {
      currentUserName = UserUtil.getCurrentUserName(request);
      FinanceMoneyDetail financeMoneyDetail = (FinanceMoneyDetail) getBaseManager().get(FinanceMoneyDetail.class,
          financeMoneyDetailId);
      JsonConfig config = new JsonConfig();
      // 注册日期解析器
      config.registerJsonValueProcessor(java.sql.Date.class, new JsonDateToStringProcessorImpl());
      config.registerJsonValueProcessor(java.util.Date.class, new JsonDateToStringProcessorImpl());
      config.registerJsonValueProcessor(java.sql.Timestamp.class, new JsonDateToStringProcessorImpl());
      // 忽略父子级别关联
      config.setJsonPropertyFilter(new PropertyFilter() {
        public boolean apply(Object source, String name, Object value) {
          if (name.equals("parentGroup") || name.equals("childGroups")) {
            return true;
          } else {
            return false;
View Full Code Here

Examples of net.sf.json.JsonConfig

      HttpServletResponse response) throws Exception {
    Long iouserId = StringUtil.getLongValue(request, "id");
    String currentUserName = null;
    try {
      currentUserName = UserUtil.getCurrentUserName(request);
      JsonConfig config = new JsonConfig();
      config.registerJsonValueProcessor(java.sql.Timestamp.class, new JsonDateToStringProcessorImpl());
      config.setJsonPropertyFilter(new PropertyFilter(){
        public boolean apply(Object source, String name, Object value) {
          if(name.equals("parentGroup") || name.equals("childGroups")) {
            return true;
          } else {
            return false;
View Full Code Here

Examples of net.sf.json.JsonConfig

      HttpServletResponse response) throws Exception {
    Long groupId = StringUtil.getLongValue(request, "id");
    String currentUserName = null;
    try {
      currentUserName = UserUtil.getCurrentUserName(request);
      JsonConfig config = new JsonConfig();
      config.registerJsonValueProcessor(java.sql.Timestamp.class, new JsonDateToStringProcessorImpl());
      config.setJsonPropertyFilter(new PropertyFilter(){
        public boolean apply(Object source, String name, Object value) {
          if(name.equals("parentGroup") || name.equals("childGroups")) {
            return true;
          } else {
            return false;
View Full Code Here

Examples of net.sf.json.JsonConfig

    @Test
    public void testJSON() throws Exception {
        List<String> lines = IOUtils.readLines(this.getClass().getClassLoader().getResourceAsStream("VAB8339-00095.json"));
        JSONObject jo = (JSONObject) JSONSerializer.toJSON(StringUtils.join(lines, "\n"));
        assertNotNull(jo);
        JsonConfig config = new JsonConfig();
        config.setExcludes(new String[] {"item"});
        JSONObject jo2 = JSONObject.fromObject(jo, config);
        assertNotNull(jo2);
    }
View Full Code Here

Examples of net.sf.json.JsonConfig

    String jsonString;

    if (data == null) {
      jsonString = "{}";
    } else {
      JsonConfig jsonConfig = new JsonConfig();
      jsonConfig.setExcludes(excludes);
      jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
      jsonConfig.setJsonPropertyFilter(ignoreNullFilter);
      Object jsObj = JSONSerializer.toJSON(data, jsonConfig);
      jsonString = jsObj.toString();
    }

    try {
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.