Package org.mortbay.util.ajax.JSON

Examples of org.mortbay.util.ajax.JSON.ReaderSource


    {
        String resource = "src/test/resources/com/dyuproject/json/test/employee.json";
        StandardJSON json = new StandardJSON();
        File file = new File(resource);
        BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        Map<String,Object> map = (Map<String,Object>)json.parse(new ReaderSource(reader));
        Employee e = (Employee)map.get("employee");
        assertTrue(e!=null);
        assertTrue("John".equals(e.getFirstName()));
        List<Task> tasks = e.getTasks();
        assertTrue(tasks!=null && tasks.size()==3);
View Full Code Here


    {
        String resource = "src/test/resources/com/dyuproject/json/test/overload_task.json";
        StandardJSON json = new StandardJSON(new OverloadConvertorCache());
        File file = new File(resource);
        BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        Map<String,Object> map = (Map<String,Object>)json.parse(new ReaderSource(reader));
        Task task = (Task)map.get("task");
        assertTrue(task!=null);
        assertTrue("10".equals(task.getStatus()));
       
        OverloadTask otask = (OverloadTask)map.get("overload_task");
View Full Code Here

    {
        String resource = "src/test/resources/com/dyuproject/json/test/employees.json";
        StandardJSON json = new StandardJSON(new OverloadConvertorCache());
        File file = new File(resource);
        BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        Map<String,Object> map = (Map<String,Object>)json.parse(new ReaderSource(reader));
        Employee e = (Employee)map.get("employee");
        BusyEmployee be = (BusyEmployee)map.get("busy_employee");
        assertTrue(e!=null);
        assertTrue(be!=null);
        assertTrue("John".equals(e.getFirstName()));
View Full Code Here

            _pojoConvertor = new ValidatingPojoConvertor(_pojoClass, _fieldParams);
    }
   
    public final boolean merge(Object pojo, RequestContext rc) throws IOException, ValidationException
    {
        Map<?,?> props = (Map<?,?>)__json.parse(new ReaderSource(rc.getRequest().getReader()));
        return props!=null && !props.isEmpty() && _pojoConvertor.setProps(pojo, props)!=0;
    }
View Full Code Here

        return props!=null && !props.isEmpty() && _pojoConvertor.setProps(pojo, props)!=0;
    }
   
    public final Object consume(RequestContext rc) throws IOException, ValidationException
    {
        Map<?,?> props = (Map<?,?>)__json.parse(new ReaderSource(rc.getRequest().getReader()));
        return props==null || props.isEmpty() ? null : _pojoConvertor.fromJSON(props);
    }
View Full Code Here

TOP

Related Classes of org.mortbay.util.ajax.JSON.ReaderSource

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.