public BuiltResponse(final int status, final String reason, final Headers<Object> metadata, final Object entity, final Annotation[] entityAnnotations) { setEntity(entity); this.status = status; this.metadata = metadata; this.annotations = entityAnnotations; if (reason != null) { this.reason = reason; } }
@Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { ContainerResponseContextImpl ctx = (ContainerResponseContextImpl)responseContext; BuiltResponse jaxrsResposne = ctx.getJaxrsResponse(); ServerResponse serverResponse = new ServerResponse(jaxrsResposne); try { interceptor.postProcess(serverResponse); } finally { jaxrsResposne.setStatus(serverResponse.getStatus()); jaxrsResposne.setAnnotations(serverResponse.getAnnotations()); jaxrsResposne.setEntity(serverResponse.getEntity()); jaxrsResposne.setMetadata(serverResponse.getMetadata()); jaxrsResposne.setEntityClass(serverResponse.getEntityClass()); jaxrsResposne.setGenericType(serverResponse.getGenericType()); } } }
private BuiltResponse createResponse(Object value, MediaType contentType) { BuiltResponse responseImpl = new BuiltResponse(); responseImpl.setEntity(value); if (contentType != null) responseImpl.getMetadata().putSingle(HttpHeaderNames.CONTENT_TYPE, contentType); return responseImpl; }
@Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { ContainerResponseContextImpl ctx = (ContainerResponseContextImpl)responseContext; BuiltResponse jaxrsResposne = ctx.getJaxrsResponse(); ServerResponse serverResponse = new ServerResponse(jaxrsResposne); try { interceptor.postProcess(serverResponse); } finally { jaxrsResposne.setStatus(serverResponse.getStatus()); jaxrsResposne.setAnnotations(serverResponse.getAnnotations()); jaxrsResposne.setEntity(serverResponse.getEntity()); jaxrsResposne.setMetadata(serverResponse.getMetadata()); jaxrsResposne.setEntityClass(serverResponse.getEntityClass()); jaxrsResposne.setGenericType(serverResponse.getGenericType()); } } }
@Override public void setEntity(Object entity) { //if (entity != null) logger.info("*** setEntity(Object) " + entity.toString()); jaxrsResponse.setEntity(entity); // 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); }
public BuiltResponse(int status, String reason, Headers<Object> metadata, Object entity, Annotation[] entityAnnotations) { setEntity(entity); this.status = status; this.metadata = metadata; this.annotations = entityAnnotations; if (reason != null) { this.reason = reason; } }
public BuiltResponse(final int status, final String reason, final Headers<Object> metadata, final Object entity, final Annotation[] entityAnnotations) { setEntity(entity); this.status = status; this.metadata = metadata; this.annotations = entityAnnotations; if (reason != null) { this.reason = reason; } }
@Override public void setEntity(Object entity) { //if (entity != null) logger.info("*** setEntity(Object) " + entity.toString()); jaxrsResponse.setEntity(entity); // 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) { //if (entity != null) logger.info("*** setEntity(Object) " + entity.toString()); jaxrsResponse.setEntity(entity); // 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); }
@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); }