Package com.dotcms.rest

Examples of com.dotcms.rest.InitDataObject


public class ExampleResource extends WebResource {

  @PUT
  public Response doPut(@Context HttpServletRequest request, @PathParam("params") String params) throws URISyntaxException {

    InitDataObject auth = init(null, true, request, false);
    CacheControl cc = new CacheControl();
    cc.setNoCache(true);
    User user = auth.getUser();
    String username = (user != null) ? user.getFullName() : " unknown ";
    ResponseBuilder builder = Response.ok("{\"result\":\"" + username + " PUT!\"}", "application/json");
    return builder.cacheControl(cc).build();
  }
View Full Code Here


    return builder.cacheControl(cc).build();
  }

  @POST
  public Response doPost(@Context HttpServletRequest request, @PathParam("params") String params) throws URISyntaxException {
    InitDataObject auth = init(null, true, request, false);
    User user = auth.getUser();
    String username = (user != null) ? user.getFullName() : " unknown ";
    CacheControl cc = new CacheControl();
    cc.setNoCache(true);
    ResponseBuilder builder = Response.ok("{\"result\":\"" + username + " POST!\"}", "application/json");
    return builder.cacheControl(cc).build();
View Full Code Here

  @GET
  @Path("/auth{params:.*}")
  public Response loadJson(@Context HttpServletRequest request, @PathParam("params") String params) throws DotStateException,
      DotDataException, DotSecurityException {
    // force authentication
    InitDataObject auth = init(null, true, request, true);
    User user = auth.getUser();
    String username = (user != null) ? user.getFullName() : " unknown ";
    CacheControl cc = new CacheControl();
    cc.setNoCache(true);
    ResponseBuilder builder = Response.ok("{\"result\":\"/test/" + username + " GET!\"}", "application/json");
    return builder.cacheControl(cc).build();
View Full Code Here

  }

  @GET
  public Response loadRoot(@Context HttpServletRequest request, @PathParam("params") String params) throws DotStateException,
      DotDataException, DotSecurityException {
    InitDataObject auth = init(null, true, request, false);
    User user = auth.getUser();
    String username = (user != null) ? user.getFullName() : " unknown ";
    CacheControl cc = new CacheControl();
    cc.setNoCache(true);
    ResponseBuilder builder = Response.ok("{\"result\":\"" + username + " GET!\"}", "application/json");
    return builder.cacheControl(cc).build();
View Full Code Here

TOP

Related Classes of com.dotcms.rest.InitDataObject

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.