コード例 #1
0
  /** Store Call Control project information */
  @RvdAuth
  @POST
  @Path("{name}/cc")
  public Response storeCcInfo(
      @PathParam("name") String projectName, @Context HttpServletRequest request) {
    try {
      String data = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8"));
      CallControlInfo ccInfo = marshaler.toModel(data, CallControlInfo.class);
      if (ccInfo != null) FsCallControlInfoStorage.storeInfo(ccInfo, projectName, workspaceStorage);
      else FsCallControlInfoStorage.clearInfo(projectName, workspaceStorage);

      return Response.ok().build();
    } catch (IOException e) {
      logger.error(e, e);
      return Response.status(Status.INTERNAL_SERVER_ERROR).build();
    } catch (StorageException e) {
      logger.error(e, e);
      return Response.status(Status.INTERNAL_SERVER_ERROR).build();
    }
  }
コード例 #2
0
 @RvdAuth
 @GET
 @Path("{name}/cc")
 public Response getCcInfo(@PathParam("name") String projectName) {
   try {
     CallControlInfo ccInfo = FsCallControlInfoStorage.loadInfo(projectName, workspaceStorage);
     return Response.ok(marshaler.toData(ccInfo), MediaType.APPLICATION_JSON).build();
     // return buildOkResponse(ccInfo);
   } catch (StorageEntityNotFound e) {
     return Response.status(Status.NOT_FOUND).build();
   } catch (StorageException e) {
     logger.error(e, e);
     return Response.status(Status.INTERNAL_SERVER_ERROR).build();
   }
 }