protected static void setDefaultContentType(HttpRequest request, BuiltResponse jaxrsResponse, ResteasyProviderFactory providerFactory, ResourceMethodInvoker method) { MediaType chosen = getDefaultContentType(request, jaxrsResponse, providerFactory, method); jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, chosen); }
public static void setResponseMediaType(BuiltResponse jaxrsResponse, HttpRequest request, HttpResponse response, ResteasyProviderFactory providerFactory, ResourceMethodInvoker method) { MediaType mt = getResponseMediaType(jaxrsResponse, request, response, providerFactory, method); if (mt != null) { jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, mt.toString()); } }
@Override public void setEntity(Object entity, Annotation[] annotations, MediaType mediaType) { //if (entity != null) logger.info("*** setEntity(Object, Annotation[], MediaType) " + entity.toString() + ", " + mediaType); jaxrsResponse.setEntity(entity); jaxrsResponse.setAnnotations(annotations); jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, mediaType); // todo TCK does weird things in its testing of get length // it resets the entity in a response filter which results // in a bad content-length being sent back to the client // so, we'll remove any content-length setting getHeaders().remove(HttpHeaders.CONTENT_LENGTH); }
headerMap.putAll(builtResponse.getHeaders()); headerMap.remove("Content-Type"); headerMap.add("Content-Type", mediaType);
protected static void setDefaultContentType(HttpRequest request, BuiltResponse jaxrsResponse, ResteasyProviderFactory providerFactory, ResourceMethodInvoker method) { MediaType chosen = getDefaultContentType(request, jaxrsResponse, providerFactory, method); jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, chosen); }
public static void setResponseMediaType(BuiltResponse jaxrsResponse, HttpRequest request, HttpResponse response, ResteasyProviderFactory providerFactory, ResourceMethodInvoker method) { MediaType mt = getResponseMediaType(jaxrsResponse, request, response, providerFactory, method); if (mt != null) { jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, mt.toString()); } }
@Override public void setEntity(Object entity, Annotation[] annotations, MediaType mediaType) { //if (entity != null) logger.info("*** setEntity(Object, Annotation[], MediaType) " + entity.toString() + ", " + mediaType); jaxrsResponse.setEntity(entity); jaxrsResponse.setAnnotations(annotations); jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, mediaType); // todo TCK does weird things in its testing of get length // it resets the entity in a response filter which results // in a bad content-length being sent back to the client // so, we'll remove any content-length setting getHeaders().remove(HttpHeaders.CONTENT_LENGTH); }
@Override public void setEntity(Object entity, Annotation[] annotations, MediaType mediaType) { //if (entity != null) logger.info("*** setEntity(Object, Annotation[], MediaType) " + entity.toString() + ", " + mediaType); jaxrsResponse.setEntity(entity); jaxrsResponse.setAnnotations(annotations); jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, mediaType); // todo TCK does weird things in its testing of get length // it resets the entity in a response filter which results // in a bad content-length being sent back to the client // so, we'll remove any content-length setting getHeaders().remove(HttpHeaders.CONTENT_LENGTH); }
Object o = jaxrsResponse.getHeaders().getFirst(HttpHeaders.CONTENT_TYPE); if (o instanceof MediaType) jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, mt.withCharset(StandardCharsets.UTF_8.toString()).toString());
jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, chosen);
headerMap.putAll(builtResponse.getHeaders()); headerMap.remove("Content-Type"); headerMap.add("Content-Type", mediaType);