Commit 647365d5 authored by Robert Butora's avatar Robert Butora
Browse files

cutout: removes response format 'application/fits;createfile=yes' (e.g....

cutout: removes response format 'application/fits;createfile=yes' (e.g. streaming vlkb-legacy cut-file)
parent e9a3ea07
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -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)
+1 −28
Original line number Diff line number Diff line
@@ -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);
+7 −16
Original line number Diff line number Diff line
@@ -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