use of javax.ws.rs.Produces in project che by eclipse.
the class TextDocumentService method formatting.
@POST
@Path("formatting")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends TextEdit> formatting(DocumentFormattingParamsDTO 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().formatting(params).get();
}
use of javax.ws.rs.Produces in project che by eclipse.
the class TextDocumentService method hover.
@POST
@Path("hover")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Hover hover(TextDocumentPositionParamsDTO positionParams) throws LanguageServerException, ExecutionException, InterruptedException {
positionParams.getTextDocument().setUri(prefixURI(positionParams.getTextDocument().getUri()));
positionParams.setUri(prefixURI(positionParams.getUri()));
LanguageServer server = getServer(positionParams.getTextDocument().getUri());
if (server != null) {
return server.getTextDocumentService().hover(positionParams).get();
} else {
return null;
}
}
use of javax.ws.rs.Produces in project che by eclipse.
the class TextDocumentService method documentSymbol.
@POST
@Path("documentSymbol")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends SymbolInformation> documentSymbol(DocumentSymbolParamsDTO documentSymbolParams) throws ExecutionException, InterruptedException, LanguageServerException {
documentSymbolParams.getTextDocument().setUri(prefixURI(documentSymbolParams.getTextDocument().getUri()));
LanguageServer server = getServer(documentSymbolParams.getTextDocument().getUri());
if (server == null) {
return emptyList();
}
return server.getTextDocumentService().documentSymbol(documentSymbolParams).get();
}
use of javax.ws.rs.Produces in project che by eclipse.
the class WorkspaceService method documentSymbol.
@POST
@Path("symbol")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends SymbolInformation> documentSymbol(WorkspaceSymbolParamsDTO workspaceSymbolParams) throws ExecutionException, InterruptedException, LanguageServerException {
LanguageServer server = getServer(TextDocumentService.prefixURI(workspaceSymbolParams.getFileUri()));
if (server == null) {
return emptyList();
}
List<? extends SymbolInformation> informations = server.getWorkspaceService().symbol(workspaceSymbolParams).get();
informations.forEach(o -> {
Location location = o.getLocation();
if (location instanceof LocationImpl) {
((LocationImpl) location).setUri(TextDocumentService.removePrefixUri(location.getUri()));
}
});
return informations;
}
use of javax.ws.rs.Produces in project hbase by apache.
the class RowResource method get.
@GET
@Produces({ MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF, MIMETYPE_PROTOBUF_IETF })
public Response get(@Context final UriInfo uriInfo) {
if (LOG.isTraceEnabled()) {
LOG.trace("GET " + uriInfo.getAbsolutePath());
}
servlet.getMetrics().incrementRequests(1);
MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
try {
ResultGenerator generator = ResultGenerator.fromRowSpec(tableResource.getName(), rowspec, null, !params.containsKey(NOCACHE_PARAM_NAME));
if (!generator.hasNext()) {
servlet.getMetrics().incrementFailedGetRequests(1);
return Response.status(Response.Status.NOT_FOUND).type(MIMETYPE_TEXT).entity("Not found" + CRLF).build();
}
int count = 0;
CellSetModel model = new CellSetModel();
Cell value = generator.next();
byte[] rowKey = CellUtil.cloneRow(value);
RowModel rowModel = new RowModel(rowKey);
do {
if (!Bytes.equals(CellUtil.cloneRow(value), rowKey)) {
model.addRow(rowModel);
rowKey = CellUtil.cloneRow(value);
rowModel = new RowModel(rowKey);
}
rowModel.addCell(new CellModel(CellUtil.cloneFamily(value), CellUtil.cloneQualifier(value), value.getTimestamp(), CellUtil.cloneValue(value)));
if (++count > rowspec.getMaxValues()) {
break;
}
value = generator.next();
} while (value != null);
model.addRow(rowModel);
servlet.getMetrics().incrementSucessfulGetRequests(1);
return Response.ok(model).build();
} catch (Exception e) {
servlet.getMetrics().incrementFailedPutRequests(1);
return processException(e);
}
}
Aggregations