use of jakarta.ws.rs.GET in project page-factory-2 by sbtqa.
the class ClientJsonEndpoint method cookie.
@GET
@Path("cookie")
@Produces(MediaType.APPLICATION_JSON)
public Response cookie(@CookieParam(Default.COOKIE_NAME) String cookie) {
SimpleResult result = new SimpleResult();
result.setResult(cookie);
return Response.ok(result).build();
}
use of jakarta.ws.rs.GET in project OpenGrok by OpenGrok.
the class ProjectsController method getRepositories.
@GET
@Path("/{project}/repositories")
@Produces(MediaType.APPLICATION_JSON)
public List<String> getRepositories(@PathParam("project") String projectName) {
// Avoid classification as a taint bug.
projectName = Laundromat.launderInput(projectName);
Project project = env.getProjects().get(projectName);
if (project != null) {
List<RepositoryInfo> infos = env.getProjectRepositoriesMap().get(project);
if (infos != null) {
return infos.stream().map(RepositoryInfo::getDirectoryNameRelative).collect(Collectors.toList());
}
}
return Collections.emptyList();
}
use of jakarta.ws.rs.GET 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.GET in project page-factory-2 by sbtqa.
the class ClientJsonEndpoint method getWithParams.
@GET
@Path("get-with-params-placeholder")
@Produces(MediaType.APPLICATION_JSON)
public Response getWithParams(@HeaderParam(Default.HEADER_PARAMETER_NAME_1) String header1, @HeaderParam("header2") String header2, @QueryParam(Default.QUERY_PARAMETER_NAME_1) String query) {
SimpleResult result = new SimpleResult();
result.setResult(query + header1 + header2);
return Response.ok(result).build();
}
use of jakarta.ws.rs.GET in project OpenGrok by OpenGrok.
the class ProjectsController method getRepositoriesType.
@GET
@Path("/{project}/repositories/type")
@Produces(MediaType.APPLICATION_JSON)
public Set<String> getRepositoriesType(@PathParam("project") String projectName) {
// Avoid classification as a taint bug.
projectName = Laundromat.launderInput(projectName);
Project project = env.getProjects().get(projectName);
if (project != null) {
List<RepositoryInfo> infos = env.getProjectRepositoriesMap().get(project);
if (infos != null) {
return infos.stream().map(RepositoryInfo::getType).collect(Collectors.toSet());
}
}
return Collections.emptySet();
}
Aggregations