private static ResponseEncoding determineRequestEncodingNoDefaultReturnRE(RequestDetails theReq) { ResponseEncoding retVal = null; List<String> headers = theReq.getHeaders(Constants.HEADER_CONTENT_TYPE); if (headers != null) { Iterator<String> acceptValues = headers.iterator(); if (acceptValues != null) { while (acceptValues.hasNext() && retVal == null) { String nextAcceptHeaderValue = acceptValues.next(); if (nextAcceptHeaderValue != null && isNotBlank(nextAcceptHeaderValue)) { for (String nextPart : nextAcceptHeaderValue.split(",")) { int scIdx = nextPart.indexOf(';'); if (scIdx == 0) { continue; } if (scIdx != -1) { nextPart = nextPart.substring(0, scIdx); } nextPart = nextPart.trim(); EncodingEnum encoding = EncodingEnum.forContentType(nextPart); if (encoding != null) { retVal = new ResponseEncoding(theReq.getServer().getFhirContext(), encoding, nextPart); break; } } } } } } return retVal; }
EncodingEnum retVal = EncodingEnum.forContentType(nextFormat); if (retVal != null) { return new ResponseEncoding(theReq.getServer().getFhirContext(), retVal, nextFormat);
private static ResponseEncoding getEncodingForContentType(FhirContext theFhirContext, boolean theStrict, String theContentType, String thePreferContentType) { EncodingEnum encoding; if (theStrict) { encoding = EncodingEnum.forContentTypeStrict(theContentType); } else { encoding = EncodingEnum.forContentType(theContentType); } if (isNotBlank(thePreferContentType)) { if (thePreferContentType.equals(theContentType)) { return new ResponseEncoding(theFhirContext, encoding, theContentType); } } if (encoding == null) { return null; } return new ResponseEncoding(theFhirContext, encoding, theContentType); }
responseEncoding = new ResponseEncoding(theServer.getFhirContext(), theServer.getDefaultResponseEncoding(), null);
EncodingEnum retVal = EncodingEnum.forContentType(nextFormat); if (retVal != null) { return new ResponseEncoding(theReq.getServer().getFhirContext(), retVal, nextFormat);
private static ResponseEncoding determineRequestEncodingNoDefaultReturnRE(RequestDetails theReq) { ResponseEncoding retVal = null; List<String> headers = theReq.getHeaders(Constants.HEADER_CONTENT_TYPE); if (headers != null) { Iterator<String> acceptValues = headers.iterator(); if (acceptValues != null) { while (acceptValues.hasNext() && retVal == null) { String nextAcceptHeaderValue = acceptValues.next(); if (nextAcceptHeaderValue != null && isNotBlank(nextAcceptHeaderValue)) { for (String nextPart : nextAcceptHeaderValue.split(",")) { int scIdx = nextPart.indexOf(';'); if (scIdx == 0) { continue; } if (scIdx != -1) { nextPart = nextPart.substring(0, scIdx); } nextPart = nextPart.trim(); EncodingEnum encoding = EncodingEnum.forContentType(nextPart); if (encoding != null) { retVal = new ResponseEncoding(theReq.getServer().getFhirContext(), encoding, nextPart); break; } } } } } } return retVal; }
private static ResponseEncoding getEncodingForContentType(FhirContext theFhirContext, boolean theStrict, String theContentType, String thePreferContentType) { EncodingEnum encoding; if (theStrict) { encoding = EncodingEnum.forContentTypeStrict(theContentType); } else { encoding = EncodingEnum.forContentType(theContentType); } if (isNotBlank(thePreferContentType)) { if (thePreferContentType.equals(theContentType)) { return new ResponseEncoding(theFhirContext, encoding, theContentType); } } if (encoding == null) { return null; } return new ResponseEncoding(theFhirContext, encoding, theContentType); }
/** * Determine whether a response should be given in JSON or XML format based on the incoming HttpServletRequest's * <code>"_format"</code> parameter and <code>"Accept:"</code> HTTP header. */ public static ResponseEncoding determineResponseEncodingWithDefault(RequestDetails theReq) { ResponseEncoding retVal = determineResponseEncodingNoDefault(theReq, theReq.getServer().getDefaultResponseEncoding()); if (retVal == null) { retVal = new ResponseEncoding(theReq.getServer().getFhirContext(), theReq.getServer().getDefaultResponseEncoding(), null); } return retVal; }
responseEncoding = new ResponseEncoding(theServer.getFhirContext(), theServer.getDefaultResponseEncoding(), null);
/** * Determine whether a response should be given in JSON or XML format based on the incoming HttpServletRequest's * <code>"_format"</code> parameter and <code>"Accept:"</code> HTTP header. */ public static ResponseEncoding determineResponseEncodingWithDefault(RequestDetails theReq) { ResponseEncoding retVal = determineResponseEncodingNoDefault(theReq, theReq.getServer().getDefaultResponseEncoding()); if (retVal == null) { retVal = new ResponseEncoding(theReq.getServer().getFhirContext(), theReq.getServer().getDefaultResponseEncoding(), null); } return retVal; }