Add {@code Link} header value. Includes: {@code first}, {@code prev},
{@code next}, {@code last}, {@code original} (if {@code includeOriginal}
is {@code true}), and {@code timegate} (if {@code includeTimegateLink} is
{@code true}).
356642
public static String generateMementoLinkHeaders(
			CaptureSearchResults results, WaybackRequest wbr,
			boolean includeTimegateLink, boolean includeOriginalLink) {
		NotableResultExtractor nre = getNotableResults(results);
		CaptureSearchResult first = nre.getFirst();
		CaptureSearchResult prev = nre.getPrev();
		CaptureSearchResult closest = nre.getClosest();
		CaptureSearchResult next = nre.getNext();
		CaptureSearchResult last = nre.getLast();
		ArrayList<String> rels = new ArrayList<String>();

		AccessPoint ap = wbr.getAccessPoint();

		String requestUrl = wbr.getRequestUrl();

		// add generics:
		// rels.add(makeLink(getTimebundleUrl(ap, requestUrl), TIMEBUNDLE));
		if (includeOriginalLink) {
			rels.add(makeLink(requestUrl, ORIGINAL));
		}

		rels.add(makeLink(getTimemapUrl(ap, FORMAT_LINK, requestUrl), TIMEMAP,
			APPLICATION_LINK_FORMAT));

		// Spec says not to include timegate link for timegate
		if (includeTimegateLink) {
			rels.add(makeLink(getTimegateUrl(ap, requestUrl), TIMEGATE));
		}

		// add first/prev/next/last:
		if (first == last) {
			// only one capture.. are we sure we want the "actual" memento here?
			rels.add(makeLink(ap, requestUrl, FIRST_LAST_MEMENTO, first));
		} else {
			if (first == closest) {
				// no previous:
				rels.add(makeLink(ap, requestUrl, FIRST_MEMENTO, first));
				if (next == last) {
					rels.add(makeLink(ap, requestUrl, NEXT_LAST_MEMENTO, last));
				} else {
					rels.add(makeLink(ap, requestUrl, NEXT_MEMENTO, next));
					rels.add(makeLink(ap, requestUrl, LAST_MEMENTO, last));
				}
			} else if (last == closest) {
				// no next:
				rels.add(makeLink(ap, requestUrl, LAST_MEMENTO, last));
				if (prev == first) {
					rels.add(makeLink(ap, requestUrl, PREV_FIRST_MEMENTO, first));
				} else {
					rels.add(makeLink(ap, requestUrl, FIRST_MEMENTO, first));
					rels.add(makeLink(ap, requestUrl, PREV_MEMENTO, prev));
				}
			} else {
				// somewhere in the middle:

				if (prev == first) {
					rels.add(makeLink(ap, requestUrl, PREV_FIRST_MEMENTO, first));
				} else {
					// add both prev and first:
					rels.add(makeLink(ap, requestUrl, FIRST_MEMENTO, first));
					rels.add(makeLink(ap, requestUrl, PREV_MEMENTO, prev));
				}
				// add "actual" memento:
				rels.add(makeLink(ap, requestUrl, MEMENTO, closest));
				if (next == last) {
					rels.add(makeLink(ap, requestUrl, NEXT_LAST_MEMENTO, last));
				} else {
					rels.add(makeLink(ap, requestUrl, NEXT_MEMENTO, next));
					rels.add(makeLink(ap, requestUrl, LAST_MEMENTO, last));
				}
			}
		}
		return StringFormatter.join(", ", rels.toArray(a));
	}
711505
public void addHeaderOutImpl(String key, String value)
  {
    if (headerOutSpecial(key, value)) {
      return;
    }
    
    ArrayList<String> keys = _headerKeysOut;
    ArrayList<String> values = _headerValuesOut;
    
    int size = keys.size();
    
    // webapp/1k32
    for (int i = 0; i < size; i++) {
      if (keys.get(i).equals(key) && values.get(i).equals(value)) {
        return;
      }
    }

    keys.add(key);
    values.add(value);
  }
1291522
protected void addLinkAndOptionsHttpHeaders(final FedoraResource resource) {
        // Add Link headers
        addResourceLinkHeaders(resource);
        addAcceptExternalHeader();

        // Add Options headers
        final String options;
        if (resource.isMemento()) {
            options = "GET,HEAD,OPTIONS,DELETE";
        } else if (resource instanceof FedoraTimeMap) {
            options = "POST,HEAD,GET,OPTIONS";
            servletResponse.addHeader("Vary-Post", MEMENTO_DATETIME_HEADER);
            addAcceptPostHeader();
        } else if (resource instanceof FedoraBinary) {
            options = "DELETE,HEAD,GET,PUT,OPTIONS";
        } else if (resource instanceof NonRdfSourceDescription) {
            options = "HEAD,GET,DELETE,PUT,PATCH,OPTIONS";
            servletResponse.addHeader(HTTP_HEADER_ACCEPT_PATCH, contentTypeSPARQLUpdate);
        } else if (resource instanceof Container) {
            options = "MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS";
            servletResponse.addHeader(HTTP_HEADER_ACCEPT_PATCH, contentTypeSPARQLUpdate);
            addAcceptPostHeader();
        } else {
            options = "";
        }

        servletResponse.addHeader("Allow", options);
    }
632838
public CMAWebhook addHeader(String key, String value) {
    if (this.headers == null) {
      this.headers = new ArrayList<CMAWebhookHeader>();
    }

    this.headers.add(new CMAWebhookHeader(key, value));
    return this;
  }
259539
public Element<T> insertAfter( Element<T> previous , T object ) {
		Element<T> e = requestNew();
		e.object = object;
		e.previous = previous;
		e.next = previous.next;
		if( e.next != null ) {
			e.next.previous = e;
		} else {
			last = e;
		}
		previous.next = e;
		size++;
		return e;
	}
1091641
public T header(String name, String value, boolean isOverride) {
		if(null != name && null != value){
			final List<String> values = headers.get(name.trim());
			if(isOverride || CollectionUtil.isEmpty(values)) {
				final ArrayList<String> valueList = new ArrayList<String>();
				valueList.add(value);
				headers.put(name.trim(), valueList);
			}else {
				values.add(value.trim());
			}
		}
		return (T) this;
	}
451536
protected final void prepareAdd()
    {
        if (currentPageBuilder.isFull()) {
            valueBlocksRetainedSizeInBytes += currentPageBuilder.getRetainedSizeInBytes();
            sumPositions.add(totalPositions);
            currentPageBuilder = currentPageBuilder.newPageBuilderLike();
            values.add(currentPageBuilder);

            verify(values.size() <= MAX_NUM_BLOCKS);
        }

        long currentGroupId = getGroupId();
        short insertedBlockIndex = (short) (values.size() - 1);
        int insertedPosition = currentPageBuilder.getPositionCount();

        if (totalPositions == capacity) {
            capacity *= 1.5;
            nextBlockIndex.ensureCapacity(capacity);
            nextPosition.ensureCapacity(capacity);
        }

        if (isEmpty()) {
            // new linked list, set up the header pointer
            headBlockIndex.set(currentGroupId, insertedBlockIndex);
            headPosition.set(currentGroupId, insertedPosition);
        }
        else {
            // existing linked list, link the new entry to the tail
            long absoluteTailAddress = toAbsolutePosition(tailBlockIndex.get(currentGroupId), tailPosition.get(currentGroupId));
            nextBlockIndex.set(absoluteTailAddress, insertedBlockIndex);
            nextPosition.set(absoluteTailAddress, insertedPosition);
        }
        tailBlockIndex.set(currentGroupId, insertedBlockIndex);
        tailPosition.set(currentGroupId, insertedPosition);
        groupEntryCount.increment(currentGroupId);
        currentPageBuilder.declarePosition();
        totalPositions++;
    }
1197485
public void addLink(String linkName, Link link) {
		if (links == null) {
			links = new Links(new HashMap<String, Link>());
		}
		links.addLink(linkName, link);
	}
387986
public void addLongHeader (@Nonnull @Nonempty final String sName, final long nValue)
  {
    _addHeader (sName, Long.toString (nValue));
  }
1198703
@Override
    public void addRequestHeader(String headerName, String headerValue) {
        addRequestHeader(new Header(headerName, headerValue));
    }
888685
public B addHeader(final String headerName, final String headerValue) {
        httpParams.addHeader(headerName, headerValue);
        return self();
    }
1242718
protected void setSpecialHeader(HeaderKeys key, byte[] value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "setSpecialHeader(h,b[]): " + key.getName());
        }
        removeHdrInstances(findHeader(key), FILTER_NO);
        HeaderElement elem = getElement(key);
        elem.setByteArrayValue(value);
        addHeader(elem, FILTER_NO);
    }
457138
public void setLink(Link link) {
		setHref(link.getHref());
		setHrefAbsolute(link.getHrefAbsolute());
		HttpParameters linkParams = link.getParams();
		if(linkParams != null) {
			for(Map.Entry<String,List<String>> entry : linkParams.getParameterMap().entrySet()) {
				String paramName = entry.getKey();
				for(String paramValue : entry.getValue()) {
					addParam(paramName, paramValue);
				}
			}
		}
		this.addLastModified = link.getAddLastModified();
		setHreflang(link.getHreflang());
		setRel(link.getRel());
		setType(link.getType());
		setMedia(link.getMedia());
		setTitle(link.getTitle());
	}
1030226
public TrailingHeaders addHeader(CharSequence name, Object value) {
        lastHttpContent.trailingHeaders().add(name, value);
        return this;
    }
1291458
public T addHeaders(Map<String, String> headers) {
		if(CollectionUtil.isEmpty(headers)) {
			return (T)this;
		}
		
		for (Entry<String,String> entry : headers.entrySet()) {
			this.header(entry.getKey(), StrUtil.nullToEmpty(entry.getValue()), false);
		}
		return (T)this;
	}
675012
public ParallecHeader addPair(String key, String value) {
        this.headerMap.put(key, value);
        return this;
    }
824700
public boolean add(TemporalExtendedPropositionDefinition tepd) {
        if (tepd != null) {
            boolean result = this.abstractedFrom.add(tepd);
            if (result) {
                recalculateChildren();
            }
            return result;
        } else {
            return false;
        }
    }