/** * See if we have to add cache control headers. Won't alter them if the response already set * them. */ public String[][] getHeaders(Object value, Operation operation) throws ServiceException { String[][] headers = delegate.getHeaders(value, operation); if (headers == null) { // if no headers at all, add and exit return new String[][] {{HttpHeaders.CACHE_CONTROL, "max-age=0, must-revalidate"}}; } else { // will add only if not already there Map<String, String> map = (Map) ArrayUtils.toMap(headers); map.putIfAbsent(HttpHeaders.CACHE_CONTROL, "max-age=0, must-revalidate"); headers = new String[map.size()][2]; int i = 0; for (Map.Entry<String, String> entry : map.entrySet()) { headers[i][0] = entry.getKey(); headers[i][1] = entry.getValue(); i++; } } return headers; }
String[][] headers = response.getHeaders(result, opDescriptor); boolean contentDispositionProvided = false; if (headers != null) {
@Override public String[][] getHeaders(Object value, Operation operation) throws ServiceException { return response.getHeaders(value, operation); }