@RvdAuth
 @PUT
 @Path("{name}/rename")
 public Response renameProject(
     @PathParam("name") String projectName,
     @QueryParam("newName") String projectNewName,
     @QueryParam("ticket") String ticket)
     throws StorageException, ProjectDoesNotExist {
   if (!RvdUtils.isEmpty(projectName) && !RvdUtils.isEmpty(projectNewName)) {
     assertProjectAvailable(projectName);
     try {
       ProjectApplicationsApi applicationsApi =
           new ProjectApplicationsApi(servletContext, workspaceStorage, marshaler);
       applicationsApi.renameApplication(ticket, projectName, projectNewName);
       projectService.renameProject(projectName, projectNewName);
       return Response.ok().build();
     } catch (ProjectDirectoryAlreadyExists e) {
       logger.error(e.getMessage(), e);
       return Response.status(Status.CONFLICT).build();
     } catch (StorageException e) {
       return Response.status(Status.INTERNAL_SERVER_ERROR).build();
     } catch (ApplicationAlreadyExists e) {
       return Response.status(Status.CONFLICT).build();
     } catch (ApplicationsApiSyncException e) {
       logger.error(e.getMessage(), e);
       return Response.status(Status.INTERNAL_SERVER_ERROR).build();
     }
   } else return Response.status(Status.BAD_REQUEST).build();
 }
  @RvdAuth
  @PUT
  @Path("{name}/upgrade")
  public Response upgradeProject(@PathParam("name") String projectName) {

    // TODO IMPORTANT!!! sanitize the project name!!
    if (!RvdUtils.isEmpty(projectName)) {
      try {
        UpgradeService upgradeService = new UpgradeService(workspaceStorage);
        upgradeService.upgradeProject(projectName);
        logger.info(
            "project '"
                + projectName
                + "' upgraded to version "
                + RvdConfiguration.getRvdProjectVersion());
        // re-build project
        BuildService buildService = new BuildService(workspaceStorage);
        buildService.buildProject(projectName, activeProject);
        logger.info("project '" + projectName + "' built");
        return Response.ok().build();
      } catch (StorageException e) {
        return Response.status(Status.INTERNAL_SERVER_ERROR).build();
      } catch (UpgradeException e) {
        logger.error(e.getMessage(), e);
        return Response.status(Status.INTERNAL_SERVER_ERROR)
            .entity(e.asJson())
            .type(MediaType.APPLICATION_JSON)
            .build();
      }
    } else return Response.status(Status.BAD_REQUEST).build();
  }
  @GET
  @RvdAuth
  @Path("{name}/archive")
  public Response downloadArchive(@PathParam("name") String projectName)
      throws StorageException, ProjectDoesNotExist, UnsupportedEncodingException, EncoderException {
    logger.debug("downloading raw archive for project " + projectName);
    assertProjectAvailable(projectName);

    InputStream archiveStream;
    try {
      archiveStream = projectService.archiveProject(projectName);
      String dispositionHeader =
          "attachment; filename*=UTF-8''" + RvdUtils.myUrlEncode(projectName + ".zip");
      return Response.ok(archiveStream, "application/zip")
          .header("Content-Disposition", dispositionHeader)
          .build();

    } catch (StorageException e) {
      logger.error(e, e);
      return null;
    }
  }
 @RvdAuth
 @DELETE
 @Path("{name}")
 public Response deleteProject(
     @PathParam("name") String projectName, @QueryParam("ticket") String ticket)
     throws ProjectDoesNotExist {
   if (!RvdUtils.isEmpty(projectName)) {
     try {
       ProjectApplicationsApi applicationsApi =
           new ProjectApplicationsApi(servletContext, workspaceStorage, marshaler);
       applicationsApi.removeApplication(ticket, projectName);
       projectService.deleteProject(projectName);
       return Response.ok().build();
     } catch (StorageException e) {
       logger.error("Error deleting project '" + projectName + "'", e);
       return Response.status(Status.INTERNAL_SERVER_ERROR).build();
     } catch (ApplicationsApiSyncException e) {
       logger.error("Error deleting project '" + projectName + "' through the API", e);
       return Response.status(Status.INTERNAL_SERVER_ERROR).build();
     }
   } else return Response.status(Status.BAD_REQUEST).build();
 }