Examples of JsonConfig


Examples of net.sf.json.JsonConfig

   */
  @RequestMapping("/getAllScript.do")
  @ResponseBody
  public String getAllScript() throws Exception {
    List<Script> scripts = das.queryAllScripts();
    JsonConfig config = new JsonConfig()
        config.registerJsonValueProcessor(Timestamp.class, new DateJsonValueProcessor());
    JSONArray json = JSONArray.fromObject(scripts,config);
    return json.toString();
  }
View Full Code Here

Examples of net.sf.json.JsonConfig

    response.setContentType("application/json");
    response.getWriter().print(jsonObject.toString());
  }
 
  public static void respons2JsonArrayHibernate(HttpServletResponse response, Object json) throws IOException {
    JsonConfig jsonConfig = new JsonConfig()
    jsonConfig.setExcludes(new String[]{"delegate"})
    jsonConfig.setExcludes(new String[]{"transactionTimeout"});
    jsonConfig.registerJsonBeanProcessor(org.hibernate.proxy.HibernateProxy.class, new HibernateJsonBeanProcessor());
    jsonConfig.setJsonBeanProcessorMatcher(new HibernateJsonBeanProcessorMatcher());
    JSON jsonObject = JSONSerializer.toJSON(json,jsonConfig);
    response.setContentType("application/json");
    response.getWriter().print(jsonObject.toString());
  }
View Full Code Here

Examples of net.sf.json.JsonConfig

        /**
         * Renders HTTP response.
         */
        public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
            // Date needs to be converted into iso-8601 date format.
            JsonConfig config = new JsonConfig();
            config.registerJsonValueProcessor(Date.class, new JsonValueProcessor() {

                public synchronized Object processArrayValue(Object value, JsonConfig jsonConfig) {
                    if (value != null){
                       DateFormat dateFormat = new SimpleDateFormat("MMM dd yyyy HH:mm:ss 'GMT'Z", Functions.getClientLocale());
                       return dateFormat.format(value);
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.