use of jakarta.ws.rs.DELETE in project OpenGrok by OpenGrok.
the class ProjectsController method deleteProject.
@DELETE
@Path("/{project}")
public Response deleteProject(@Context HttpServletRequest request, @PathParam("project") String projectNameParam) {
// Avoid classification as a taint bug.
final String projectName = Laundromat.launderInput(projectNameParam);
Project project = disableProject(projectName);
LOGGER.log(Level.INFO, "deleting configuration for project {0}", projectName);
return ApiTaskManager.getInstance().submitApiTask(PROJECTS_PATH, new ApiTask(request.getRequestURI(), () -> {
deleteProjectWorkHorse(projectName, project);
return null;
}, Response.Status.NO_CONTENT));
}
use of jakarta.ws.rs.DELETE in project OpenGrok by OpenGrok.
the class ProjectsController method deleteProjectData.
@DELETE
@Path("/{project}/data")
public Response deleteProjectData(@Context HttpServletRequest request, @PathParam("project") String projectNameParam) {
// Avoid classification as a taint bug.
final String projectName = Laundromat.launderInput(projectNameParam);
disableProject(projectName);
return ApiTaskManager.getInstance().submitApiTask(PROJECTS_PATH, new ApiTask(request.getRequestURI(), () -> {
deleteProjectDataWorkHorse(projectName, false);
return null;
}, Response.Status.NO_CONTENT));
}
use of jakarta.ws.rs.DELETE in project OpenGrok by OpenGrok.
the class ProjectsController method deleteHistoryCacheWorkHorse.
private void deleteHistoryCacheWorkHorse(String projectName, boolean clearHistoryGuru) {
Project project = disableProject(projectName);
LOGGER.log(Level.INFO, "deleting history cache for project {0}", projectName);
List<RepositoryInfo> repos = env.getProjectRepositoriesMap().get(project);
if (repos == null || repos.isEmpty()) {
LOGGER.log(Level.INFO, "history cache for project {0} is not present", projectName);
return;
}
// Delete history cache data.
HistoryGuru guru = HistoryGuru.getInstance();
guru.removeCache(repos.stream().map(x -> {
try {
return env.getPathRelativeToSourceRoot(new File((x).getDirectoryName()));
} catch (ForbiddenSymlinkException e) {
LOGGER.log(Level.FINER, e.getMessage());
return "";
} catch (IOException e) {
LOGGER.log(Level.WARNING, "cannot remove files for repository {0}", x.getDirectoryName());
// {@code removeCache()} will return nothing.
return "";
}
}).filter(x -> !x.isEmpty()).collect(Collectors.toSet()), clearHistoryGuru);
}
use of jakarta.ws.rs.DELETE in project OpenGrok by OpenGrok.
the class StatusController method delete.
@DELETE
@Path("/{uuid}")
public Response delete(@PathParam("uuid") String uuid) {
ApiTask apiTask = ApiTaskManager.getInstance().getApiTask(uuid);
if (apiTask == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
if (!apiTask.isDone()) {
LOGGER.log(Level.WARNING, "API task {0} not yet done", apiTask);
return Response.status(Response.Status.BAD_REQUEST).build();
}
ApiTaskManager.getInstance().deleteApiTask(uuid);
return Response.ok().build();
}
use of jakarta.ws.rs.DELETE in project page-factory-2 by sbtqa.
the class ClientJsonEndpoint method delete.
@DELETE
@Path("delete-client")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(@QueryParam("client") String param) {
SimpleResult result = new SimpleResult();
result.setResult(param);
return Response.ok(result).build();
}
Aggregations