Examples of APIResponse


Examples of gwtappcontainer.shared.apis.APIResponse

    try {
      AccessController.ensureLoggedin(user);     
     
      RoleRepository.assignPrivilageToRole(role, privilege,user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "privilege [" + privilege + "] assigned to role [" + role + "]")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

        (Map<String, String>) api.getAllValidPublishedContents().object;
     
      //check if tag + "_" + city is present
      String tagForCity = tag + "_" + city;
      if (all.containsKey(tagForCity)) {
        return new APIResponse(Status.SUCCESS,
            all.get(tagForCity), "content tag = [" + tagForCity + "]");
      }
     
      //check if tag + "_" + region is present
      String tagForRegion = tag + "_" + region;
      if (all.containsKey(tagForRegion)) {
        return new APIResponse(Status.SUCCESS,
            all.get(tagForRegion), "content tag = [" + tagForRegion + "]");
      }
     
      //check if tag + "_" + country is present
      String tagForCountry = tag + "_" + country;
      if (all.containsKey(tagForCountry)) {
        return new APIResponse(Status.SUCCESS,
            all.get(tagForCountry), "content tag = [" + tagForCountry + "]");
      }
         
      //or tag + "_" + default is present
      String defaultTag = tag + "_default";
      if (all.containsKey(defaultTag)) {
        return new APIResponse(Status.SUCCESS, all.get(defaultTag),
            "content tag = [" + defaultTag + "]");
      }
     
      //return resource not found error
      APIResponse response = new APIResponse();
      response.statusCode = Status.ERROR_RESOURCE_DOES_NOT_EXIST;
      response.userFriendlyMessage = "Could find neither tag for city [" +
          tagForCity + "] nor tag for region [" + tagForRegion +
          "] nor tag for country [" + tagForCountry +
          "] nor default tag [" + defaultTag + "]. <br>" +
          "It could be that tags have empty content or content is not published.";
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }   
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

    try {
      AccessController.ensureLoggedin(user);
     
      RoleRepository.unassignPrivilageToRole(role, privilege, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "privilege [" + privilege + "] removed from role [" + role + "]")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

    try {
      AccessController.ensureLoggedin(user);     
     
      UserRepository.addUser(email, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "user [" + email + "] has been added")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.APIResponse

    try {
      AccessController.ensureLoggedin(user);
     
      UserRepository.deleteUser(email, user.getEmail());
     
      APIResponse response = new APIResponse(Status.SUCCESS,
          "success", "user [" + email + "] has been added")
     
      return response;
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

Examples of is.bokun.dtos.ApiResponse

     */
    protected void validateResponse(Response r) {
        if ( r.getStatusCode() != 200 ) {
            // try parsing an API response
            try {
                ApiResponse ar = json.readValue(r.getResponseBody("UTF-8"), ApiResponse.class);
                throw new RestServiceException(ar);
            } catch (Exception e) {
                ApiResponse ar = new ApiResponse(r.getStatusText());
                throw new RestServiceException(ar, e);
            }
        }
    }
View Full Code Here

Examples of org.zaproxy.zap.extension.api.ApiResponse

        return ApiResponseElement.OK;
    }

    @Override
    public ApiResponse handleApiView(String name, JSONObject params) throws ApiException {
        ApiResponse result = null;

        if (VIEW_REVEAL.equals(name)) {
            result = new ApiResponseElement(name, Boolean.toString(extension.isReveal()));
        } else {
            throw new ApiException(ApiException.Type.BAD_VIEW);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.