Given a string and a type ref.  Decode the string and return the values.

@param <T>
@param responseContent
@param valueTypeRef
@return
@throws IOException
424435
private static <T> T jsonDecode(String responseContent, TypeReference<T> valueTypeRef) throws IOException {

      ObjectMapper mapper = new ObjectMapper();
      
      try {
         return mapper.<T>readValue(responseContent, valueTypeRef);
      } catch (JsonGenerationException e) {
         logger.severe("unable decode");
         throw new IOException(e);
      } catch (JsonMappingException e) {
         logger.severe("unable decode");
         throw new IOException(e.getMessage());
      }
   }
346925
private String getResponseContent(CachingClientHttpResponseWrapper response) throws IOException {
        if (response != null) {
            StringBuilder builder = new StringBuilder();
            
            builder.append("HTTP/1.1 "); // TODO get Http version from message
            builder.append(response.getStatusCode());
            builder.append(" ");
            builder.append(response.getStatusText());
            builder.append(NEWLINE);
            
            appendHeaders(response.getHeaders(), builder);
            
            builder.append(NEWLINE);
            builder.append(response.getBodyContent());
            
            return builder.toString();
        } else {
            return "";
        }
    }
171411
function parseContentTypeHeader ( str ) {
	if ( /charset=$/.test(str) ) {
		str = `${str}utf8`;
	}
	return contentType.parse(str);
}
115078
protected String decodeContentParameter(String encodedContent, String encoding, CmsFile originalFile) {

        return decodeContent(encodedContent);
    }
1106961
public String parseErrorCode(HttpResponse response, JsonContent jsonContent) {
        String errorCodeFromHeader = parseErrorCodeFromHeader(response.getHeaders());
        if (errorCodeFromHeader != null) {
            return errorCodeFromHeader;
        } else if (jsonContent != null) {
            return parseErrorCodeFromContents(jsonContent.getJsonNode());
        } else {
            return null;
        }
    }
1254176
private static boolean isReturnTypeDecodable(HttpResponseDecodeData decodeData) {
        Type returnType = decodeData.returnType();
        if (returnType == null) {
            return false;
        } else {
            return !FluxUtil.isFluxByteBuf(returnType)
                    && !(TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class) && TypeUtil.isTypeOrSubTypeOf(TypeUtil.getTypeArgument(returnType), Void.class))
                    && !TypeUtil.isTypeOrSubTypeOf(returnType, byte[].class)
                    && !TypeUtil.isTypeOrSubTypeOf(returnType, Void.TYPE) && !TypeUtil.isTypeOrSubTypeOf(returnType, Void.class);
        }
    }
1275122
@Override
    public String getCharsetFromContentType(String type) {
        if (null != type) {
            int index = type.indexOf(';');
            if (-1 != index) {
                index = type.indexOf("charset=", (index + 1));
                if (-1 != index) {
                    String charset = type.substring(index + 8).trim();
                    int end = charset.length() - 1;
                    if (-1 == end) {
                        // empty value following charset=
                        return null;
                    }
                    if (end > 0 && '"' == charset.charAt(0) && '"' == charset.charAt(end)) {
                        // strip off quotes if both exist
                        charset = charset.substring(1, end);
                    }
                    return charset;
                }
            }
        }
        return null;
    }
962626
@SuppressWarnings("unchecked")
    static <T> T parseField(CodedInputStream input, ExtensionRegistryLite extensionRegistry, WireFormat.FieldType type,
            T value) throws IOException {
        switch (type) {
            case MESSAGE:
                int length = input.readRawVarint32();
                final int oldLimit = input.pushLimit(length);
                Codec<? extends Object> codec = ProtobufProxy.create(value.getClass());
                T ret = (T) codec.decode(input.readRawBytes(length));
                input.popLimit(oldLimit);
                return ret;
            case ENUM:
                return (T) (java.lang.Integer) input.readEnum();
            case GROUP:
                throw new RuntimeException("Groups are not allowed in maps.");
            default:
                return (T) CodedConstant.readPrimitiveField(input, type, true);
        }
    }
1158151
private <T> T toEntity(String content, TypeReference<T> type) {
		try {
			return _mapper.readValue(content, type);
		} catch (IOException ex) {
			throw new SystemException(ex);
		}
	}
1005630
static String getCharsetFromContentType(String contentType) {
        if (contentType == null) return null;
        Matcher m = charsetPattern.matcher(contentType);
        if (m.find()) {
            String charset = m.group(1).trim();
            charset = charset.replace("charset=", "");
            return validateCharset(charset);
        }
        return null;
    }
706711
@SuppressWarnings("unchecked")
    public <T extends Serializable> T getContent(Class<T> contentClass, boolean checkHash) throws FoxHttpResponseException {
        try {

            Type parameterizedType = new ServiceResultParameterizedType(contentClass);

            String body = getStringBody();

            ServiceResult<T> result = parser.fromJson(body, parameterizedType);
            foxHttpClient.getFoxHttpLogger().log("processServiceResult(" + result + ")");
            this.content = result.getContent();

            checkHash(checkHash, body, result);

            return (T) this.content;
        } catch (IOException e) {
            throw new FoxHttpResponseException(e);
        }

    }
1101063
protected void buildHttpResponse(HttpServletResponse httpServletResponse,
            NaviRpcResponse response, String contentType, String encoding) throws IOException {
        httpServletResponse.setContentType(contentType);
        httpServletResponse.setCharacterEncoding(encoding);
        if (response == null || response.getResponse() == null) {
            httpServletResponse.setContentLength(0);
        } else {
            httpServletResponse.setContentLength(response.getResponse().length);
            httpServletResponse.getOutputStream().write(response.getResponse());
        }
        httpServletResponse.flushBuffer();
    }
1352163
@Override
	public T decode(byte[] bytes) throws IOException {
		if (bytes == null) {
			throw new IOException("byte array is null.");
		}
		CodedInputStream input = CodedInputStream.newInstance(bytes, 0, bytes.length);

		return readFrom(input);
	}
580780
private void parseEntityRef(boolean externalAllowed) throws SAXException,
            IOException {
        String name;

        name = readNmtoken(true);
        require(';');
        switch (getEntityType(name)) {
            case ENTITY_UNDECLARED:
                // NOTE: XML REC describes amazingly convoluted handling for
                // this case. Nothing as meaningful as being a WFness error
                // unless the processor might _legitimately_ not have seen a
                // declaration ... which is what this implements.
                String message;

                message = "reference to undeclared general entity " + name;
                if (skippedPE && !docIsStandalone) {
                    handler.verror(message);
                    // we don't know this entity, and it might be external...
                    if (externalAllowed) {
                        handler.skippedEntity(name);
                    }
                } else {
                    fatal(message);
                }
                break;
            case ENTITY_INTERNAL:
                pushString(name, getEntityValue(name));

                // workaround for possible input pop before marking
                // the buffer reading position
                char t = readCh();
                unread(t);
                int bufferPosMark = readBufferPos;

                int end = readBufferPos + getEntityValue(name).length();
                for (int k = readBufferPos; k < end; k++) {
                    t = readCh();
                    if (t == '&') {
                        t = readCh();
                        if (t == '#') {
                            // try to match a character ref
                            tryReadCharRef();

                            // everything has been read
                            if (readBufferPos >= end) {
                                break;
                            }
                            k = readBufferPos;
                            continue;
                        } else if (Character.isLetter(t)) {
                            // looks like an entity ref
                            unread(t);
                            readNmtoken(true);
                            require(';');

                            // everything has been read
                            if (readBufferPos >= end) {
                                break;
                            }
                            k = readBufferPos;
                            continue;
                        }
                        fatal(" malformed entity reference");
                    }

                }
                readBufferPos = bufferPosMark;
                break;
            case ENTITY_TEXT:
                if (externalAllowed) {
                    pushURL(false, name, getEntityIds(name), null, null, null,
                            true);
                } else {
                    fatal("reference to external entity in attribute value.",
                            name, null);
                }
                break;
            case ENTITY_NDATA:
                if (externalAllowed) {
                    fatal("unparsed entity reference in content", name, null);
                } else {
                    fatal("reference to external entity in attribute value.",
                            name, null);
                }
                break;
            default:
                throw new RuntimeException();
        }
    }
346749
public static <T> T withBytes(byte[] bytes,
            TypeReference<T> typeReference) {
        try {
            return jsonMapper.readValue(bytes, typeReference);
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "withBytes", new String(bytes));
        }
    }
24790
private JsonToken readingConstant(JsonTokenType type, JsonToken token) {
        try {
            int numCharsToRead = ((String) type.getValidator()).length();
            char[] chars = new char[numCharsToRead];
            reader.read(chars);
            String stringRead = new String(chars);

            if (stringRead.equals(type.getValidator())) {
                token.setEndColumn(token.getStartColumn() + numCharsToRead);
                token.setText(stringRead);
                return token;
            } else {
                throwJsonException(stringRead, type);
            }
        } catch (IOException ioe) {
            throw new JsonException("An IO exception occurred while reading the JSON payload", ioe);
        }
        return null;
    }
627127
public <T> T convertValue(Object object, JavaType toValueTypeRef) {
		return this.mapper.convertValue(object, toValueTypeRef);
	}