use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class BuilderClientIT method allowStringArrayTruncateDuplicatesTest.
/*
* @testName: allowStringArrayTruncateDuplicatesTest
*
* @assertion_ids: JAXRS:JAVADOC:875;
*
* @test_Strategy: Set the list of allowed methods for the resource.
*/
@Test
public void allowStringArrayTruncateDuplicatesTest() throws Fault {
String[] methods = { Request.OPTIONS.name(), Request.OPTIONS.name() };
ResponseBuilder rb = RuntimeDelegate.getInstance().createResponseBuilder();
Response response = rb.allow(methods).build();
Set<String> set = response.getAllowedMethods();
assertEqualsInt(1, set.size(), "Only one allow method should be present");
assertEquals(set.iterator().next(), Request.OPTIONS.name(), Request.OPTIONS.name(), "has not been found in allowed methods");
logMsg(Request.OPTIONS.name(), "has been found in allowed methods");
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getGenericTypeTest.
/*
* @testName: getGenericTypeTest
*
* @assertion_ids: JAXRS:JAVADOC:904; JAXRS:JAVADOC:920; JAXRS:SPEC:85;
*
* @test_Strategy: Get an array of the annotations formally declared on the
* artifact that initiated the intercepted entity provider invocation.
*
* If abortWith is invoked, execution is aborted
*/
@Test
public void getGenericTypeTest() throws Fault {
ResponseBuilder builder = createResponse(ContextOperation.GETGENERICTYPE);
Response fake = builder.build();
addProviders(fake);
setProperty(Property.SEARCH_STRING, String.class.getName());
invoke();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method statusTest.
@GET
@Path("status")
@Produces(value = "text/plain")
public Response statusTest(@QueryParam("status") int status) {
StringBuffer sb = new StringBuffer();
sb.append("status code in request = " + status);
ResponseBuilder builder = Response.status(status);
Response res = builder.header("TESTHEADER", sb.toString()).build();
return res;
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method getHeaderString.
@POST
@Path("headerstring")
public Response getHeaderString(String headers) {
StringBuilder builder = new StringBuilder("s1");
StringBuffer buffer = new StringBuffer("s2");
StringBean bean = new StringBean("s3");
ResponseBuilder response = Response.ok();
if (headers != null && headers.length() != 0)
response = response.header(builder.toString(), builder).header(buffer.toString(), buffer).header(bean.get(), bean);
return response.build();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method getEntityTag.
@POST
@Path("entitytag")
public Response getEntityTag(String tag) {
ResponseBuilder builder;
if (tag != null && tag.length() != 0) {
EntityTag entityTag = new EntityTag(tag);
builder = Response.notModified(entityTag);
} else
builder = Response.ok();
Response response = builder.build();
return response;
}
Aggregations