use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method getDate.
@POST
@Path("date")
public Response getDate(String date) throws InterruptedException {
ResponseBuilder builder = Response.ok();
Thread.sleep(1500L);
if (date != null && date.length() != 0) {
long millis = Long.parseLong(date);
Date dateFromMillis = new Date(millis);
builder = builder.header(HttpHeaders.DATE, dateFromMillis);
}
Response response = builder.build();
return response;
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method getAllowedMethods.
@POST
@Path("allowedmethods")
public Response getAllowedMethods(String methods) {
ResponseBuilder builder = Response.ok();
StringTokenizer tokenizer = new StringTokenizer(methods);
List<String> allowed = new LinkedList<String>();
while (tokenizer.hasMoreTokens()) allowed.add(tokenizer.nextToken());
builder.allow(allowed.toArray(new String[0]));
return builder.build();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method getLink.
@POST
@Path("getlink")
public Response getLink(String uri) {
ResponseBuilder builder = createResponseWithHeader();
if (uri != null && uri.length() != 0) {
Link link = Link.fromUri(uri).rel(ResponseFilter.RELATION).build();
builder = builder.links(link);
}
Response response = builder.build();
return response;
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method setEntityStream.
@GET
@Path("setentitystream")
public Response setEntityStream() {
ResponseBuilder builder = createResponseWithHeader();
Response response = builder.build();
return response;
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method setEntity.
@GET
@Path("setentity")
public Response setEntity() {
ResponseBuilder builder = createResponseWithHeader();
Response response = builder.build();
return response;
}
Aggregations