SlideShare une entreprise Scribd logo
1  sur  65
Télécharger pour lire hors ligne
Exploring the details of
APEX sessions
APEX World 2018, Mar 22, 2018
21-3-2018
Exploring the details of APEX sessions
2
Menno Hoogendijk
Fulltime APEX developer
Working with Oracle since 2008
Tries to be a fullstack developer
Speaking at:
APEX World 2018
APEX Alpe Adria 2018
APEX Connect 2018
Kscope18
@mennooo
mennooo
About me
www.menn.ooo
21-3-2018
Powerful JavaScript skills for APEX developers
3
Menno Hoogendijk
Fulltime APEX developer
Working with Oracle since 2008
Tries to be a fullstack developer
My third Kscope!
Plugin your APEX widgets
Powerful JavaScript skills for all APEX developers
@mennooo
mennooo
About me
Today’s menu
Introduction
Creating a session
The login process
Session state
Smaller session features
The logout process
HTTP Protocol
21-3-2018
Exploring the details of APEX sessions
5
Web server
Browser
HTTP request messages:
GET www.google.com HTTP/1.1
User-Agent: Mozilla/5.0
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
HTTP response messages:
HTTP/1.1 200 OK
Content-Length: 88
Content-Type: text/html
Connection: Closed
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
HTTP is stateless
21-3-2018
Exploring the details of APEX sessions
6
Web server
User 2 User 3
User 1 User 4
What is a session?
21-3-2018
Exploring the details of APEX sessions
7
“A session establishes stateful behavior across pages for each
user”
How does APEX create a
session?
The HTTP response status code 302 Found is a
common way of performing URL redirection.
What happened in APEX?
21-3-2018
Exploring the details of APEX sessions
12
1 Check if the session is valid
3 Redirect to the “session not valid URL”
2 Create a new session for user “nobody”
1. Check if the session is valid
21-3-2018
Exploring the details of APEX sessions
13
How depends on your Authentication Scheme
If a sentry function exists, it will use that one.
If a sentry function does not exist, it will use the internal one.
Authentication
Scheme
Cookie
Session ID in
Request
Valid?
This is a custom Authentication Scheme
HTTPS only?
2. Create a new session for user “nobody”
21-3-2018
Exploring the details of APEX sessions
16
Even before login, a new session is created
Tip: use apex_dictionary view
select *
from apex_dictionary
where apex_view_name like '%SESSION%'
and column_id = 0;
Tip: grant role to schema to see all data
grant apex_administrator_role to <SCHEMA>;
3. Redirect to the “session not valid URL”
21-3-2018
Exploring the details of APEX sessions
17
Only when sentry returns false
The login process
Authentication Process
21-3-2018
Exploring the details of APEX sessions
23
apex_authentication
.login
Pre Authentication Authentication Post Authentication
21-3-2018
Plugin your APEX widgets
26
Tip: FSP_AFTER_LOGIN_URL in Post Authentication
Purpose:
Do not go to predefined home page, but redirect to custom
URL
:FSP_AFTER_LOGIN_URL := apex_page.get_url(p_page => 2)
21-3-2018
Plugin your APEX widgets
27
21-3-2018
Plugin your APEX widgets
28
Update session for user “nobody” to “ADMIN”
21-3-2018
Exploring the details of APEX sessions
29
Session State – Page Rendering
There are different kinds of session state
21-3-2018
Exploring the details of APEX sessions
31
1 Persisted Session State
2 In Memory Session State
Difference: is or is not stored in WWV_FLOW_DATA table
In Memory Session State
21-3-2018
Exploring the details of APEX sessions
32
2 Page item default value
1 Automatic Row Fetch
3 Page item source value
Demo
21-3-2018
Exploring the details of APEX sessions
33
Persisted Session State
21-3-2018
Exploring the details of APEX sessions
34
2 PL/SQL Process
1 Computation
Persisted Session State - When does the commit take
place?
21-3-2018
Exploring the details of APEX sessions
35
3 If no item value has changed -> end of page rendering
2 If item value has changed -> end of block
1 If item value has changed using apex_util.set_session_state
-> immediately
Demo
21-3-2018
Exploring the details of APEX sessions
36
Session State – Page Processing
What’s new in 5.1
21-3-2018
Exploring the details of APEX sessions
38
2 Reload on submit
1 Always via JSON (using XMLHttpRequest)
Always submit via JSON
Processed via APEX_APPLICATION.ACCEPT
Original JSON in APEX_JSON variables
XMLHttpRequest page submits and the 32k limitation
21-3-2018
Exploring the details of APEX sessions
40
People often mix up three limitations on 32K.
• 32K was the max size of a report row
• 32K is the max size of an APEX item
• mod_plsql limits the size of a single parameter that can be passed to a
procedure to 32K. (ORDS does not have this limitation)
Doing asynchronous page submits in 5.1 only solves the limitation for
mod_plsql because XMLHttpRequest supports chunked uploads.
Solutions for CLOBs (POST requests)
21-3-2018
Exploring the details of APEX sessions
41
2 apex.ajax.clob
1 Use an editable Interactive Grid
var ajaxClob = new apex.ajax.clob()
ajaxClob._set('very long text..')
select clob001
from apex_collections
where collection_name = 'CLOB_CONTENT’;
Reload on submit
21-3-2018
Exploring the details of APEX sessions
42
2 Only for success
1 Always
When reload on submit is set to always,
APEX will process the page synchronous
When reload on submit is set to only for success,
APEX will process the page asynchronous
The request returns a URL in JSON format
apex.navigation.redirect( responseData.redirectURL );
Tip:
Do not use Reload on Submit set Only for Success
in combination with Enable Duplicate Page
Submissions set to No
This will result in an error when first submit is not
successful
Demo
21-3-2018
Exploring the details of APEX sessions
46
Rejoin Sessions
Rejoin sessions
21-3-2018
Exploring the details of APEX sessions
48
When is it useful?
• User is already working in application
• Opens a link to the same application in another tab
□ Via link in email
□ Via bookmark
□ Other..
21-3-2018
Plugin your APEX widgets
49
21-3-2018
Plugin your APEX widgets
50
Rejoin sessions needs to be enabled in the Instance
Administration
Demo
21-3-2018
Exploring the details of APEX sessions
51
Session cloning
APEX session isolation between multiple browser tabs
21-3-2018
Exploring the details of APEX sessions
53
When is it useful?
• When you depend on page/ application items that are not part of page
submission
• For example: an application item that holds a certain context value
□ Tab 1: Context is customer A
□ Tab 2: Context is customer B
• Security risks are not fully guaranteed yet, therefore option is disabled by
default
Step 1: enable feature
21-3-2018
Exploring the details of APEX sessions
54
begin
apex_instance_admin.set_parameter(
p_parameter => 'CLONE_SESSION_ENABLED',
p_value => 'Y'
);
end;
Step 2: add navigation bar list entry for this URL
21-3-2018
Exploring the details of APEX sessions
55
f?p=&APP_ID.:&APP_PAGE_ID.:&APP_SESSION.:APEX_CLONE_SESSION
javascript:window.open('f?p=&APP_ID.:&APP_PAGE_ID.:&APP_S
ESSION.:APEX_CLONE_SESSION',
'f?p=&APP_ID.:&APP_PAGE_ID.:&APP_SESSION.:APEX_CLONE_
SESSION');
Demo
21-3-2018
Exploring the details of APEX sessions
58
The logout process
Logout URL: &LOGOUT_URL.
apex_authentication.logout?p_app_id=106&amp;p_session_id=6311950320799
Session is purged and no longer in apex_workspace_sessions
view
You can purge all instance sessions
Thank you

Contenu connexe

Similaire à Presentatie - Exploring the details of APEX sessions.pdf

Nagios Conference 2013 - Eric Stanley and Andy Brist - API and Nagios
Nagios Conference 2013 - Eric Stanley and Andy Brist - API and NagiosNagios Conference 2013 - Eric Stanley and Andy Brist - API and Nagios
Nagios Conference 2013 - Eric Stanley and Andy Brist - API and NagiosNagios
 
20160307 apex connects_jira
20160307 apex connects_jira20160307 apex connects_jira
20160307 apex connects_jiraMT AG
 
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling PagecacheChanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling PagecacheAjax Experience 2009
 
Assignment 2 - Power drill Grapevine "It's like Yik Yak, but for opinions ab...
Assignment 2 - Power drill Grapevine  "It's like Yik Yak, but for opinions ab...Assignment 2 - Power drill Grapevine  "It's like Yik Yak, but for opinions ab...
Assignment 2 - Power drill Grapevine "It's like Yik Yak, but for opinions ab...MATCHmaster
 
Software Portfolio - SetFocus
Software Portfolio - SetFocusSoftware Portfolio - SetFocus
Software Portfolio - SetFocusAlexander Vogel
 
High performance coding practices code project
High performance coding practices code projectHigh performance coding practices code project
High performance coding practices code projectPruthvi B Patil
 
St Hilaire Ajax Start Odtug Nov 2009
St Hilaire   Ajax Start Odtug Nov 2009St Hilaire   Ajax Start Odtug Nov 2009
St Hilaire Ajax Start Odtug Nov 2009ruiruitang
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan Uzun
 
Affordable Workflow Options for APEX
Affordable Workflow Options for APEXAffordable Workflow Options for APEX
Affordable Workflow Options for APEXNiels de Bruijn
 
Web Slices
Web SlicesWeb Slices
Web Slicesklcintw
 
An introduction to Microsoft Graph for developers
An introduction to Microsoft Graph for developersAn introduction to Microsoft Graph for developers
An introduction to Microsoft Graph for developersMicrosoft 365 Developer
 
JS digest. January 2018
JS digest. January 2018 JS digest. January 2018
JS digest. January 2018 ElifTech
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008Caleb Jenkins
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHPEdureka!
 
Building Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPBuilding Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPEdureka!
 
Backup Exec Partner Toolkit
Backup Exec Partner ToolkitBackup Exec Partner Toolkit
Backup Exec Partner ToolkitSymantec
 

Similaire à Presentatie - Exploring the details of APEX sessions.pdf (20)

Nagios Conference 2013 - Eric Stanley and Andy Brist - API and Nagios
Nagios Conference 2013 - Eric Stanley and Andy Brist - API and NagiosNagios Conference 2013 - Eric Stanley and Andy Brist - API and Nagios
Nagios Conference 2013 - Eric Stanley and Andy Brist - API and Nagios
 
20160307 apex connects_jira
20160307 apex connects_jira20160307 apex connects_jira
20160307 apex connects_jira
 
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling PagecacheChanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling Pagecache
 
Assignment 2 - Power drill Grapevine "It's like Yik Yak, but for opinions ab...
Assignment 2 - Power drill Grapevine  "It's like Yik Yak, but for opinions ab...Assignment 2 - Power drill Grapevine  "It's like Yik Yak, but for opinions ab...
Assignment 2 - Power drill Grapevine "It's like Yik Yak, but for opinions ab...
 
Development withforce
Development withforceDevelopment withforce
Development withforce
 
Software Portfolio - SetFocus
Software Portfolio - SetFocusSoftware Portfolio - SetFocus
Software Portfolio - SetFocus
 
High performance coding practices code project
High performance coding practices code projectHigh performance coding practices code project
High performance coding practices code project
 
St Hilaire Ajax Start Odtug Nov 2009
St Hilaire   Ajax Start Odtug Nov 2009St Hilaire   Ajax Start Odtug Nov 2009
St Hilaire Ajax Start Odtug Nov 2009
 
ASP.NET Lecture 2
ASP.NET Lecture 2ASP.NET Lecture 2
ASP.NET Lecture 2
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
Affordable Workflow Options for APEX
Affordable Workflow Options for APEXAffordable Workflow Options for APEX
Affordable Workflow Options for APEX
 
Web Slices
Web SlicesWeb Slices
Web Slices
 
An introduction to Microsoft Graph for developers
An introduction to Microsoft Graph for developersAn introduction to Microsoft Graph for developers
An introduction to Microsoft Graph for developers
 
JS digest. January 2018
JS digest. January 2018 JS digest. January 2018
JS digest. January 2018
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008
 
senior software developer .net
senior software developer .netsenior software developer .net
senior software developer .net
 
PnP Webcast - Sharepoint Access App scanner
PnP Webcast - Sharepoint Access App scannerPnP Webcast - Sharepoint Access App scanner
PnP Webcast - Sharepoint Access App scanner
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHP
 
Building Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPBuilding Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHP
 
Backup Exec Partner Toolkit
Backup Exec Partner ToolkitBackup Exec Partner Toolkit
Backup Exec Partner Toolkit
 

Dernier

Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf203318pmpc
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 

Dernier (20)

Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

Presentatie - Exploring the details of APEX sessions.pdf

  • 1. Exploring the details of APEX sessions APEX World 2018, Mar 22, 2018
  • 2. 21-3-2018 Exploring the details of APEX sessions 2 Menno Hoogendijk Fulltime APEX developer Working with Oracle since 2008 Tries to be a fullstack developer Speaking at: APEX World 2018 APEX Alpe Adria 2018 APEX Connect 2018 Kscope18 @mennooo mennooo About me www.menn.ooo
  • 3. 21-3-2018 Powerful JavaScript skills for APEX developers 3 Menno Hoogendijk Fulltime APEX developer Working with Oracle since 2008 Tries to be a fullstack developer My third Kscope! Plugin your APEX widgets Powerful JavaScript skills for all APEX developers @mennooo mennooo About me
  • 4. Today’s menu Introduction Creating a session The login process Session state Smaller session features The logout process
  • 5. HTTP Protocol 21-3-2018 Exploring the details of APEX sessions 5 Web server Browser HTTP request messages: GET www.google.com HTTP/1.1 User-Agent: Mozilla/5.0 Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive HTTP response messages: HTTP/1.1 200 OK Content-Length: 88 Content-Type: text/html Connection: Closed <html> <body> <h1>Hello, World!</h1> </body> </html>
  • 6. HTTP is stateless 21-3-2018 Exploring the details of APEX sessions 6 Web server User 2 User 3 User 1 User 4
  • 7. What is a session? 21-3-2018 Exploring the details of APEX sessions 7 “A session establishes stateful behavior across pages for each user”
  • 8. How does APEX create a session?
  • 9.
  • 10.
  • 11. The HTTP response status code 302 Found is a common way of performing URL redirection.
  • 12. What happened in APEX? 21-3-2018 Exploring the details of APEX sessions 12 1 Check if the session is valid 3 Redirect to the “session not valid URL” 2 Create a new session for user “nobody”
  • 13. 1. Check if the session is valid 21-3-2018 Exploring the details of APEX sessions 13 How depends on your Authentication Scheme If a sentry function exists, it will use that one. If a sentry function does not exist, it will use the internal one. Authentication Scheme Cookie Session ID in Request Valid?
  • 14. This is a custom Authentication Scheme
  • 16. 2. Create a new session for user “nobody” 21-3-2018 Exploring the details of APEX sessions 16 Even before login, a new session is created Tip: use apex_dictionary view select * from apex_dictionary where apex_view_name like '%SESSION%' and column_id = 0; Tip: grant role to schema to see all data grant apex_administrator_role to <SCHEMA>;
  • 17. 3. Redirect to the “session not valid URL” 21-3-2018 Exploring the details of APEX sessions 17 Only when sentry returns false
  • 18.
  • 19.
  • 20.
  • 21.
  • 23. Authentication Process 21-3-2018 Exploring the details of APEX sessions 23 apex_authentication .login Pre Authentication Authentication Post Authentication
  • 24.
  • 25.
  • 26. 21-3-2018 Plugin your APEX widgets 26 Tip: FSP_AFTER_LOGIN_URL in Post Authentication Purpose: Do not go to predefined home page, but redirect to custom URL :FSP_AFTER_LOGIN_URL := apex_page.get_url(p_page => 2)
  • 29. Update session for user “nobody” to “ADMIN” 21-3-2018 Exploring the details of APEX sessions 29
  • 30. Session State – Page Rendering
  • 31. There are different kinds of session state 21-3-2018 Exploring the details of APEX sessions 31 1 Persisted Session State 2 In Memory Session State Difference: is or is not stored in WWV_FLOW_DATA table
  • 32. In Memory Session State 21-3-2018 Exploring the details of APEX sessions 32 2 Page item default value 1 Automatic Row Fetch 3 Page item source value
  • 34. Persisted Session State 21-3-2018 Exploring the details of APEX sessions 34 2 PL/SQL Process 1 Computation
  • 35. Persisted Session State - When does the commit take place? 21-3-2018 Exploring the details of APEX sessions 35 3 If no item value has changed -> end of page rendering 2 If item value has changed -> end of block 1 If item value has changed using apex_util.set_session_state -> immediately
  • 37. Session State – Page Processing
  • 38. What’s new in 5.1 21-3-2018 Exploring the details of APEX sessions 38 2 Reload on submit 1 Always via JSON (using XMLHttpRequest)
  • 39. Always submit via JSON Processed via APEX_APPLICATION.ACCEPT Original JSON in APEX_JSON variables
  • 40. XMLHttpRequest page submits and the 32k limitation 21-3-2018 Exploring the details of APEX sessions 40 People often mix up three limitations on 32K. • 32K was the max size of a report row • 32K is the max size of an APEX item • mod_plsql limits the size of a single parameter that can be passed to a procedure to 32K. (ORDS does not have this limitation) Doing asynchronous page submits in 5.1 only solves the limitation for mod_plsql because XMLHttpRequest supports chunked uploads.
  • 41. Solutions for CLOBs (POST requests) 21-3-2018 Exploring the details of APEX sessions 41 2 apex.ajax.clob 1 Use an editable Interactive Grid var ajaxClob = new apex.ajax.clob() ajaxClob._set('very long text..') select clob001 from apex_collections where collection_name = 'CLOB_CONTENT’;
  • 42. Reload on submit 21-3-2018 Exploring the details of APEX sessions 42 2 Only for success 1 Always
  • 43. When reload on submit is set to always, APEX will process the page synchronous
  • 44. When reload on submit is set to only for success, APEX will process the page asynchronous The request returns a URL in JSON format apex.navigation.redirect( responseData.redirectURL );
  • 45. Tip: Do not use Reload on Submit set Only for Success in combination with Enable Duplicate Page Submissions set to No This will result in an error when first submit is not successful
  • 48. Rejoin sessions 21-3-2018 Exploring the details of APEX sessions 48 When is it useful? • User is already working in application • Opens a link to the same application in another tab □ Via link in email □ Via bookmark □ Other..
  • 50. 21-3-2018 Plugin your APEX widgets 50 Rejoin sessions needs to be enabled in the Instance Administration
  • 53. APEX session isolation between multiple browser tabs 21-3-2018 Exploring the details of APEX sessions 53 When is it useful? • When you depend on page/ application items that are not part of page submission • For example: an application item that holds a certain context value □ Tab 1: Context is customer A □ Tab 2: Context is customer B • Security risks are not fully guaranteed yet, therefore option is disabled by default
  • 54. Step 1: enable feature 21-3-2018 Exploring the details of APEX sessions 54 begin apex_instance_admin.set_parameter( p_parameter => 'CLONE_SESSION_ENABLED', p_value => 'Y' ); end;
  • 55. Step 2: add navigation bar list entry for this URL 21-3-2018 Exploring the details of APEX sessions 55 f?p=&APP_ID.:&APP_PAGE_ID.:&APP_SESSION.:APEX_CLONE_SESSION
  • 57.
  • 61.
  • 62.
  • 63.
  • 64. You can purge all instance sessions