Search in sources :

Example 1 with PathSegment

use of jakarta.ws.rs.core.PathSegment in project jaxrs-api by eclipse-ee4j.

the class Resource method createResponseWithHeader.

// //////////////////////////////////////////////////////////////////
private ResponseBuilder createResponseWithHeader() {
    // get value of @Path(value)
    List<PathSegment> segments = info.getPathSegments();
    PathSegment last = segments.get(segments.size() - 1);
    // convert the value to ContextOperation
    ContextOperation op = ContextOperation.valueOf(last.getPath().toUpperCase());
    Response.ResponseBuilder builder = Response.ok();
    // set a header with ContextOperation so that the filter knows what to
    // do
    builder = builder.header(ResponseFilter.OPERATION, op.name());
    return builder;
}
Also used : Response(jakarta.ws.rs.core.Response) ResponseBuilder(jakarta.ws.rs.core.Response.ResponseBuilder) PathSegment(jakarta.ws.rs.core.PathSegment)

Example 2 with PathSegment

use of jakarta.ws.rs.core.PathSegment in project jaxrs-api by eclipse-ee4j.

the class Resource method createResponseWithHeader.

private Response createResponseWithHeader() {
    // get value of @Path(value)
    List<PathSegment> segments = info.getPathSegments();
    PathSegment last = segments.get(segments.size() - 1);
    // convert the value to ContextOperation
    ContextOperation op = ContextOperation.valueOf(last.getPath().toUpperCase());
    Response.ResponseBuilder builder = Response.ok();
    // set a header with ContextOperation so that the filter knows what to
    // do
    builder = builder.header(TemplateFilter.OPERATION, op.name());
    return builder.build();
}
Also used : Response(jakarta.ws.rs.core.Response) PathSegment(jakarta.ws.rs.core.PathSegment)

Aggregations

PathSegment (jakarta.ws.rs.core.PathSegment)2 Response (jakarta.ws.rs.core.Response)2 ResponseBuilder (jakarta.ws.rs.core.Response.ResponseBuilder)1