|| "spectrum/fits".equalsIgnoreCase(format)
|| "text/xml".equalsIgnoreCase(contentType)
|| filename.endsWith(".xml")
|| filename.endsWith(".vot")) {
// VOTable XML file or FITS table
VoTable table = VoTable.createVoTable(url, null, format);
table.setCatalog(new VoCatalog(table));
return makeCatalogComponent(table.getCatalog());
}
if ("text/csv".equalsIgnoreCase(format)) {
// CSV formatted table
StarTable starTable = new CsvStarTable(new URLDataSource(url));
VoTable table = VoTable.createVoTable(starTable, null, Integer.MAX_VALUE);
table.setCatalog(new VoCatalog(table));
return makeCatalogComponent(table.getCatalog());
}
if (filename.toLowerCase().endsWith(".fits") && !"application/xml".equalsIgnoreCase(contentType)) {
// Local FITS table file
try {
// NavigatorFITSTable table = NavigatorFITSTable.getFitsTable(filename);
VoTable table = VoTable.createVoTable(url, null, format);
table.setCatalog(new VoCatalog(table));
return makeCatalogComponent(table.getCatalog());
} catch (Exception e) {
// ignore: might be an image file, which is handled below
}
}
if ("file".equals(protocol)
&& (filename.endsWith(".table") || filename.endsWith(".scat") || filename.endsWith(".cat"))) {
// skycat local catalog file?
SkycatTable table = new SkycatTable(filename);
return makeCatalogComponent(table.getCatalog());
}
// XXX some servers return text/html even for FITS images
if (contentType.startsWith("text/")) {
return super.makeURLComponent(url, contentType, format);