use of jakarta.ws.rs.PUT in project page-factory-2 by sbtqa.
the class ClientJsonEndpoint method put.
@PUT
@Path("put")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response put(Client client) {
SimpleResult result = new SimpleResult();
result.setResult(client.getId() + client.getName() + client.getEmail());
return Response.ok(result).build();
}
use of jakarta.ws.rs.PUT in project OpenGrok by OpenGrok.
the class ProjectsController method markIndexed.
@PUT
@Path("/{project}/indexed")
@Consumes(MediaType.TEXT_PLAIN)
public Response markIndexed(@Context HttpServletRequest request, @PathParam("project") String projectNameParam) {
// Avoid classification as a taint bug.
final String projectName = Laundromat.launderInput(projectNameParam);
Project project = env.getProjects().get(projectName);
if (project == null) {
LOGGER.log(Level.WARNING, "cannot find project {0} to mark as indexed", projectName);
throw new NotFoundException(String.format("project '%s' does not exist", projectName));
}
project.setIndexed(true);
return ApiTaskManager.getInstance().submitApiTask(PROJECTS_PATH, new ApiTask(request.getRequestURI(), () -> {
// Refresh current version of the project's repositories.
List<RepositoryInfo> riList = env.getProjectRepositoriesMap().get(project);
if (riList != null) {
for (RepositoryInfo ri : riList) {
Repository repo = getRepository(ri, CommandTimeoutType.RESTFUL);
if (repo != null && repo.getCurrentVersion() != null && repo.getCurrentVersion().length() > 0) {
// getRepository() always creates fresh instance
// of the Repository object so there is no need
// to call setCurrentVersion() on it.
ri.setCurrentVersion(repo.determineCurrentVersion());
}
}
}
CompletableFuture.runAsync(() -> suggester.rebuild(projectName));
// In case this project has just been incrementally indexed,
// its IndexSearcher needs a poke.
env.maybeRefreshIndexSearchers(Collections.singleton(projectName));
env.refreshDateForLastIndexRun();
return null;
}));
}
use of jakarta.ws.rs.PUT in project OpenGrok by OpenGrok.
the class ProjectsController method set.
@PUT
@Path("/{project}/property/{field}")
public void set(@PathParam("project") String projectName, @PathParam("field") String field, final String value) throws IOException {
// Avoid classification as a taint bug.
projectName = Laundromat.launderInput(projectName);
field = Laundromat.launderInput(field);
Project project = env.getProjects().get(projectName);
if (project != null) {
// Set the property.
ClassUtil.setFieldValue(project, field, value);
// Refresh field values for project's repositories for this project as well.
List<RepositoryInfo> riList = env.getProjectRepositoriesMap().get(project);
if (riList != null) {
for (RepositoryInfo ri : riList) {
// Set the property if there is one.
if (ClassUtil.hasField(ri, field)) {
ClassUtil.setFieldValue(ri, field, value);
}
}
}
} else {
LOGGER.log(Level.WARNING, "cannot find project {0} to set a property", projectName);
}
}
Aggregations