*/
protected <E> E parseResponseData(GDataRequest req, Class<E> resultType)
throws IOException, ServiceException {
Preconditions.checkNotNull("resultType", resultType);
InputProperties inputProperties =
new ClientInputProperties(req, resultType);
AltFormat inputFormat = null;
String alt = inputProperties.getQueryParameter(GDataProtocol.Parameter.ALT);
if (alt != null) {
inputFormat = altRegistry.lookupName(alt);
}
if (inputFormat == null) {
inputFormat = altRegistry.lookupType(inputProperties.getContentType());
if (inputFormat == null) {
throw new ParseException("Unrecognized content type:" +
inputProperties.getContentType());
}
}
InputParser<?> inputParser = altRegistry.getParser(inputFormat);
if (inputParser == null) {
throw new ParseException("No parser for content type:" + inputFormat);
}
// If a partial representation was requested, use the partial parser
String fields =
inputProperties.getQueryParameter(GDataProtocol.Parameter.FIELDS);
if (fields != null) {
if (!Element.class.isAssignableFrom(resultType)) {
throw new IllegalStateException("Unexpected result type: " +
resultType);
}