use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method getMediaType.
@POST
@Path("getmediatype")
public Response getMediaType(String media) throws URISyntaxException {
ResponseBuilder builder = createResponseWithHeader();
if (media != null && media.length() != 0)
builder = builder.type(media);
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 getStatus.
@POST
@Path("getstatus")
public Response getStatus(String entity) {
int status = Integer.parseInt(entity);
ResponseBuilder builder = createResponseWithHeader();
Response response = builder.status(status).build();
return response;
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method setOriginalRuntime.
// We need to switch back to the original runtime delegate since
// we cannot be sure what happen when the war with our runtimedelegate gets
// undeployed
@Path("setoriginalruntime")
@GET
public Response setOriginalRuntime() {
ResponseBuilder builder = createResponseWithHeader();
RuntimeDelegate stringBeanDelegate = RuntimeDelegate.getInstance();
if (stringBeanDelegate instanceof StringBeanRuntimeDelegate) {
RuntimeDelegate original = ((StringBeanRuntimeDelegate) stringBeanDelegate).getOriginal();
RuntimeDelegate.setInstance(original);
} else
builder = builder.status(Status.NO_CONTENT);
return builder.build();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method buildResponse.
private Response buildResponse(Object content, MediaType type) {
List<String> list = headers.getRequestHeader(HEADERNAME);
String name = null;
if (list != null && list.size() != 0)
name = list.iterator().next();
ResponseBuilder builder = Response.ok(content, type).type(type);
if (name != null)
builder.header(HEADERNAME, name + DIRECTION);
return builder.build();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ReturnTypeTest method entityResponseTest.
@GET
@Path("entitybodyresponsetest")
public Response entityResponseTest() {
RuntimeDelegate rd = RuntimeDelegate.getInstance();
ResponseBuilder rb = rd.createResponseBuilder();
ReadableWritableEntity rwe = entityTest();
return rb.entity(rwe).build();
}
Aggregations