use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method getCookies.
@Path("getcookies")
@GET
public Response getCookies() {
NewCookie cookie = new NewCookie(ResponseFilter.COOKIENAME, ResponseFilter.COOKIENAME);
ResponseBuilder builder = createResponseWithHeader();
Response response = builder.cookie(cookie).build();
return response;
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method createResponseWithHeader.
// //////////////////////////////////////////////////////////////////
private ResponseBuilder createResponseWithHeader() {
// get value of @Path(value)
List<PathSegment> segments = info.getPathSegments();
PathSegment last = segments.get(segments.size() - 1);
// convert the value to ContextOperation
ContextOperation op = ContextOperation.valueOf(last.getPath().toUpperCase());
Response.ResponseBuilder builder = Response.ok();
// set a header with ContextOperation so that the filter knows what to
// do
builder = builder.header(ResponseFilter.OPERATION, op.name());
return builder;
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method setStatus.
@POST
@Path("setstatus")
public Response setStatus(String status) {
ResponseBuilder builder = createResponseWithHeader();
Response response = builder.entity(status).build();
return response;
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method getEntity.
@POST
@Path("getentity")
public Response getEntity(String entity) {
ResponseBuilder builder = createResponseWithHeader();
if (entity != null && entity.length() != 0)
builder = builder.entity(entity.getBytes());
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 getEntityAnnotationsOnEntity.
@POST
@Path("getentityannotationsonentity")
public Response getEntityAnnotationsOnEntity(String entity) {
ResponseBuilder builder = createResponseWithHeader();
builder = builder.entity(new StringBeanWithAnnotation(entity));
Response response = builder.build();
return response;
}
Aggregations