Package com.sun.jersey.api.json

Examples of com.sun.jersey.api.json.JSONWithPadding


                stat.getAversion(), stat.getEphemeralOwner(), stat
                        .getDataLength(), stat.getNumChildren(), stat
                        .getPzxid());

        return Response.status(Response.Status.OK).entity(
                new JSONWithPadding(zstat, callback)).build();
    }
View Full Code Here


        String newPath = zk.create(path, data, Ids.OPEN_ACL_UNSAFE, createMode);

        URI uri = ui.getAbsolutePathBuilder().path(newPath).build();

        return Response.created(uri).entity(
                new JSONWithPadding(new ZPath(newPath, ui.getAbsolutePath()
                        .toString()))).build();
    }
View Full Code Here

                    Response.Status.INTERNAL_SERVER_ERROR).build());
        }

        URI uri = ui.getAbsolutePathBuilder().path(uuid).build();
        return Response.created(uri).entity(
                new JSONWithPadding(new ZSession(uuid, uri.toString())))
                .build();
    }
View Full Code Here

            } else {
                child = new ZChildren(path, ui.getAbsolutePath().toString(),
                        childTemplate, children);
            }
            return Response.status(Response.Status.OK).entity(
                    new JSONWithPadding(child, callback)).build();
        } else {
            Stat stat = new Stat();
            byte[] data = zk.getData(path, false, stat);

            byte[] data64;
            String dataUtf8;
            if (data == null) {
                data64 = null;
                dataUtf8 = null;
            } else if (!dataformat.equals("utf8")){
                data64 = data;
                dataUtf8 = null;
            } else {
                data64 = null;
                dataUtf8 = new String(data);
            }
            ZStat zstat = new ZStat(path, ui.getAbsolutePath().toString(),
                    data64, dataUtf8, stat.getCzxid(),
                    stat.getMzxid(), stat.getCtime(), stat.getMtime(),
                    stat.getVersion(), stat.getCversion(),
                    stat.getAversion(), stat.getEphemeralOwner(),
                    stat.getDataLength(), stat.getNumChildren(),
                    stat.getPzxid());

            return Response.status(Response.Status.OK).entity(
                    new JSONWithPadding(zstat, callback)).build();
        }
    }
View Full Code Here

                stat.getAversion(), stat.getEphemeralOwner(),
                stat.getDataLength(), stat.getNumChildren(),
                stat.getPzxid());

        return Response.status(Response.Status.OK).entity(
                new JSONWithPadding(zstat, callback)).build();
    }
View Full Code Here

                createMode);

        URI uri = ui.getAbsolutePathBuilder().path(newPath).build();

        return Response.created(uri).entity(
                new JSONWithPadding(new ZPath(newPath,
                        ui.getAbsolutePath().toString()))).build();
    }
View Full Code Here

    final  HttpServletRequest request = resource.getRequest();
    ResponseTypeHelper responseTypeHelper = new ResponseTypeHelper();
    String responseType = responseTypeHelper.getResponseType(request);
    try
      Object responseObject = responseType.equals(MediaTypeHelper.APPLICATION_X_JAVASCRIPT) ?
          new JSONWithPadding(message, responseTypeHelper.getQueryParam(request, "callback")) : message;       
        return new BroadcastAction(
          ACTION.CONTINUE, Response.ok(responseObject, responseType).build());
    } catch (Exception e) {
      logger.error(e.getMessage());
      return new BroadcastAction(ACTION.ABORT,  message);
View Full Code Here

    logger.debug("Received HTTP GET request at '{}' for media type '{}'.", new String[] { uriInfo.getPath(), type });

    String responseType = MediaTypeHelper.getResponseMediaType(headers.getAcceptableMediaTypes(), type);
    if(responseType!=null) {
        Object responseObject = responseType.equals(MediaTypeHelper.APPLICATION_X_JAVASCRIPT) ?
            new JSONWithPadding(new ItemListBean(getItemBeans()), callback) : new ItemListBean(getItemBeans());
        return Response.ok(responseObject, responseType).build();
    } else {
      return Response.notAcceptable(null).build();
    }
    }
View Full Code Here

    logger.debug("Received HTTP GET request at '{}' for media type '{}'.", new String[] { uriInfo.getPath(), type });
    if(atmosphereTransport==null || atmosphereTransport.isEmpty()) {
      final String responseType = MediaTypeHelper.getResponseMediaType(headers.getAcceptableMediaTypes(), type);
      if(responseType!=null) {
          final Object responseObject = responseType.equals(MediaTypeHelper.APPLICATION_X_JAVASCRIPT) ?
              new JSONWithPadding(getItemDataBean(itemname), callback) : getItemDataBean(itemname);
          throw new WebApplicationException(Response.ok(responseObject, responseType).build())
   
      } else {
        throw new WebApplicationException(Response.notAcceptable(null).build());
      }
View Full Code Here

        @QueryParam("type") String type,
        @QueryParam("jsoncallback") @DefaultValue("callback") String callback) {
      String responseType = MediaTypeHelper.getResponseMediaType(headers.getAcceptableMediaTypes(), type);
      if(responseType!=null) {
        Object responseObject = responseType.equals(MediaTypeHelper.APPLICATION_X_JAVASCRIPT) ?
            new JSONWithPadding(getRootBean(), callback) : getRootBean();
        return Response.ok(responseObject, responseType).build();
      } else {
      return Response.notAcceptable(null).build();
      }
    }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.json.JSONWithPadding

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.