use of javax.ws.rs.POST in project che by eclipse.
the class ProjectService method createProject.
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Creates new project", response = ProjectConfigDto.class)
@ApiResponses({ @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 403, message = "Operation is forbidden"), @ApiResponse(code = 409, message = "Project with specified name already exist in workspace"), @ApiResponse(code = 500, message = "Server error") })
@GenerateLink(rel = LINK_REL_CREATE_PROJECT)
public /**
* NOTE: parentPath is added to make a module
*/
ProjectConfigDto createProject(@ApiParam(value = "Add to this project as module", required = false) @Context UriInfo uriInfo, @Description("descriptor of project") ProjectConfigDto projectConfig) throws ConflictException, ForbiddenException, ServerException, NotFoundException {
Map<String, String> options = new HashMap<>();
MultivaluedMap<String, String> map = uriInfo.getQueryParameters();
for (String key : map.keySet()) {
options.put(key, map.get(key).get(0));
}
String pathToProject = projectConfig.getPath();
String pathToParent = pathToProject.substring(0, pathToProject.lastIndexOf("/"));
if (!pathToParent.equals("/")) {
VirtualFileEntry parentFileEntry = projectManager.getProjectsRoot().getChild(pathToParent);
if (parentFileEntry == null) {
throw new NotFoundException("The parent folder with path " + pathToParent + " does not exist.");
}
}
final RegisteredProject project = projectManager.createProject(projectConfig, options);
final ProjectConfigDto configDto = asDto(project);
eventService.publish(new ProjectCreatedEvent(workspace, project.getPath()));
return injectProjectLinks(configDto);
}
use of javax.ws.rs.POST in project che by eclipse.
the class TextDocumentService method definition.
@POST
@Path("definition")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends Location> definition(TextDocumentPositionParamsDTO params) throws ExecutionException, InterruptedException, LanguageServerException {
params.getTextDocument().setUri(prefixURI(params.getTextDocument().getUri()));
LanguageServer server = getServer(params.getTextDocument().getUri());
if (server == null) {
return emptyList();
}
List<? extends Location> locations = server.getTextDocumentService().definition(params).get();
locations.forEach(o -> {
if (o instanceof LocationImpl) {
((LocationImpl) o).setUri(removePrefixUri(o.getUri()));
}
});
return locations;
}
use of javax.ws.rs.POST in project che by eclipse.
the class TextDocumentService method onTypeFormatting.
@POST
@Path("onTypeFormatting")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends TextEdit> onTypeFormatting(DocumentOnTypeFormattingParamsDTO params) throws InterruptedException, ExecutionException, LanguageServerException {
params.getTextDocument().setUri(prefixURI(params.getTextDocument().getUri()));
LanguageServer server = getServer(params.getTextDocument().getUri());
if (server == null) {
return emptyList();
}
return server.getTextDocumentService().onTypeFormatting(params).get();
}
use of javax.ws.rs.POST in project che by eclipse.
the class TextDocumentService method didOpen.
@POST
@Path("didOpen")
@Consumes(MediaType.APPLICATION_JSON)
public void didOpen(DidOpenTextDocumentParamsDTO openEvent) throws LanguageServerException {
openEvent.getTextDocument().setUri(prefixURI(openEvent.getTextDocument().getUri()));
openEvent.setUri(prefixURI(openEvent.getUri()));
LanguageServer server = getServer(openEvent.getTextDocument().getUri());
if (server != null) {
server.getTextDocumentService().didOpen(openEvent);
}
}
use of javax.ws.rs.POST in project che by eclipse.
the class TextDocumentService method didChange.
@POST
@Path("didChange")
@Consumes(MediaType.APPLICATION_JSON)
public void didChange(DidChangeTextDocumentParamsDTO change) throws LanguageServerException {
change.getTextDocument().setUri(prefixURI(change.getTextDocument().getUri()));
change.setUri(prefixURI(change.getUri()));
LanguageServer server = getServer(change.getTextDocument().getUri());
if (server != null) {
server.getTextDocumentService().didChange(change);
}
}
Aggregations