use of ee.jakarta.tck.ws.rs.api.rs.ext.interceptor.ContextOperation in project jaxrs-api by eclipse-ee4j.
the class Resource method genericResponse.
@GET
@Path("{id}")
public Response genericResponse(@PathParam("id") String path) {
ContextOperation op = ContextOperation.valueOf(path.toUpperCase());
ResponseBuilder builder = createResponseBuilderWithHeader(op);
switch(op) {
case GETANNOTATIONS:
Annotation[] annotations = ContextOperation.class.getAnnotations();
builder = builder.entity(TemplateInterceptorBody.ENTITY, annotations);
break;
case GETMEDIATYPE:
builder = builder.type(MediaType.APPLICATION_JSON_TYPE);
break;
case SETTYPE:
ByteArrayInputStream bais = new ByteArrayInputStream(TemplateInterceptorBody.ENTITY.getBytes());
Reader reader = new InputStreamReader(bais);
builder = builder.entity(reader);
break;
default:
break;
}
Response response = builder.build();
return response;
}
Aggregations