Set expires header to given date.
@param response Response
@param date Expires date
436534
public static void setExpires(@NotNull HttpServletResponse response, @Nullable Date date) {
    if (date == null) {
      response.setHeader(HEADER_EXPIRES, "-1");
    }
    else {
      response.setHeader(HEADER_EXPIRES, formatDate(date));
    }
  }
1272335
@Override
    public void handle(T result, HttpResponse response) {
        String expirationHeader =
            response.getHeaders().get(Headers.EXPIRATION);

        if ( expirationHeader != null ) {
            result.setExpirationTime(parseDate(expirationHeader));
            result.setExpirationTimeRuleId(parseRuleId(expirationHeader));
        }
    }
223999
public void setExpirationDateString(String date) throws ParseException {
        if (StringUtils.isBlank(date)) {
            expirationDate = null;
            return;
        }

        expirationDate = dateFormat.parse(date);
    }
68790
public void setResponse(Map<String, Object> headers) {
        int size = RES_200.length;
        byte[] len = stringToBytes(String.valueOf(0));
        size += CONTENT_LENGTH.length;
        size += len.length;
        size += TextCommandConstants.RETURN.length;
        if (headers != null) {
            for (Map.Entry<String, Object> entry : headers.entrySet()) {
                size += stringToBytes(HEADER_CUSTOM_PREFIX + entry.getKey() + ": ").length;
                size += stringToBytes(entry.getValue().toString()).length;
                size += TextCommandConstants.RETURN.length;
            }
        }
        size += TextCommandConstants.RETURN.length;
        this.response = ByteBuffer.allocate(size);
        response.put(RES_200);
        response.put(CONTENT_LENGTH);
        response.put(len);
        response.put(TextCommandConstants.RETURN);
        if (headers != null) {
            for (Map.Entry<String, Object> entry : headers.entrySet()) {
                response.put(stringToBytes(HEADER_CUSTOM_PREFIX + entry.getKey() + ": "));
                response.put(stringToBytes(entry.getValue().toString()));
                response.put(TextCommandConstants.RETURN);
            }
        }
        response.put(TextCommandConstants.RETURN);
        response.flip();
    }
745538
public static void preventCache( ServletResponse response )
    {
        if ( response instanceof HttpServletResponse )
        {
            HttpServletResponse httpResponse = ( HttpServletResponse ) response;
            httpResponse.setHeader( "Pragma", "No-cache" );
            httpResponse.setHeader( "Cache-Control", "no-cache,no-store,max-age=0" );
            httpResponse.setDateHeader( "Expires", 1 );
        }
    }
561275
public void setExpiration(String expiration) {
        if (expiration == null) {
            _properties.remove(AMQP_PROP_EXPIRATION);
            return;
        }
        
        _properties.put(AMQP_PROP_EXPIRATION, expiration);
    }
1196655
public void setResponse(Object response)
    {
        ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
        
        if (ctx == null)
        {
            throw new UnsupportedOperationException();
        }
        
        ctx.setResponse(response);
    }
1230933
protected void setResponseHeaders(
        HttpServletRequest request,
        HttpServletResponse response,
        String filename,
        URL resourceURL) {

        String cacheControl = "public, max-age=0, must-revalidate";
        int resourceCacheTime = getCacheTime(filename);
        if (resourceCacheTime > 0) {
            cacheControl = "max-age=" + String.valueOf(resourceCacheTime);
        }
        response.setHeader("Cache-Control", cacheControl);
        response.setDateHeader("Expires", System.currentTimeMillis() + (resourceCacheTime * 1000));

        // Find the modification timestamp
        long lastModifiedTime = 0;
        URLConnection connection = null;
        try {
            connection = resourceURL.openConnection();
            lastModifiedTime = connection.getLastModified();
            // Remove milliseconds to avoid comparison problems (milliseconds
            // are not returned by the browser in the "If-Modified-Since"
            // header).
            lastModifiedTime = lastModifiedTime - (lastModifiedTime % 1000);
            response.setDateHeader("Last-Modified", lastModifiedTime);

            if (browserHasNewestVersion(request, lastModifiedTime)) {
                response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                return;
            }
        } catch (Exception e) {
            // Failed to find out last modified timestamp. Continue without it.
            LOG.debug("Failed to find out last modified timestamp. Continuing without it.", e);
        } finally {
            try {
                if (connection != null) {
                    // Explicitly close the input stream to prevent it
                    // from remaining hanging
                    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4257700
                    InputStream is = connection.getInputStream();
                    if (is != null) {
                        is.close();
                    }
                }
            } catch (Exception e) {
                LOG.info("Error closing URLConnection input stream", e);
            }
        }

        // Set type mime type if we can determine it based on the filename
        String mimetype = OpenCms.getResourceManager().getMimeType(filename, "UTF-8");
        if (mimetype != null) {
            response.setContentType(mimetype);
        }
    }
1176629
public static void setNonCachingHeaders(@NotNull HttpServletResponse response) {
    response.setHeader(HEADER_PRAGMA, "no-cache");
    response.setHeader(HEADER_CACHE_CONTROL, "no-cache");
    response.setHeader(HEADER_EXPIRES, "0");
    response.setHeader(HEADER_DISPATCHER, "no-cache");
  }
507467
public void setDateHeader(String name, long value) 
    {
        try{_httpResponse.setDateField(name,value);}
        catch(IllegalStateException e){LogSupport.ignore(log,e);}
    }
779647
public void setCookieData(HttpServletRequest request, HttpServletResponse response) {

        setCookieData(m_pcType, m_username, m_oufqn, request, response);
    }
876679
def set(self, response: 'requests.Response') -> None:
        
        self.data[response.url] = SavedEndpoint(
            response.json(),
            self._get_expiration(response.headers)
        )
925175
public static void addMementoDatetimeHeader(HttpServletResponse response,
			CaptureSearchResult result) {
		response.setHeader(MEMENTO_DATETIME, formatLinkDate(result.getCaptureDate()));
	}
531247
private final void setExpiration(long expirationInMinutes) {
	expirationInMilliseconds = System.currentTimeMillis()+ expirationInMinutes * 60 * 1000;
        signature = null;
        if (userData != null) {
            encryptedBytes = null;
            userData.addAttribute("expire", Long.toString(expirationInMilliseconds));
        } else {
            encryptedBytes = null;
        }
    }
1193354
protected void doResponseHeaders(final HttpServletResponse response, final String mimeType) {
        if (mimeType != null) {
            response.setContentType(mimeType);
        }
    }
905036
@Override
	public CacheEntry updateCacheValues(final HttpResponse response) {
		transferFirstHeader("Date", response, this.response);
		transferFirstHeader("ETag", response, this.response);
		transferFirstHeader("Last-Modified", response, this.response);
		transferFirstHeader("Cache-Control", response, this.response);
		transferFirstHeader("Expires", response, this.response);
		return this;
	}
1085056
public void setResponse(HttpCarbonResponse response) {
        this.response = response;
        allPromisesReceived = true;
        responseFuture.notifyPromiseAvailability();      // Response received so no more promises allowed
        responseFuture.notifyHttpListener(response);
    }