@Override public Map<String, String> getMetadata() { Map<String, String> md = new HashMap<String, String>(); md.put(Http.Header.LAST_MODIFIED, DateUtility.toRfc822(getLastModified())); md.put(Http.Header.CONTENT_TYPE, getMimeType()); md.put(Http.Header.CONTENT_LENGTH, String.valueOf(out.toByteArray().length)); return md; } };
/** * Wrapper method to set fields in the HTTP response. * * @param response * @param etag * @param out * @param lastModified * @throws IOException */ public void setResponseHeaderFields(HttpServletResponse response, String etag, ByteArrayOutputStream out, DateTime lastModified) throws IOException { // Compose the Response (headers, entity body) response.setHeader(ETAG, etag); response.setHeader(CONTENT_LENGTH, String.valueOf(out.size())); response.setHeader(CONTENT_TYPE, APPLICATION_XML); response.setHeader(LAST_MODIFIED, DateUtility.toRfc822(lastModified)); response.setStatus(HttpServletResponse.SC_OK); } }
/** * Wrapper method to set fields in the HTTP response. * * @param response * @param etag * @param out * @param lastModified * @throws IOException */ public void setResponseHeaderFields(HttpServletResponse response, String etag, ByteArrayOutputStream out, DateTime lastModified) throws IOException { // Compose the Response (headers, entity body) response.setHeader(ETAG, etag); response.setHeader(CONTENT_LENGTH, String.valueOf(out.size())); response.setHeader(CONTENT_TYPE, APPLICATION_XML); response.setHeader(LAST_MODIFIED, DateUtility.toRfc822(lastModified)); response.setStatus(HttpServletResponse.SC_OK); } }
res.addHeader(LAST_MODIFIED, DateUtility.toRfc822(lastModifiedDate)); res.addHeader(ETAG, objectToMatchEtag); res.sendError(HttpServletResponse.SC_NOT_MODIFIED);
res.addHeader(LAST_MODIFIED, DateUtility.toRfc822(lastModifiedDate)); res.addHeader(ETAG, objectToMatchEtag); res.sendError(HttpServletResponse.SC_NOT_MODIFIED);