use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method getEntityType.
@POST
@Path("getentitytype")
public Response getEntityType(String type) {
ResponseBuilder builder = createResponseWithHeader();
Object entity = null;
String content = "ENTity";
if ("string".equals(type))
entity = content;
else if ("bytearray".equals(type))
entity = content.getBytes();
else if ("inputstream".equals(type))
entity = new ByteArrayInputStream(content.getBytes());
builder = builder.entity(entity);
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 getAllowedMethods.
@Path("getallowedmethods")
@GET
public Response getAllowedMethods() {
ResponseBuilder builder = createResponseWithHeader();
Response response = builder.allow("OPTIONS", "TRACE").build();
return response;
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class Resource method getEntityAnnotations.
@POST
@Path("getentityannotations")
public Response getEntityAnnotations(String setEntity) {
Annotation[] annotations = ResponseFilter.class.getAnnotations();
ResponseBuilder builder = createResponseWithHeader();
if (Boolean.parseBoolean(setEntity))
builder = builder.entity("entity", annotations);
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 getEntityClass.
@POST
@Path("getentityclass")
public Response getEntityClass(String clazz) {
String content = "ENTity";
ResponseBuilder builder = createResponseWithHeader();
Object entity = null;
if ("string".equals(clazz))
entity = content;
else if ("bytearray".equals(clazz))
entity = content.getBytes();
else if ("inputstream".equals(clazz))
entity = new ByteArrayInputStream(content.getBytes());
builder = builder.entity(entity);
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 set.
@POST
@Path("Set")
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response set(String content) {
ResponseBuilder rb = Response.ok();
if (content != null) {
String[] cookies1 = content.split(";");
for (String cookie : cookies1) {
// name=0, value=1
String[] nameVal = cookie.split("=");
rb.cookie(new NewCookie(nameVal[0], nameVal[1]));
}
}
return rb.build();
}
Aggregations