Package com.fasterxml.jackson.databind.util

Examples of com.fasterxml.jackson.databind.util.JSONPObject


        resp.setStatus(HttpServletResponse.SC_OK);
       
        final OutputStream output = resp.getOutputStream();
        try {
            if (jsonpParamName != null && req.getParameter(jsonpParamName) != null) {
                getWriter(req).writeValue(output, new JSONPObject(req.getParameter(jsonpParamName), registry));
            } else {
                getWriter(req).writeValue(output, registry);
            }
        } finally {
            output.close();
View Full Code Here


     *
     * @param function jsonp回调方法名
     * @param target 转换为jsonp的对象
     */
  public String toJsonP(String function, Object target) {
    return toJson(new JSONPObject(function, target));
  }
View Full Code Here

   
    public void testSimpleScalars() throws Exception
    {
        ObjectMapper m = new ObjectMapper();
        assertEquals("callback(\"abc\")",
                serializeAsString(m, new JSONPObject("callback", "abc")));
        assertEquals("calc(123)",
                serializeAsString(m, new JSONPObject("calc", Integer.valueOf(123))));
        assertEquals("dummy(null)",
                serializeAsString(m, new JSONPObject("dummy", null)));
    }
View Full Code Here

    public void testSimpleBean() throws Exception
    {
        ObjectMapper m = new ObjectMapper();
        assertEquals("xxx({\"a\":\"123\",\"b\":\"456\"})",
                serializeAsString(m, new JSONPObject("xxx",
                        new Impl("123", "456"))));
    }
View Full Code Here

    {
        ObjectMapper m = new ObjectMapper();
        Object ob = new Impl("abc", "def");
        JavaType type = TypeFactory.defaultInstance().uncheckedSimpleType(Base.class);
        assertEquals("do({\"a\":\"abc\"})",
                serializeAsString(m, new JSONPObject("do", ob, type)));
    }
View Full Code Here

            // full prefix+suffix?
            if (_jsonp.prefix != null || _jsonp.suffix != null) {
                return new JSONWrappedObject(_jsonp.prefix, _jsonp.suffix, value);
            }
            if (_jsonp.method != null) {
                return new JSONPObject(_jsonp.method, value);
            }
        }
        return value;
    }
View Full Code Here

        ObjectNode localizedResources = resourcesMap.get(locale);
        if (localizedResources == null) {
            log.info("Creating locale resources for {}, consider doing this on initialization", locale);
            resourcesMap.putIfAbsent(locale, prepareLocalizedResources(locale));
        }
        return new JSONPObject("R.registerResources", resourcesMap.get(locale));
    }
View Full Code Here

        this.processDefinitionId = processDefinitionId;
        this.processInstanceId = processInstanceId;

        ObjectNode diagram = getDiagram();

        return new JSONPObject(callback, diagram);
    }
View Full Code Here

        init();
        this.processInstanceId = processInstanceId;

        ObjectNode highlighted = getHighlighted();

        return new JSONPObject(callback, highlighted);
    }
View Full Code Here

            partyEntityDto.setName(partyEntity.getName());

            partyEntityDtos.add(partyEntityDto);
        }

        return new JSONPObject(callback, partyEntityDtos);
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.util.JSONPObject

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.