Examples of variants()


Examples of javax.ws.rs.core.Response.ResponseBuilder.variants()

        if (mediaType == null) {
            return ResponseUtils.notAcceptable(_snapshotInfo.getMediaTypes());
        }
        final ResponseBuilder builder = makeResponseBuilder();
        // Add Vary header
        builder.variants(MediaTypeUtils.asVariants(_snapshotInfo.getMediaTypes()));
        builder.type(MediaTypeUtils.toJaxRSMediaType(mediaType));
        return ResponseUtils.buildStreamingEntity(builder, _getSnapshot(mediaType));
    }

    /**
 
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.variants()

    @Test
    public void testVariant2() throws Exception {
        List<String> encoding = Arrays.asList("gzip", "compress");
        MediaType mt = MediaType.APPLICATION_JSON_TYPE;
        ResponseBuilder rb = Response.ok();
        rb = rb.variants(getVariantList(encoding, mt).toArray(new Variant[0]));
        Response response = rb.build();
        List<Object> enc = response.getHeaders().get(HttpHeaders.CONTENT_ENCODING);
        assertTrue(encoding.containsAll(enc));
        List<Object> ct = response.getHeaders().get(HttpHeaders.CONTENT_TYPE);
        assertTrue(ct.contains(mt));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.