public String retrieveMIMEType(ResourceDescriptor descriptor) throws MimeTypeRetrieverException {
try {
String urlString = descriptor.getInputParameters()
.getParameterValue(ParameterNames.SOURCE_URL);
if (urlString == null) {
throw new MimeTypeRetrieverException("no source url provided");
}
URL url = new URL(urlString);
Representation representation =
resourceRetriever.execute(url, null);
return representation.getFileType();
} catch (MalformedURLException e) {
throw new MimeTypeRetrieverException(e);
} catch (ResourceRetrieverException e) {
throw new MimeTypeRetrieverException(e);
} catch (IOException e) {
throw new MimeTypeRetrieverException(e);
} catch (MissingParameterException e) {
throw new MimeTypeRetrieverException(e);
}
}