Apex behind the scenes

Click here to load reader

  • date post

    28-Nov-2014
  • Category

    Technology

  • view

    1.320
  • download

    9

Embed Size (px)

description

 

Transcript of Apex behind the scenes

  • 1. APEX Behind the Scenes Scott Spendolini Executive Director 1
  • 2. WELCOME 2
  • 3. Scott Spendolini [email protected] @sspendol Ex-Oracle Employee of 10 years Senior Product Manager for Oracle APEX from 2002 through 2005 Founded Sumner Technologies in October 2005 Co-Founded Sumneva in January 2010 Joined Enkitec in June 2012 Oracle Ace Director Author, Expert Oracle Application Express Security Co-Author, Pro Oracle Application Express Scott on OTN Forums About the Presenter 3
  • 4. About Enkitec Oracle Platinum Partner Established in 2004 Headquartered in Dallas, TX Locations throughout the US & EMEA Specialties include Exadata Implementations Development Services PL/SQL / Java / APEX DBA/Data Warehouse/RAC Business Intelligence 4
  • 5. Agenda Overview Primer Behind the Scenes Summary 5
  • 6. OVERVIEW 6
  • 7. Overview 7 APEX is an amazing development environment Few others are as fast & as robust But, do you really know what happens once you click submit?
  • 8. APEX is not magic Theres a method to everything that goes on Most of which is more basic than you may think Well dispel some of the magic today, so that you truly understand how this amazing technology works Behind the Curtain 8
  • 9. KISS: Keep It Simple, Stupid! For this session, were going to focus on the internals of APEX, not the complexity of the application This, our example will be extremely simple 2 Pages Login Page Blank Page 9
  • 10. PRIMER 10
  • 11. Primer 11 Before we begin, lets review a couple of basic concepts Terminology HTML Form Basics wwv_flow Overview
  • 12. TERMINOLOGY 12
  • 13. Terminology 13 Much of APEXs internal APIs and variables still use the older names Most of which is based on Oracle Flows terminology Subsequent versions of APEX include APIs & variables that start with the APEX_ prefix Thus, to understand the internals of APEX, you need to be able to map legacy term to modern ones
  • 14. Terminology 14 Legacy Name Modern Name Company Workspace Flow Application Step Page Plug Region Instance Session Request Request Debug Debug
  • 15. HTML FORM BASICS 15
  • 16. HTML Form Basics 16 HTML Forms are used to pass data to a server Used by all web pages on the internet Regardless of the underlying technology Forms contain items which are passed as parameters to the form action Text Field Radio Group Select List And so on...
  • 17. Each HTML Form has to have a form tag and a way to submit it Can optionally have input tags; most have several The form tag will have the following attributes: Name Action Method ID HTML Form Basics 17
  • 18. HTML Form Basics All HTML forms start like this: 18 Procedure Name HTTP Method Form Name Form ID
  • 19. Get vs. Post 19 All HTTP & HTTPS transactions for every web site ever fall into one of two categories: GET POST
  • 20. Get Typically involves passing parameters over the URL to a procedure More usable than POST Can be: Bookmarked Cached Remain in browser history Distributed & shared Hacked In APEX-speak, this is also known as Page Rendering and handled by wwv_flow.show 20
  • 21. Post When a web page sends form data to the server directly Using the attributes of the form to determine which server process to execute Item names will also map to the form processs input parameters Typically used to change or update data on the server Thus, POST requests are never cached In APEX-speak, this is also known as Page Processing and handled by wwv_flow.accept 21
  • 22. WWV_FLOW OVERVIEW 22
  • 23. Question 23 What does WWV stand for? WebView
  • 24. wwv_flow 24 wwv_flow is essentially APEX Contains many global variables, as well as several functions & procedures Some of which you can use, other which are internal only Well focus on just a couple of them: accept show
  • 25. Basic HTML Form 25 Procedure Name HTTP Method Form Name Form ID
  • 26. APEX HTML Form 26 Procedure Name HTTP Method Form Name Form ID
  • 27. wwv_flow.accept PL/SQL package.procedure that APEX calls when POSTing pages Called for every APEX page thats submitted Contains a number of parameters which are populated based on a combination of system-defined variables and what the user enters into the form items 27
  • 28. APEX_040200 Schema A lot can be learned about the internals of APEX by browsing the APEX_040200 schema However, NEVER, EVER, EVER make any changes to anything here! If you want to explore this schema, its best done on an isolated, private instance of APEX Oracle XE VMWare/Virtual Box/etc. 28
  • 29. THE F PROCEDURE 29
  • 30. The f Procedure 30 Lets start by navigating to our URL: http://vm/apex/f?p=134:1
  • 31. The f Procedure The string 134:1 is passed to the p parameter of the f procedure 31 PROCEDURE f Argument Name Type In/Out Default? ------------------ --------- ------ --------------- P VARCHAR2! IN DEFAULT P_SEP VARCHAR2! IN DEFAULT P_TRACE VARCHAR2! IN DEFAULT C VARCHAR2! IN DEFAULT PG_MIN_ROW! VARCHAR2! IN DEFAULT PG_MAX_ROWS! VARCHAR2! IN DEFAULT PG_ROWS_FETCHED! VARCHAR2! IN DEFAULT FSP_REGION_ID! VARCHAR2! IN DEFAULT SUCCESS_MSG! VARCHAR2! IN DEFAULT NOTIFICATION_MSG! VARCHAR2! IN DEFAULT CS VARCHAR2! IN DEFAULT S VARCHAR2! IN DEFAULT TZ VARCHAR2! IN DEFAULT P_LANG VARCHAR2! IN DEFAULT P_TERRITORY VARCHAR2! IN DEFAULT 134:1
  • 32. The f Procedure The f procedur