diff --git a/data-access/servlet/config/cutout.properties.in b/data-access/servlet/config/cutout.properties.in index af593049a2852d14d3dcb5d8abda646533e8ba62..52d3021b64ae3720c31fe6297ad3eb17e62d8824 100644 --- a/data-access/servlet/config/cutout.properties.in +++ b/data-access/servlet/config/cutout.properties.in @@ -6,19 +6,12 @@ fits_path_surveys=/srv/vlkb/surveys default_sky_system=GALACTIC default_spec_system=VELO_LSRK -# MIME-type of the response (only one of [1][2][3]) +# MIME-type of the response (only one of [1][2]) -# [1]: +# [1] streaming the cut: # default_response_format=application/fits -# [2]: -# default_response_format=application/fits;createfile=yes -# fits_path_cutouts=/srv/vlkb/cutouts -# amqp_host_name= -# amqp_port=5672 -# amqp_routing_key=AMQP_QUEUE - -# [3]: +# [2] creating cut-file on server and sending link in xml: default_response_format=application/x-vlkb+xml surveys_metadata_abs_pathname=/srv/vlkb/surveys/survey_populate.csv fits_path_cutouts=/srv/vlkb/cutouts @@ -26,13 +19,13 @@ fits_url_cutouts=http://vlkb-devel.ia2.inaf.it:8080/CONTEXT_ROOT/cutouts # amqp_host_name= # amqp_port=5672 # amqp_routing_key=AMQP_QUEUE +# if amqp_host_name empty -> will execute vlkb-cli to stream into local file +# if amqp_host_name set -> will use AMQP to call vlkbd-engine to create cut-file - - -# other - # should response include duration of request execution: yes | no show_duration=yes # database for resover by mapping: key->path/to/fitsfile +# if DB-uri is empty -> will attempt to use ResolverById +# if DB-uri is set -> will attempt ResolverByMapping (using ObsCore data) diff --git a/data-access/servlet/src/main/java/webapi/ServletCutout.java b/data-access/servlet/src/main/java/webapi/ServletCutout.java index bfad95284f81df93f631bb07da6d90bf73acf751..42a2e50879606e71aa56ce5f43e3af6c6c6678ae 100644 --- a/data-access/servlet/src/main/java/webapi/ServletCutout.java +++ b/data-access/servlet/src/main/java/webapi/ServletCutout.java @@ -112,28 +112,6 @@ public class ServletCutout extends javax.servlet.http.HttpServlet } - protected void doCutoutFileStream(String id, Pos pos, Band band, Time time, Pol pol, OutputStream respOutputStream) - throws IOException, InterruptedException - { - LOGGER.info("trace" + pos); - - Resolver rsl = new ResolverFromId(); - rsl.resolve(id); - - - - if(pos != null) pos.setSystem(Pos.System.valueOf(DEFAULT_SKY_SYSTEM)); - if(band != null) band.setSystem(Band.System.valueOf(DEFAULT_SPEC_SYSTEM)); - if(time != null) time.setSystem(Time.System.valueOf(DEFAULT_TIME_SYSTEM)); - - CutResult cutResult = cutout.doFile(rsl.relPathname(), rsl.hdunum(), pos, band, time, pol, false, null); - - Path path = Paths.get(cutResult.filename); - InputStream inStream = Files.newInputStream(path, StandardOpenOption.DELETE_ON_CLOSE); - inStream.transferTo(respOutputStream); - inStream.close(); - } - protected DataLink doCutoutFile(String id, Pos pos, Band band, Time time, Pol pol, boolean countNullValues, String respFormat) @@ -333,12 +311,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet LOGGER.info("responseFormat: " + respFormat); - if(respFormat.equals("application/fits;createfile=yes")) - { - response.setContentType(respFormat); - doCutoutFileStream(id, pos, band, time, pol, respOutputStream); - } - else if(respFormat.equals("application/fits")) + if(respFormat.equals("application/fits")) { response.setContentType(respFormat); doCutoutStream(id, pos, band, time, pol, respOutputStream); diff --git a/data-access/servlet/src/main/resources/cutout.properties b/data-access/servlet/src/main/resources/cutout.properties index 5d4a790c8a6bbd0a44f14677ef5e5785f6623696..7853b920fc2b1df90291ccf92aaed82960329329 100644 --- a/data-access/servlet/src/main/resources/cutout.properties +++ b/data-access/servlet/src/main/resources/cutout.properties @@ -6,22 +6,12 @@ # default_sky_system=ICRS # default_spec_system=WAVE_Barycentric -## MIME-type of the response - -# [1] (default): +## MIME-type of the response (only one of [1] [2]) +# [1] (default) streaming the cut: # default_response_format=application/fits -# xor [2]: - -# default_response_format=application/fits;createfile=yes -# fits_path_cutouts=/srv/cutouts -# amqp_host_name=localhost -# amqp_port=5672 -# amqp_routing_key= - -# xor [3]: - +# [2] creating cut-file on server and sending link in xml: # default_response_format=application/x-vlkb+xml # surveys_metadata_abs_pathname=/srv/surveys/survey_populate.csv # fits_path_cutouts=/srv/cutouts @@ -29,17 +19,18 @@ # amqp_host_name= # amqp_port=5672 # amqp_routing_key= +# if amqp_host_name empty -> will execute vlkb-cli to stream into local file +# if amqp_host_name set -> will use AMQP to call vlkbd-engine to create cut-file -# other features - ## database for resolver by mapping: key->path/to/fitsfile # db_uri= # db_schema= # db_user_name= # db_password= +# if DB-uri is empty -> will attempt to use ResolverById +# if DB-uri is set -> will attempt ResolverByMapping (using ObsCore data) ## should response include duration of request execution: yes | no # show_duration=no -