OWA Replacement Cartridge, Pre/Post subroutines


Quick Answers

What is this doing

Normally, when this cartridge receives a URL, it will find the stored procedure name in the url and build an anonymous block. For example, given /ows-bin/owa/someThing?x=5, OWA would build:
begin
	someThing( x => :x );
end;
If you setup a pre and/or post action for the ows-bin webagent, we would instead build a block that looks like:
begin
	if ( PRE_Action ) then someThing( x => :x ); end if;
	POST_Action;
end;
So, we now let you configure a pl/sql function to be called before the web agent routine and a pl/sql procedure to be called afterwards. Your PRE_Action function will return a boolean TRUE or FALSE value. If it returns TRUE, we will execute the request procedure, else we won't. This lets you drop in your own authentication scheme if you want.

Why might I do this

Well, you might want to look in the CGI-Environment to view the REMOTE_USER variable and check the contents of PATH_INFO and see if the 'REMOTE_USER' is allow to run the PATH_INFO procedure for example. (pre-action)

You might want to audit the fact that REMOTE_USER tried to execute PATH_INFO using the browser HTTP_USER_AGENT. (pre-action)

You Might want to audit the fact the REMOTER_USER not only tried to execute PATH_INFO using that browser but they did and it took 2 seconds. (post-action)


Is there overhead

Yes, add the time it will take to run your PRE-ACTION and POST-ACTION to the total run time. There will be literally no 'database' related overhead. Your code will be used alot and get pinned in the SGA. The only overhead should be the amount of time it takes to run your code.

What setup do I need to do?

You need to That's it really. Your pre-action should be coded like:
create or replace function function_to_run return boolean 
as
begin
	..... (mostly access owa_util.get_cgi_env here )...

	return TRUE;
end;
You can set variable in a package spec or whatever and refer to them in the post-action. For example, you could select from v$timer in the pre, save that and compare it to the value in v$timer in the post and print the difference.

Your POST Action should be coded like:

create or replace procedure procedure_to_run 
as
begin
	....
end;