1 package info.ejava.examples.secureping.client;
2
3 import java.io.IOException;
4
5 import javax.ws.rs.client.ClientRequestContext;
6 import javax.ws.rs.client.ClientRequestFilter;
7 import javax.ws.rs.core.MultivaluedMap;
8
9 public class AcceptFilter implements ClientRequestFilter {
10 private final Object[] types;
11
12 public AcceptFilter(Object...types) {
13 this.types = types;
14 }
15
16 @Override
17 public void filter(ClientRequestContext requestContext) throws IOException {
18 MultivaluedMap<String, Object> headers = requestContext.getHeaders();
19 headers.addAll("Accept", types);
20 }
21 }