Skip to Main Content
Feature Request FR-2896
Product Area APIs
Status ROADMAP

38 Voters

A drop-in replacement for the HTP package for use with new Dynamic Content region

morten Public
· Dec 19 2022

Idea Summary
The new “Dynamic Content” region requires developers to rewrite existing code if they want to move to the new, refreshable region type from the existing “PL/SQL Dynamic Content”. A drop-in replacement package, tentatively called APEX_HTP, should be offered as a drop-in replacement for HTP.

Use Case
For the million instances of the existing PL/SQL Dynamic Content regions out there.

Preferred Solution (Optional)
See my blog post at https://ora-00001.blogspot.com/2022/12/dynamic-content-region-in-oracle-apex.html

This is currently on the roadmap for a future release of Oracle APEX.

7 Comments

Comments

  • jochen.zehe OP 2.3 years ago

    You got my vote here!

  • steven.feuerstein OP 2.3 years ago

    Definitely consistent with the spirit and usual approach of the APEX team.

  • olafur tryggvason OP 2.3 years ago (edited 2.3 years ago)

    I created this function around 5 years ago to grab the results from my old HTP procedures. Works well, APEX team could do a simple wrapper that does this.

    declare
      nm              owa.vc_arr;
      vl              owa.vc_arr;
      l_webpage       htp.htbuf_arr;
      l_lines         pls_integer := 9000000;
      l_result        clob;
      l_header_done   boolean := false;
    begin
      /* Initialize the OWA env */
      nm (1)   := 'SERVER_PORT';
      vl (1)   := '443';
      owa.init_cgi_env (nm.count, nm, vl);
      /* Run any htp procedures */
      my_fine_proc;
      /* Get the output */
      owa.get_page (l_webpage, l_lines);
      dbms_lob.createtemporary (l_result, true);
      for i in 1 .. l_lines loop
         if l_header_done = false and instr (l_webpage (i), chr (10) || chr (10)) > 0 then
            -- Taka burt request header
            l_webpage (i)   := substr (l_webpage (i), instr (l_webpage (i), chr (10) || chr (10)) + 2, length (l_webpage (i)));
            l_header_done   := true;
         end if;
         dbms_lob.writeappend (l_result, length (l_webpage (i)), l_webpage (i));
      end loop;
      
      return l_result;
    end;
    
  • nicolas pilot OP 2.2 years ago

    Why not just add an option on the new “Dynamic Content” region for this ?

    So the region can behave like the “PL/SQL Dynamic Content” region or like the new one.

    So that we don't have to modify anything in our app.

  • morten OP 2.2 years ago

    @pilot.nicolas That's a good point. There could be a Mode attributte, “Classic (output via htp.p)” and “Extended (function returning clob)”. Although I guess there would be some usability issues / confusion when developers don't get the region to refresh if it's in the wrong mode, etc.

  • nicolas pilot OP 2.2 years ago

    Ideally, refresh should work in both modes…

  • morten OP 2.2 years ago

    @pilot.nicolas But adding support for refreshable regions was the whole point of introducing the new region type, and the reason why they “had to” change the way you add content. See my blog post for details.