Search in sources :

Example 1 with Produces

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

the class ClientJsonEndpoint method typedArrays.

@POST
@Path("typed-arrays")
@Produces(MediaType.APPLICATION_JSON)
public Response typedArrays(String request) {
    SimpleResult result = new SimpleResult();
    BasicDBObject response = (BasicDBObject) JSON.parse(request);
    result.setResult(response.toJson());
    return Response.ok(result).build();
}
Also used : BasicDBObject(com.mongodb.BasicDBObject) SimpleResult(ru.sbtqa.tag.api.dto.SimpleResult) Path(jakarta.ws.rs.Path) POST(jakarta.ws.rs.POST) Produces(jakarta.ws.rs.Produces)

Example 2 with Produces

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

the class ClientJsonEndpoint method patch.

@PATCH
@Path("patch")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response patch(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) PATCH(jakarta.ws.rs.PATCH)

Example 3 with Produces

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

the class ClientJsonEndpoint method cookie.

@GET
@Path("cookie")
@Produces(MediaType.APPLICATION_JSON)
public Response cookie(@CookieParam(Default.COOKIE_NAME) String cookie) {
    SimpleResult result = new SimpleResult();
    result.setResult(cookie);
    return Response.ok(result).build();
}
Also used : SimpleResult(ru.sbtqa.tag.api.dto.SimpleResult) Path(jakarta.ws.rs.Path) Produces(jakarta.ws.rs.Produces) GET(jakarta.ws.rs.GET)

Example 4 with Produces

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

the class ClientJsonEndpoint method form.

@POST
@Path("form")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
public Response form(@FormParam("id") int id, @FormParam("name") String name, @FormParam("email") String email) {
    SimpleResult result = new SimpleResult();
    result.setResult(id + name + email);
    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)

Example 5 with Produces

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

the class ClientJsonEndpoint method replace.

@POST
@Path("replace")
@Produces(MediaType.APPLICATION_JSON)
public Response replace(String days) {
    BasicDBObject expected = (BasicDBObject) JSON.parse("" + "{\n" + "  \"day1\": false,\n" + "  \"day11\": false,\n" + "  \"day12\": false,\n" + "  \"day13\": true,\n" + "  \"day14\": true,\n" + "  \"day15\": false\n" + "}");
    BasicDBObject actual = (BasicDBObject) JSON.parse(days);
    BasicDBObject result = new BasicDBObject();
    result.put("result", expected.equals(actual));
    return Response.ok(result.toJson()).build();
}
Also used : BasicDBObject(com.mongodb.BasicDBObject) Path(jakarta.ws.rs.Path) POST(jakarta.ws.rs.POST) 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