Search in sources :

Example 1 with ContextOperation

use of ee.jakarta.tck.ws.rs.ee.rs.ext.interceptor.writer.writerinterceptorcontext.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 GETHEADERS:
            for (int i = 0; i != 5; i++) builder = builder.header(TemplateInterceptorBody.PROPERTY + i, "any");
            break;
        case PROCEEDTHROWSWEBAPPEXCEPTION:
            builder.entity(new OnWriteExceptionThrowingStringBean(TemplateInterceptorBody.ENTITY));
            break;
        default:
            break;
    }
    Response response = builder.build();
    return response;
}
Also used : Response(jakarta.ws.rs.core.Response) ContextOperation(ee.jakarta.tck.ws.rs.ee.rs.ext.interceptor.writer.writerinterceptorcontext.ContextOperation) OnWriteExceptionThrowingStringBean(ee.jakarta.tck.ws.rs.ee.rs.ext.interceptor.writer.writerinterceptorcontext.OnWriteExceptionThrowingStringBean) ResponseBuilder(jakarta.ws.rs.core.Response.ResponseBuilder) Path(jakarta.ws.rs.Path) GET(jakarta.ws.rs.GET)

Aggregations

ContextOperation (ee.jakarta.tck.ws.rs.ee.rs.ext.interceptor.writer.writerinterceptorcontext.ContextOperation)1 OnWriteExceptionThrowingStringBean (ee.jakarta.tck.ws.rs.ee.rs.ext.interceptor.writer.writerinterceptorcontext.OnWriteExceptionThrowingStringBean)1 GET (jakarta.ws.rs.GET)1 Path (jakarta.ws.rs.Path)1 Response (jakarta.ws.rs.core.Response)1 ResponseBuilder (jakarta.ws.rs.core.Response.ResponseBuilder)1