@Override public void addFirst(K key, V value) { this.delegate.addFirst(key, value); }
if (match != null) in.getHeaders().addFirst(HttpHeaders.ACCEPT, match); preprocessed = true; continue;
if (match != null) requestContext.getHeaders().addFirst(HttpHeaders.ACCEPT, match); preprocessed = true; continue;
@Override public void addFirst(K key, V value) { this.delegate.addFirst(key, value); }
@Override public void addFirst(K key, V value) { this.delegate.addFirst(key, value); }
@Override public void addFirst(final String key, final V value) { delegate.addFirst(key, value); }
if (match != null) in.getHeaders().addFirst(HttpHeaders.ACCEPT, match); preprocessed = true; continue;
if (match != null) in.getHeaders().addFirst(HttpHeaders.ACCEPT, match); preprocessed = true; continue;
if (match != null) requestContext.getHeaders().addFirst(HttpHeaders.ACCEPT, match); preprocessed = true; continue;
if (match != null) requestContext.getHeaders().addFirst(HttpHeaders.ACCEPT, match); preprocessed = true; continue;
@Override public void filter(ContainerRequestContext context) throws IOException { if (ui.getQueryParameters().getFirst("throwException") != null) { context.setProperty("filterexception", "postmatch"); throw new InternalServerErrorException( Response.status(500).type("text/plain") .entity("Postmatch filter error").build()); } String value = context.getHeaders().getFirst("Book"); if (value != null) { context.getHeaders().addFirst("Book", value + "3"); } }
@Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { String ct = responseContext.getMediaType().toString(); if (requestContext.getProperty("filterexception") != null) { if (!"text/plain".equals(ct)) { throw new RuntimeException(); } responseContext.getHeaders().putSingle("FilterException", requestContext.getProperty("filterexception")); } Object entity = responseContext.getEntity(); Type entityType = responseContext.getEntityType(); if (entity instanceof GenericHandler && InjectionUtils.getActualType(entityType) == Book.class) { ct += ";charset=ISO-8859-1"; if ("getGenericBook2".equals(rInfo.getResourceMethod().getName())) { Annotation[] anns = responseContext.getEntityAnnotations(); if (anns.length == 4 && anns[3].annotationType() == Context.class) { responseContext.getHeaders().addFirst("Annotations", "OK"); } } else { responseContext.setEntity(new Book("book", 124L)); } } else { ct += ";charset="; } responseContext.getHeaders().putSingle("Content-Type", ct); responseContext.getHeaders().add("Response", "OK"); }