Search in sources :

Example 16 with Produces

use of jakarta.ws.rs.Produces in project OpenGrok by OpenGrok.

the class SystemController method getIndexTime.

@GET
@Path("/indextime")
@Produces(MediaType.APPLICATION_JSON)
public String getIndexTime() throws JsonProcessingException {
    Date date = new IndexTimestamp().getDateForLastIndexRun();
    ObjectMapper mapper = new ObjectMapper();
    // StdDateFormat is ISO8601 since jackson 2.9
    mapper.setDateFormat(new StdDateFormat().withColonInTimeZone(true));
    return mapper.writeValueAsString(date);
}
Also used : IndexTimestamp(org.opengrok.indexer.configuration.IndexTimestamp) StdDateFormat(com.fasterxml.jackson.databind.util.StdDateFormat) Date(java.util.Date) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Path(jakarta.ws.rs.Path) Produces(jakarta.ws.rs.Produces) GET(jakarta.ws.rs.GET)

Example 17 with Produces

use of jakarta.ws.rs.Produces 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();
}
Also used : SimpleResult(ru.sbtqa.tag.api.dto.SimpleResult) Path(jakarta.ws.rs.Path) Consumes(jakarta.ws.rs.Consumes) Produces(jakarta.ws.rs.Produces) PUT(jakarta.ws.rs.PUT)

Example 18 with Produces

use of jakarta.ws.rs.Produces in project page-factory-2 by sbtqa.

the class ClientJsonEndpoint method requestFromFeature.

@POST
@Path("request-from-feature")
@Produces(MediaType.APPLICATION_JSON)
public Response requestFromFeature(@QueryParam(Default.QUERY_PARAMETER_NAME_1) String query1, @QueryParam(Default.QUERY_PARAMETER_NAME_2) String query2, @HeaderParam(Default.HEADER_PARAMETER_NAME_1) String header1, @HeaderParam(Default.HEADER_PARAMETER_NAME_2) String header2, Client client) {
    SimpleResult result = new SimpleResult();
    result.setResult(String.format("q1=%s|\nq2=%s|\nh1=%s|\nh2=%s|\nid=%s|\nname=%s|\nemail=%s|\n", query1, query2, header1, header2, client.getId(), client.getName(), client.getEmail()));
    return Response.ok(result).header(Default.HEADER_PARAMETER_NAME_1, header1).header(Default.HEADER_PARAMETER_NAME_2, header2).build();
}
Also used : SimpleResult(ru.sbtqa.tag.api.dto.SimpleResult) Path(jakarta.ws.rs.Path) POST(jakarta.ws.rs.POST) Produces(jakarta.ws.rs.Produces)

Example 19 with Produces

use of jakarta.ws.rs.Produces in project page-factory-2 by sbtqa.

the class ClientJsonEndpoint method delete.

@DELETE
@Path("delete-client")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(@QueryParam("client") String param) {
    SimpleResult result = new SimpleResult();
    result.setResult(param);
    return Response.ok(result).build();
}
Also used : SimpleResult(ru.sbtqa.tag.api.dto.SimpleResult) Path(jakarta.ws.rs.Path) DELETE(jakarta.ws.rs.DELETE) Produces(jakarta.ws.rs.Produces)

Example 20 with Produces

use of jakarta.ws.rs.Produces in project page-factory-2 by sbtqa.

the class ClientJsonEndpoint method postWithParams.

@POST
@Path("post")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response postWithParams(Client client) {
    SimpleResult result = new SimpleResult();
    result.setResult(client.getId() + client.getName() + client.getEmail());
    return Response.ok(result).build();
}
Also used : SimpleResult(ru.sbtqa.tag.api.dto.SimpleResult) Path(jakarta.ws.rs.Path) POST(jakarta.ws.rs.POST) Consumes(jakarta.ws.rs.Consumes) Produces(jakarta.ws.rs.Produces)

Aggregations

Produces (jakarta.ws.rs.Produces)22 Path (jakarta.ws.rs.Path)18 GET (jakarta.ws.rs.GET)12 SimpleResult (ru.sbtqa.tag.api.dto.SimpleResult)11 POST (jakarta.ws.rs.POST)7 CorsEnable (org.opengrok.web.api.v1.filter.CorsEnable)6 Consumes (jakarta.ws.rs.Consumes)4 File (java.io.File)4 PathAuthorized (org.opengrok.web.api.v1.filter.PathAuthorized)4 FileUtil.toFile (org.opengrok.web.util.FileUtil.toFile)4 WebApplicationException (jakarta.ws.rs.WebApplicationException)3 Project (org.opengrok.indexer.configuration.Project)3 BasicDBObject (com.mongodb.BasicDBObject)2 Instant (java.time.Instant)2 ArrayList (java.util.ArrayList)2 Document (org.apache.lucene.document.Document)2 RepositoryInfo (org.opengrok.indexer.history.RepositoryInfo)2 IndexDatabase.getDocument (org.opengrok.indexer.index.IndexDatabase.getDocument)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 StdDateFormat (com.fasterxml.jackson.databind.util.StdDateFormat)1