Create all required header so content can be cache by Caching servers or Browsers

@param request
@param props
769450
private void writeHeaders(final YokeRequest request, final FileProps props) {

        MultiMap headers = request.response().headers();

        if (!headers.contains("etag")) {
            headers.set("etag", "\"" + props.size() + "-" + props.lastModifiedTime() + "\"");
        }

        if (!headers.contains("date")) {
            headers.set("date", format(new Date()));
        }

        if (!headers.contains("cache-control")) {
            headers.set("cache-control", "public, max-age=" + maxAge / 1000);
        }

        if (!headers.contains("last-modified")) {
            headers.set("last-modified", format(new Date(props.lastModifiedTime())));
        }
    }
400506
@Override
	protected void preparePaintComponent(final Request request) {
		if (getAttribute(ERROR_KEY) == null) {
			try {
				for (int i = 0; i < shim.getChildCount(); i++) {
					shim.getChildAt(i).preparePaint(request);
				}
			} catch (final Exception e) {
				if (isAjaxOrTargetedRequest(request)) {
					throw new SystemException(e.getMessage(), e);
				} else {
					setAttribute(ERROR_KEY, e);
				}
			}
		}
	}
907155
@Override
	public void serviceRequest(final Request request) {
		// Get window id off the request
		windowId = request.getParameter(WWindow.WWINDOW_REQUEST_PARAM_KEY);

		if (windowId == null) {
			super.serviceRequest(request);
		} else {
			// Get the window component
			ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
			if (target == null) {
				throw new SystemException("No window component for id " + windowId);
			}

			// Setup the Environment on the context
			UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
			Environment originalEnvironment = uic.getEnvironment();
			uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));

			if (attachWindow) {
				attachUI(target.getComponent());
			}
			UIContextHolder.pushContext(target.getContext());
			try {
				super.serviceRequest(request);
			} finally {
				uic.setEnvironment(originalEnvironment);
				UIContextHolder.popContext();
			}
		}
	}
117749
private void setUpgradeRequestHeaders(ChannelHandlerContext ctx, HttpRequest request) {
        // Set the UPGRADE header on the request.
        request.headers().set(HttpHeaderNames.UPGRADE, upgradeCodec.protocol());

        // Add all protocol-specific headers to the request.
        Set<CharSequence> connectionParts = new LinkedHashSet<CharSequence>(2);
        connectionParts.addAll(upgradeCodec.setUpgradeHeaders(ctx, request));

        // Set the CONNECTION header from the set of all protocol-specific headers that were added.
        StringBuilder builder = new StringBuilder();
        for (CharSequence part : connectionParts) {
            builder.append(part);
            builder.append(',');
        }
        builder.append(HttpHeaderValues.UPGRADE);
        request.headers().add(HttpHeaderNames.CONNECTION, builder.toString());
    }
151698
public static boolean isCachedContentRequest(final Request request) {

		// Get target id on request
		String targetId = request.getParameter(Environment.TARGET_ID);
		if (targetId == null) {
			return false;
		}

		// Get target
		ComponentWithContext targetWithContext = WebUtilities.getComponentById(targetId, true);
		if (targetWithContext == null) {
			return false;
		}

		// Check for caching key
		WComponent target = targetWithContext.getComponent();
		UIContextHolder.pushContext(targetWithContext.getContext());

		try {
			// TODO Look at implementing CacheableTarget interface
			String key = null;
			if (target instanceof WContent) {
				key = ((WContent) target).getCacheKey();
			} else if (target instanceof WImage) {
				key = ((WImage) target).getCacheKey();
			} else if (target instanceof WVideo) {
				key = ((WVideo) target).getCacheKey();
			} else if (target instanceof WAudio) {
				key = ((WAudio) target).getCacheKey();
			}
			return !Util.empty(key);
		} finally {
			UIContextHolder.popContext();
		}
	}
229587
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (!isInitialised()) {
			tf3.setText("This is read only.");
			tf4.setText("This is disabled.");
			readFields();
			setInitialised(true);
		}
	}
97951
private void collectPropertyNamesHelper(
      Set<String> props, Set<PropertyMap> cache) {
    if (!cache.add(this)) {
      return;
    }
    props.addAll(properties.keySet());
    PropertyMap primaryParent = getPrimaryParent();
    if (primaryParent != null) {
      primaryParent.collectPropertyNamesHelper(props, cache);
    }
    for (ObjectType o : getSecondaryParentObjects()) {
      PropertyMap p = o.getPropertyMap();
      if (p != null) {
        p.collectPropertyNamesHelper(props, cache);
      }
    }
  }
1157117
private List<String> checkRequestHeaders(HttpServletRequest request, JCorsConfig config) {

		@SuppressWarnings("unchecked")
		Enumeration<String> requestHeadersHeaders = request.getHeaders(CorsHeaders.ACCESS_CONTROL_REQUEST_HEADERS_HEADER);

		List<String> requestHeaders = new ArrayList<String>();

		while (requestHeadersHeaders.hasMoreElements()) {
			String requestHeader = (String) requestHeadersHeaders.nextElement();
			Constraint.ensureTrue(config.isHeaderAllowed(requestHeader),
					String.format("The specified header is not allowed: '%s'", requestHeader));
			requestHeaders.add(requestHeader);
		}

		return requestHeaders;
	}
1260047
@InterfaceAudience.Public
    public void setHeaders(Map<String, Object> requestHeadersParam) {
        // Fix - https://github.com/couchbase/couchbase-lite-java-core/issues/1617
        storeCookiesIntoCookieJar(requestHeadersParam);

        properties.put(ReplicationField.REQUEST_HEADERS, requestHeadersParam);
        replicationInternal.setHeaders(requestHeadersParam);
    }
1025153
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);
		if (!isInitialised()) {
			// Needs to be set per user as the model holds the current page index and total row per user.
			ExampleScrollableModel model = new ExampleScrollableModel(table,
					new String[]{"firstName", "lastName",
						"dateOfBirth"}, "more");
			model.setIterateFirstLevel(true);
			table.setTableModel(model);
			setInitialised(true);
		}
	}
519618
@Override
    public void writeTenant(MutableHttpRequest<?> request, Serializable tenant) {
        if (tenant instanceof CharSequence) {
            request.header(getHeaderName(), (CharSequence) tenant);
        }
    }
60996
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);
		if (!isInitialised()) {
			setInitialised(true);
			setTreeModel(new MenuTreeModel(data));
		}
	}
440762
public void doWithRequest(
                    final ClientHttpRequest request
                    )
    throws IOException
    {
        HttpHeaders  headers = request.getHeaders();
        headers.setContentType( _mediaType );

        long  size = IoUtil.copy( _input, new OutputStreamWriter( request.getBody() ) );
        headers.setContentLength( size );
    }
1227299
private static void populateRequestMetadata(InternalRequest request, ObjectMetadata metadata) {
        if (metadata.getContentType() != null) {
            request.addHeader(Headers.CONTENT_TYPE, metadata.getContentType());
        }
        if (metadata.getContentMd5() != null) {
            request.addHeader(Headers.CONTENT_MD5, metadata.getContentMd5());
        }
        if (metadata.getContentEncoding() != null) {
            request.addHeader(Headers.CONTENT_ENCODING, metadata.getContentEncoding());
        }
        if (metadata.getBceContentSha256() != null) {
            request.addHeader(Headers.BCE_CONTENT_SHA256, metadata.getBceContentSha256());
        }
        if (metadata.getContentDisposition() != null) {
            request.addHeader(Headers.CONTENT_DISPOSITION, metadata.getContentDisposition());
        }
        if (metadata.getETag() != null) {
            request.addHeader(Headers.ETAG, metadata.getETag());
        }
        if (metadata.getExpires() != null) {
            request.addHeader(Headers.EXPIRES, metadata.getExpires());
        }
        if (metadata.getCacheControl() != null) {
            request.addHeader(Headers.CACHE_CONTROL, metadata.getCacheControl());
        }
        if (metadata.getStorageClass() != null) {
            request.addHeader(Headers.BCE_STORAGE_CLASS, metadata.getStorageClass());
        }

        Map<String, String> userMetadata = metadata.getUserMetadata();
        if (userMetadata != null) {
            for (Entry<String, String> entry : userMetadata.entrySet()) {
                String key = entry.getKey();
                if (key == null) {
                    continue;
                }
                String value = entry.getValue();
                if (value == null) {
                    value = "";
                }
                if (key.length() + value.length() > 1024 * 32) {
                    throw new BceClientException("MetadataTooLarge");
                }
                request.addHeader(Headers.BCE_USER_METADATA_PREFIX + HttpUtils.normalize(key.trim()),
                        HttpUtils.normalize(value));
            }
        }
    }
309634
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request); //To change body of generated methods, choose Tools | Templates.
		if (!isInitialised()) {
			setInitialised(true);
			setupVideo();
		}
	}
1087378
@Override
	public void handleRequest(final Request request) {
		super.handleRequest(request);

		// Check if window in request
		boolean targeted = isPresent(request);
		setTargeted(targeted);

		if (getState() == ACTIVE_STATE && isTargeted()) {
			getComponentModel().wrappedContent.serviceRequest(request);
		}
	}
438396
@Override
	public void preparePaintComponent(final Request request) {
		if (!this.isInitialised()) {
			List<String> dummyList = new ArrayList<>(2);
			dummyList.add("a");
			dummyList.add("b");

			repeater.setData(dummyList);

			this.setInitialised(true);
		}
	}