Search in sources :

Example 51 with Produces

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();
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 52 with Produces

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;
    }
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 53 with Produces

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();
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 54 with Produces

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;
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) LocationImpl(io.typefox.lsapi.impl.LocationImpl) Location(io.typefox.lsapi.Location) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 55 with Produces

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);
    }
}
Also used : CellSetModel(org.apache.hadoop.hbase.rest.model.CellSetModel) RowModel(org.apache.hadoop.hbase.rest.model.RowModel) CellModel(org.apache.hadoop.hbase.rest.model.CellModel) Cell(org.apache.hadoop.hbase.Cell) IOException(java.io.IOException) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

Produces (javax.ws.rs.Produces)1150 Path (javax.ws.rs.Path)844 GET (javax.ws.rs.GET)724 Consumes (javax.ws.rs.Consumes)306 POST (javax.ws.rs.POST)304 ApiOperation (io.swagger.annotations.ApiOperation)275 ApiResponses (io.swagger.annotations.ApiResponses)218 IOException (java.io.IOException)143 Response (javax.ws.rs.core.Response)139 WebApplicationException (javax.ws.rs.WebApplicationException)115 URI (java.net.URI)110 TimedResource (org.killbill.commons.metrics.TimedResource)109 Timed (com.codahale.metrics.annotation.Timed)103 ArrayList (java.util.ArrayList)91 PUT (javax.ws.rs.PUT)89 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)85 HashMap (java.util.HashMap)68 Map (java.util.Map)63 UUID (java.util.UUID)63 DELETE (javax.ws.rs.DELETE)62