docs: public static ResponseEncoding determineResponseEncodingNoDefault(RequestDetails theReq, EncodingEnum thePrefer, String thePreferContentType) {
  		String[] format = theReq.getParameters().get(Constants.PARAM_FORMAT);
  		if (format != null) {
  			for (String nextFormat : format) {
  				EncodingEnum retVal = EncodingEnum.forContentType(nextFormat);
  				if (retVal != null) {
  					return new ResponseEncoding(theReq.getServer().getFhirContext(), retVal, nextFormat);
  				}
  			}
  		}
  
  		/*
  		 * Some browsers (e.g. FF) request "application/xml" in their Accept header,
  		 * and we generally want to treat this as a preference for FHIR XML even if
  		 * it's not the FHIR version of the CT, which should be "application/xml+fhir".
  		 *
  		 * When we're serving up Binary resources though, we are a bit more strict,
  		 * since Binary is supposed to use native content types unless the client has
  		 * explicitly requested FHIR.
  		 */
  		boolean strict = false;
  		if ("Binary".equals(theReq.getResourceName())) {
  			strict = true;
  		}
  
  		/*
  		 * The Accept header is kind of ridiculous, e.g.
  		 */
  		// text/xml, application/xml, application/xhtml+xml, text/html;q=0.9, text/plain;q=0.8, image/png, */*;q=0.5
  
  		List<String> acceptValues = theReq.getHeaders(Constants.HEADER_ACCEPT);
  		float bestQ = -1f;
  		ResponseEncoding retVal = null;
  		if (acceptValues != null) {
  			for (String nextAcceptHeaderValue : acceptValues) {
  				StringTokenizer tok = new StringTokenizer(nextAcceptHeaderValue, ",");
  				while (tok.hasMoreTokens()) {
  					String nextToken = tok.nextToken();
  					int startSpaceIndex = -1;
  					for (int i = 0; i < nextToken.length(); i++) {
  						if (nextToken.charAt(i) != ' ') {
  							startSpaceIndex = i;
  							break;
  						}
  					}
  
  					if (startSpaceIndex == -1) {
  						continue;
  					}
  
  					int endSpaceIndex = -1;
  					for (int i = startSpaceIndex; i < nextToken.length(); i++) {
  						if (nextToken.charAt(i) == ' ' || nextToken.charAt(i) == ';') {
  							endSpaceIndex = i;
  							break;
  						}
  					}
  
  					float q = 1.0f;
  					ResponseEncoding encoding;
  					if (endSpaceIndex == -1) {
  						if (startSpaceIndex == 0) {
  							encoding = getEncodingForContentType(theReq.getServer().getFhirContext(), strict, nextToken, thePreferContentType);
  						} else {
  							encoding = getEncodingForContentType(theReq.getServer().getFhirContext(), strict, nextToken.substring(startSpaceIndex), thePreferContentType);
  						}
  					} else {
  						encoding = getEncodingForContentType(theReq.getServer().getFhirContext(), strict, nextToken.substring(startSpaceIndex, endSpaceIndex), thePreferContentType);
  						String remaining = nextToken.substring(endSpaceIndex + 1);
  						StringTokenizer qualifierTok = new StringTokenizer(remaining, ";");
  						while (qualifierTok.hasMoreTokens()) {
  							String nextQualifier = qualifierTok.nextToken();
  							int equalsIndex = nextQualifier.indexOf('=');
  							if (equalsIndex != -1) {
  								String nextQualifierKey = nextQualifier.substring(0, equalsIndex).trim();
  								String nextQualifierValue = nextQualifier.substring(equalsIndex + 1, nextQualifier.length()).trim();
  								if (nextQualifierKey.equals("q")) {
  									try {
  										q = Float.parseFloat(nextQualifierValue);
  										q = Math.max(q, 0.0f);
  									} catch (NumberFormatException e) {
  										ourLog.debug("Invalid Accept header q value: {}", nextQualifierValue);
  									}
  								}
  							}
  						}
  					}
  
  					if (encoding != null) {
  						if (q > bestQ || (q == bestQ && encoding.getEncoding() == thePrefer)) {
  							retVal = encoding;
  							bestQ = q;
  						}
  					}
  
  				}
  
  			}
  
  		}
  
  		/*
  		 * If the client hasn't given any indication about which response
  		 * encoding they want, let's try the request encoding in case that
  		 * is useful (basically this catches the case where the request
  		 * has a Content-Type header but not an Accept header)
  		 */
  		if (retVal == null) {
  			retVal = determineRequestEncodingNoDefaultReturnRE(theReq);
  		}
  
  		return retVal;
  	}