Search in sources :

Example 1 with POST

use of jakarta.ws.rs.POST 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 POST

use of jakarta.ws.rs.POST 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 3 with POST

use of jakarta.ws.rs.POST 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)

Example 4 with POST

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

the class ClientJsonEndpoint method requestFromFeature2.

@POST
@Path("request-from-feature-2")
@Produces(MediaType.APPLICATION_JSON)
public Response requestFromFeature2(@QueryParam("q2") String query1, @QueryParam("query-parameter-value-1") String query2, @HeaderParam("h") String header1, @HeaderParam("Content-Type") String header2, Client client) {
    SimpleResult result = new SimpleResult();
    result.setResult(String.format("q1=%s|q2=%s|h1=%s|h2=%s|id=%s|name=%s|email=%s|", 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 5 with POST

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

the class SystemController method loadPathDescriptions.

@POST
@Path("/pathdesc")
@Consumes(MediaType.APPLICATION_JSON)
public void loadPathDescriptions(@Valid final PathDescription[] descriptions) throws IOException {
    EftarFile ef = new EftarFile();
    ef.create(Set.of(descriptions), env.getDtagsEftarPath().toString());
    LOGGER.log(Level.INFO, "reloaded path descriptions with {0} entries", descriptions.length);
}
Also used : EftarFile(org.opengrok.indexer.web.EftarFile) Path(jakarta.ws.rs.Path) POST(jakarta.ws.rs.POST) Consumes(jakarta.ws.rs.Consumes)

Aggregations

POST (jakarta.ws.rs.POST)48 Path (jakarta.ws.rs.Path)46 Response (jakarta.ws.rs.core.Response)27 ResponseBuilder (jakarta.ws.rs.core.Response.ResponseBuilder)27 Consumes (jakarta.ws.rs.Consumes)9 Produces (jakarta.ws.rs.Produces)8 Date (java.util.Date)6 SimpleResult (ru.sbtqa.tag.api.dto.SimpleResult)6 Link (jakarta.ws.rs.core.Link)3 Status (jakarta.ws.rs.core.Response.Status)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 BasicDBObject (com.mongodb.BasicDBObject)2 StringBean (ee.jakarta.tck.ws.rs.common.provider.StringBean)2 StringBeanWithAnnotation (ee.jakarta.tck.ws.rs.common.provider.StringBeanWithAnnotation)2 EntityTag (jakarta.ws.rs.core.EntityTag)2 MediaType (jakarta.ws.rs.core.MediaType)2 NewCookie (jakarta.ws.rs.core.NewCookie)2 Annotation (java.lang.annotation.Annotation)2 URI (java.net.URI)2 BasicDBList (com.mongodb.BasicDBList)1