users@jersey.java.net

JSONP missing external parenthesis?

From: Felipe Gaścho <fgaucho_at_gmail.com>
Date: Thu, 17 Dec 2009 18:34:01 +0100

----------- the following method is supposed to return wrapped with
parenthesis, isn't it ?

@GET
@Path("jsonp")
@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public JSONWithPadding selectAllByRoleP(
                @QueryParam("callback") String callback,
                @QueryParam(EntityFacadeConstants.PARAM_MAX)
@DefaultValue(EntityFacadeConstants.PARAM_MAX_DEFAULT_VALUE) int max,
                @QueryParam("role") String role,
                @QueryParam("comp") String competition) {
        return new JSONWithPadding(
                        new GenericEntity<Collection<PujAdvertisementEntity>>(adsFacade.getAdvertisement(competition,
role, max)) {}, callback);
}

--------- response:

curl -XGET -H "Accept:application/json"
http://fgaucho.dyndns.org:8080/arena-http/ads/jsonp?callback=dd

[{"url":"http://www.mundojava.com.br/NovoSite/default.jsp","thumbnail":"http://www.mundojava.com.br/NovoSite/images/revistanumero0038.jpg","version":1},{"url":"http://www.lcm.com.br/","thumbnail":"http://www.lcm.com.br/livros/9788573938807.jpg","version":1},{"url":"http://www.4linux.com.br/","thumbnail":"https://cejug.dev.java.net/files/documents/859/146148/4LINUX_SITE.PNG","version":1},{"url":"http://www.devmedia.com.br/assgold/listmag.asp?site=6","thumbnail":"http://www.devmedia.com.br/loja/img/capaJava74_G.jpg","version":1}]








-- 
------------------------------------------
   Felipe Gaścho
   10+ Java Programmer
   CEJUG Senior Advisor