Loading data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java +10 −34 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ public class FormatResponseFilter implements Filter LOGGER.fine("REQUEST START"); final String RESPONSE_ENCODING = "UTF-8"; final String DEFAULT_RESPONSEFORMAT = "application/x-votable+xml"; final String DEFAULT_SKY_SYSTEM = "ICRS"; // FIXME use enums final String DEFAULT_SPEC_SYSTEM = "WAVE_Barycentric";// FIXME use enum ALSO in SearchServlet Loading @@ -66,40 +65,17 @@ public class FormatResponseFilter implements Filter Band band = Band.parseBand(params, DEFAULT_SPEC_SYSTEM); DbObstap.Obstap[] obstapArr = queryObstap(responseWrapper.getDbConnArgs(), pubdidArr, pos, band); LOGGER.info("collected metadata for " + obstapArr.length + " datasets"); String respFormat; String respFormatReq[] = params.get("RESPONSEFORMAT"); if(respFormatReq != null && (respFormatReq.length > 0) && !respFormatReq[0].isEmpty()) { respFormat = respFormatReq[0]; LOGGER.finest("responseFormat(from request): " + respFormat); } else { respFormat = DEFAULT_RESPONSEFORMAT; } LOGGER.info("collected metadata for " + obstapArr.length + " datasets"); response.setCharacterEncoding(RESPONSE_ENCODING); if(respFormat.startsWith("application/x-votable+xml")) { response.setContentType("application/xml"); boolean showDuration = false; boolean showDuration = true; XmlSerializer.serializeToVoTable(responseWriter, RESPONSE_ENCODING, obstapArr, settings.serviceUrls.cutoutUrl(), showDuration,startTime_msec); } else { final String errMsg = "Illegal response format request: " + respFormat; LOGGER.warning(errMsg); response.setContentType("text/plain"); Lib.doUsageError(errMsg, responseWriter); // FIXME set http err code } responseWriter.close(); } Loading data-discovery/src/main/java/webapi/formatfilter/XmlSerializer.java +8 −1 Original line number Diff line number Diff line Loading @@ -35,9 +35,16 @@ final class XmlSerializer dstable.setParameter(new DescribedValue( new DefaultValueInfo("datacubeCount", Integer.class, "Count of all datacubes from VLKB-search" ), new DefaultValueInfo("datasets count", Integer.class, "Count of all datasets from VLKB-search" ), obstapArr.length ) ); if(showDuration) { dstable.setParameter(new DescribedValue( new DefaultValueInfo("exec time", Long.class, "Execution time in [msec]" ), System.currentTimeMillis() - startTime_msec ) ); } BufferedWriter out = new BufferedWriter( writer ); out.write("<?xml-stylesheet type='text/xsl' href='VOTable2XHTML.xsl'?>"); Loading Loading
data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java +10 −34 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ public class FormatResponseFilter implements Filter LOGGER.fine("REQUEST START"); final String RESPONSE_ENCODING = "UTF-8"; final String DEFAULT_RESPONSEFORMAT = "application/x-votable+xml"; final String DEFAULT_SKY_SYSTEM = "ICRS"; // FIXME use enums final String DEFAULT_SPEC_SYSTEM = "WAVE_Barycentric";// FIXME use enum ALSO in SearchServlet Loading @@ -66,40 +65,17 @@ public class FormatResponseFilter implements Filter Band band = Band.parseBand(params, DEFAULT_SPEC_SYSTEM); DbObstap.Obstap[] obstapArr = queryObstap(responseWrapper.getDbConnArgs(), pubdidArr, pos, band); LOGGER.info("collected metadata for " + obstapArr.length + " datasets"); String respFormat; String respFormatReq[] = params.get("RESPONSEFORMAT"); if(respFormatReq != null && (respFormatReq.length > 0) && !respFormatReq[0].isEmpty()) { respFormat = respFormatReq[0]; LOGGER.finest("responseFormat(from request): " + respFormat); } else { respFormat = DEFAULT_RESPONSEFORMAT; } LOGGER.info("collected metadata for " + obstapArr.length + " datasets"); response.setCharacterEncoding(RESPONSE_ENCODING); if(respFormat.startsWith("application/x-votable+xml")) { response.setContentType("application/xml"); boolean showDuration = false; boolean showDuration = true; XmlSerializer.serializeToVoTable(responseWriter, RESPONSE_ENCODING, obstapArr, settings.serviceUrls.cutoutUrl(), showDuration,startTime_msec); } else { final String errMsg = "Illegal response format request: " + respFormat; LOGGER.warning(errMsg); response.setContentType("text/plain"); Lib.doUsageError(errMsg, responseWriter); // FIXME set http err code } responseWriter.close(); } Loading
data-discovery/src/main/java/webapi/formatfilter/XmlSerializer.java +8 −1 Original line number Diff line number Diff line Loading @@ -35,9 +35,16 @@ final class XmlSerializer dstable.setParameter(new DescribedValue( new DefaultValueInfo("datacubeCount", Integer.class, "Count of all datacubes from VLKB-search" ), new DefaultValueInfo("datasets count", Integer.class, "Count of all datasets from VLKB-search" ), obstapArr.length ) ); if(showDuration) { dstable.setParameter(new DescribedValue( new DefaultValueInfo("exec time", Long.class, "Execution time in [msec]" ), System.currentTimeMillis() - startTime_msec ) ); } BufferedWriter out = new BufferedWriter( writer ); out.write("<?xml-stylesheet type='text/xsl' href='VOTable2XHTML.xsl'?>"); Loading