Thursday, July 25, 2013

Nicer URLs for APEX, yet another option, Part 2

   Here's taking the nicer URLs one more step and I think I have 2 more that will follow next week. I have been doing with some testing with the Online Learning Library .


In case the screenshot is too small, the URL is

https://apex.oracle.com/pls/apex/oll/test/OLLPROD/content/P24_CONTENT_ID/4191/P24_PREV_PAGE/1?sessionid=0






The URI Template is easy to follow and fairly portable.  I'm working on a generic way to do this in any app but here's the one we're using for this specific page.



        test/{app}/{page}/{item1}/{item1v}/{item2}/{item2v}?sessionid={session}




Then the Apex Listener translates those things in  { }  into binds which can be used in this plsql block to run the F procedure and get a page out of Apex.



declare
/* buffer to build up the value */
 p varchar2(32767);

begin

  /* add in app,page, and session */
  p:=:app||':'||:page||':'||:session;

  /* move along nothing to see here */
  p:= p||'::::';

  /* add in item names */
  p:= p|| :item1;
  if ( :item2 is not null ) Then
    p:= p|| ','||:item2;
  end if;
 p:=p||':';

 /* addin item values */
  p:= p|| :item1v;

  if ( :item2 is not null ) Then
    p:= p|| ','||:item2v;
  end if;
  
  f(p=>p);

end;





   I have to mention things could be rendered badly if anything is reading owa_util package to get assumptions from the URL.  One thing that I know didn't work for me was the use of apex_util.get_blob_file but that's easy to fix from yesterday's post.



Disqus for Kris' Blog