use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ReturnTypeTest method nullEntityResponse.
@GET
@Path("nullEntityResponse")
public Response nullEntityResponse() {
RuntimeDelegate rd = RuntimeDelegate.getInstance();
ResponseBuilder rb = rd.createResponseBuilder();
return rb.entity(null).build();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method getHeaders.
@POST
@Path("headers")
public Response getHeaders(String headers) {
CacheControl ccl = new CacheControl();
NewCookie cookie = new NewCookie("cookie", "eikooc");
String encoding = "gzip";
Date date = Calendar.getInstance().getTime();
ResponseBuilder builder = Response.ok();
if (headers != null && headers.length() != 0) {
builder = builder.cacheControl(ccl).cookie(cookie).encoding(encoding).expires(date).language(Locale.CANADA_FRENCH);
}
return builder.build();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method getLanguage.
@POST
@Path("language")
public Response getLanguage(String lang) {
ResponseBuilder builder = Response.ok();
Locale locale = null;
if (Locale.CANADA_FRENCH.getCountry().equals(lang))
locale = Locale.CANADA_FRENCH;
if (locale != null)
builder = builder.language(locale);
return builder.build();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method lastModified.
@POST
@Path("lastmodified")
public Response lastModified(String date) {
ResponseBuilder builder = Response.ok();
if (date != null && date.length() != 0) {
long millis = Long.parseLong(date);
Date dateFromMillis = new Date(millis);
builder = builder.lastModified(dateFromMillis);
}
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 getEntityStream.
@GET
@Path("getentitystream")
public Response getEntityStream() {
ResponseBuilder builder = createResponseWithHeader();
Response response = builder.build();
return response;
}
Aggregations