| Oracle Application Server Portal PL/SQL API Reference - 904 | |||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||
| SUMMARY: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | DETAIL: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | |||||||
This package contains APIs that allow access to a session context. The wwctx_api session context API package provides the methods necessary to manage a session context for a specific user.
A session is established when a user accesses the Portal from a browser. A public session is created upon initial access from the browser. It is converted to an authenticated session after the user logs in and exists until the user logs out. Old sessions are also cleaned up periodically by the Portal.
| Exception Summary | |
AUTHENTICATION_EXCEPTION | |
GENERAL_CONTEXT_EXCEPTION | |
INACCESSIBLE_API_EXCEPTION | |
INACTIVE_SESSION_EXCEPTION | |
INVALID_COOKIE_EXCEPTION | |
INVALID_SESSION_TYPE_EXCEPTION | |
NO_LOCAL_NODE_EXCEPTION | |
NO_REMOTE_SESSION_EXCEPTION | |
NO_SESSION_EXCEPTION | |
NULL_PAPP_EXCEPTION | |
NULL_SCHEMA_EXCEPTION | |
SSO_CONFIG_EXCEPTION | |
SYSTEM_VAR_NAME_EXCEPTION | |
UNSYNCED_SESSION_EXCEPTION | |
| Type Summary | |
system_var_name_type | subtype |
system_var_names_type | table |
system_var_value_type | subtype |
| Constant Summary | |
NO_AUTHENTICATION | number |
PUBLIC_AUTHENTICATION | number |
REQUIRED_AUTHENTICATION_LEVEL | number |
STRONG_AUTHENTICATION | number |
SYSTEM_VAR_COMPANY_NAME | system_var_name_type |
SYSTEM_VAR_NLS_LANG | system_var_name_type |
SYSTEM_VAR_NLS_TERRITORY | system_var_name_type |
SYSTEM_VAR_SUBSCRIBER_ID | system_var_name_type |
SYSTEM_VAR_USER_ID | system_var_name_type |
SYSTEM_VAR_USER_NAME | system_var_name_type |
WEAK_AUTHENTICATION | number |
| Function/Procedure Summary | |
clear_context | |
get_authentication_level | number |
get_base_url | varchar2 |
get_bidi_imagename | varchar2 |
get_company_name | varchar2 |
get_dad_name | varchar2 |
get_db_user | varchar2 |
get_direct_doc_path | varchar2 |
get_doc_access_path | varchar2 |
get_flex_proc_path | varchar2 |
get_host | varchar2 |
get_host_lowercase | varchar2 |
get_http_accept | varchar2 |
get_http_accept_charset | varchar2 |
get_http_accept_encoding | varchar2 |
get_http_accept_language | varchar2 |
get_http_language | varchar2 |
get_http_oracle_ecid | varchar2 |
get_http_user_agent | varchar2 |
get_http_x_oracle_assert_user | varchar2 |
get_image_path | varchar2 |
get_ip_address | varchar2 |
get_last_updated | date |
get_login_time | date |
get_nls_language | varchar2 |
get_nls_territory | varchar2 |
get_oracle_cache_version | varchar2 |
get_path_alias | varchar2 |
get_path_info | varchar2 |
get_proc_path | varchar2 |
get_product_schema | varchar2 |
get_product_version | varchar2 |
get_proxy_port | integer |
get_proxy_server | varchar2 |
get_public_schema | varchar2 |
get_public_user | varchar2 |
get_query_string | varchar2 |
get_remote_addr | varchar2 |
get_request_charset | varchar2 |
get_schema_user | varchar2 |
get_script_name | varchar2 |
get_script_prefix | varchar2 |
get_server_name | varchar2 |
get_server_port | varchar2 |
get_server_protocol | varchar2 |
get_servlet_path | varchar2 |
get_session_expire_time | date |
get_session_start_time | date |
get_sessionid | number |
get_sso_proc_path | varchar2 |
get_sso_product_version | varchar2 |
get_sso_query_path | varchar2 |
get_sso_schema | varchar2 |
get_subscriber_id | number |
get_sysdate | date |
get_system_var_names | system_var_names_type |
get_system_var_value | system_var_value_type |
get_translation_language | varchar2 |
get_user | varchar2 |
get_user_id | number |
is_context_set | boolean |
is_in_login_server | boolean |
is_logged_on | boolean |
is_proxy_required | boolean |
is_session_authenticated | boolean |
logged_on | number |
set_context | |
set_nls_language | |
validate_system_var_name | |
| Exception Detail |
AUTHENTICATION_EXCEPTION exception
GENERAL_CONTEXT_EXCEPTION exception
INACCESSIBLE_API_EXCEPTION exception
INACTIVE_SESSION_EXCEPTION exception
INVALID_COOKIE_EXCEPTION exception
INVALID_SESSION_TYPE_EXCEPTION exception
NO_LOCAL_NODE_EXCEPTION exception
NO_REMOTE_SESSION_EXCEPTION exception
NO_SESSION_EXCEPTION exception
NULL_PAPP_EXCEPTION exception
NULL_SCHEMA_EXCEPTION exception
SSO_CONFIG_EXCEPTION exception
SYSTEM_VAR_NAME_EXCEPTION exception
UNSYNCED_SESSION_EXCEPTION exception
| Type Detail |
subtype system_var_name_type is varchar2(50)
type system_var_names_type is table of system_var_name_type index by binary_integer
subtype system_var_value_type is varchar2(2000)
| Constant Detail |
NO_AUTHENTICATION constant number := 0
PUBLIC_AUTHENTICATION constant number := 7
REQUIRED_AUTHENTICATION_LEVEL constant number := PUBLIC_AUTHENTICATION
STRONG_AUTHENTICATION constant number := 10
SYSTEM_VAR_COMPANY_NAME constant system_var_name_type := 'COMPANY_NAME'
SYSTEM_VAR_NLS_LANG constant system_var_name_type := 'NLS_LANG'
SYSTEM_VAR_NLS_TERRITORY constant system_var_name_type := 'NLS_TERRITORY'
SYSTEM_VAR_SUBSCRIBER_ID constant system_var_name_type := 'SUBSCRIBER_ID'
SYSTEM_VAR_USER_ID constant system_var_name_type := 'USER_ID'
SYSTEM_VAR_USER_NAME constant system_var_name_type := 'USER_NAME'
WEAK_AUTHENTICATION constant number := 5
| Function/Procedure Detail |
procedure clear_context
This procedure clears the context of the session established by a previous call to wwctx_api.set_context.
Example:
wwctx_api.clear_context;
function get_authentication_level return number
This function returns the authentication level of the user based on whether the user has not been authenticated by the system at all, has been weakly authenticated based on a persistent cookie, has been authenticated as a PUBLIC user, or has been authenticated as a user whose identity is known to the system.
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_base_url return varchar2
This routine will return the base URL, which might look something like this:
http://myhost.us.oracle.com:3000/pls/portal/
Example:
v_ret := wwctx_api.get_base_url;
function get_bidi_imagename(
imagename in varchar2,
current_suffix in varchar2 default null,
new_suffix in varchar2 default null
) return varchar2Some images used in the product are not appropriate for use when the selected NLS language is one that is typically read from right to left, such as Arabic or Hebrew. This function allows the correct image name to be constructed that is appropriate for the current language.
imagename - the image namecurrent_suffix - to be replacednew_suffix - to be addedfunction get_company_name return varchar2
If the portal is deployed in a single company scenario then it will get the name from the user profile table.
Note:
A subscriber is also referred to as an Identity Management Realm.
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_dad_name return varchar2
This API obtains the value of the DAD_NAME cgi environment variable. The DAD used to make the current request is the DAD name returned.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_dad_name varchar2;
begin
l_dad_name := wwctx_api.get_dad_name;
end;
function get_db_user return varchar2
Note: This is the database schema under which the PL/SQL code is executed for the current user.
Example:
This example returns the database user_id for the database schema with which the current Oracle Portal user is associated.
declare
v_userid number;
begin
select user_id into v_userid
from all_users
where user_name = wwctx_api.get_db_user;
return v_userid;
end;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repository
function get_direct_doc_path(
p_name in varchar2 default null
) return varchar2If no path name is provided, the function returns the Oracle Portal repository path (during installation this defaults to /docs).
Use this function to construct URLs to documents stored in wwdoc_document$. For example, if the filename specified is '123.GIF' the function returns a path such as 'docs/1/123.GIF'.
The primary use of this function is to retrieve image documents. It does not retrieve the direct access URL that is needed for documents such as HTML files, which may have relative URLs in the file itself, e.g. docs/page/A/B/C/MYPAGE.HTML.
Example:
declare
l_path varchar2(256);
begin
l_path := wwctx_api.get_direct_doc_path(
p_name => '123.GIF');
end;
p_name - the name of the file in the portal repository
to which the path is requestedfunction get_doc_access_path return varchar2
This API obtains the value of the DOC_ACCESS_PATH cgi environment variable.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_doc_access_path varchar2;
begin
l_doc_access_path := wwctx_api.get_doc_access_path;
end;
function get_flex_proc_path(
p_url in varchar2,
p_schema in varchar2 default get_product_schema
) return varchar2This routine will generate a fully qualified URL from a partial, or relative, URL that is suitable for calling via Listener's Flexible parameter passing convention.
Example:
v_ret := wwctx_api.get_flex_proc_path(
'wwptl_app_favorites?p_arg1=10');
p_url - the relative URL.p_schema - the schema to prefix the URL.function get_host return varchar2
This function returns the server and port for the host as provided by the SERVER_NAME and SERVER_PORT CGI environment variables. If the port is the default port for the current protocol, then it is not included in the returned value. Otherwise it will return server:port.
Example:
v_ret := wwctx_api.get_host;
function get_host_lowercase return varchar2
This function returns the server and port for the host as provided by the SERVER_NAME and SERVER_PORT CGI environment variables. If the port is the default port for the current protocol, then it is not included in the returned value. Otherwise it will return server:port. It converts the return value to lowercase.
Example:
v_ret := wwctx_api.get_host_lowercase;
function get_http_accept return varchar2
This API obtains the value of the HTTP_ACCEPT cgi environment variable.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_http_accept varchar2;
begin
l_http_accept := wwctx_api.get_http_accept;
end;
function get_http_accept_charset return varchar2
This API obtains the value of the HTTP_ACCEPT_CHARSET cgi environment variable.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_http_accept_charset varchar2;
begin
l_http_accept_charset := wwctx_api.get_http_accept_charset;
end;
function get_http_accept_encoding return varchar2
This API obtains the value of the HTTP_ACCEPT_ENCODING cgi environment variable, which is obtained from the Apache configuration as the Port parameter.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_http_accept_encoding varchar2;
begin
l_http_accept_encoding := wwctx_api.get_http_accept_encoding;
end;
function get_http_accept_language return varchar2
This API obtains the value of the HTTP_ACCEPT_LANGUAGE cgi environment variable.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_cgi_variable varchar2;
begin
l_cgi_variable := wwctx_api.get_server_port;
end;
function get_http_language return varchar2
Get the HTTP language used by the current user of the system (as determined by mapping the NLS language stored in the session context to its corresponding HTTP abbreviation (IANA Language code)), such as 'en-us' (English), 'fr-fr' (French), 'de-de' (German).
Example:
declare
l_http_language varchar2(30);
begin
l_http_language := wwctx_api.get_http_language;
...
end;
function get_http_oracle_ecid return varchar2
This API obtains the value of the HTTP_ORACLE_ECID cgi environment variable. This value is the unique ID for the request passed from mod_plsql.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_request_ecid varchar2(30);
begin
l_request_ecid := wwctx_api.get_http_oracle_ecid;
end;
function get_http_user_agent return varchar2
This API obtains the value of the HTTP_USER_AGENT cgi environment variable. This cgi environment variable specifies the type of browser that is making the request.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_http_user_agent varchar2;
begin
l_http_user_agent := wwctx_api.get_http_user_agent;
end;
function get_http_x_oracle_assert_user return varchar2
This API obtains the value of the HTTP_X_ORACLE_ASSERT_USER cgi environment variable, which the PPE sends to modplsql as the x-oracle-assert-user HTTP header. This header is used for controlling portlet cache behavior.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_assert_user varchar2(256);
begin
l_assert_user := wwctx_api.get_http_x_oracle_assert_user;
end;
function get_image_path(
p_filename in varchar2 default null
) return varchar2If no filename is provided then the function simply returns the path to the directory where the static images are located.
Notes:
Example:
declare
l_image varchar2(200);
begin
l_image := wwctx_api.get_image_path
(
p_filename => 'DIVISION_LOGO'
);
end;
p_filename - the filename of the image file
to which the path is requestedfunction get_ip_address return varchar2
This function returns the IP address of the client that initiated the current session context.
This may not always be the same as the IP address of the current request. A session context can be initiated by a request from the browser, or from the middle tier Parallel Page Engine (PPE).
Also, the IP address seen may be that of the machine which is hosting web cache.
Example:
This example returns the IP address of the user who is currently logged in to Oracle Portal. It returns "unknown" if there is no existing Oracle Portal session.
begin
return wwctx_api.get_ip_address;
exception
when wwctx_api.NO_SESSION_EXCEPTION then
return 'unknown';
end;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_last_updated return date
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_login_time return date
Example:
This example returns TRUE if the current Oracle Portal user logged in more than one day ago. It returns FALSE otherwise.
begin
if sysdate - wwctx_api.get_login_time > 1 then
return TRUE;
else
return FALSE;
end if;
end;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_nls_language return varchar2
Get the NLS language used by the current user of the system (as determined by the session context), such as 'us' (English), 'f' (French), 'd' (German), etc.
Example:
This example returns unexpected error in the language being used by the user currently logged in.
begin
return wwnls_api.get_string
(
p_domain => wwnls_api.DOMAIN_WWC,
p_subdomain => 'ctx',
p_name => 'unexpected_error',
p_language => wwctx_api.get_nls_language
)
end;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_nls_territory return varchar2
The territory value is the territory code that the database associates with a particular NLS language. The territory values are such as 'AMERICA', 'FRANCE', 'GERMANY'.
Example:
declare
l_territory varchar2(30);
begin
l_territory := wwctx_api.get_nls_territory;
...
end;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_oracle_cache_version return varchar2
This API obtains the value of the HTTP_ORACLE_CACHE_VERSION CGI environment variable. This value represents the Webcache version.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_oracle_cache_version varchar2(30);
begin
l_oracle_cache_version := wwctx_api.get_oracle_cache_version;
end;
function get_path_alias return varchar2
This API obtains the value of the PATH_ALIAS cgi environment variable.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_path_alias varchar2;
begin
l_path_alias := wwctx_api.get_path_alias;
end;
function get_path_info return varchar2
The PATH_INFO cgi environment variable is obtained from the requested url. It is the portion of the url between the last slash (including it) and the question mark for the query string.
For example, taking the following URL,
http://server.domain.com/pls/dad/schema.pkg.proc?param1=xthe PATH_INFO is "/schema.pkg.proc".
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_path_info varchar2;
begin
l_path_info := wwctx_api.get_path_info;
end;
function get_proc_path(
p_url in varchar2,
p_schema in varchar2 default get_product_schema
) return varchar2This routine will generate a fully qualified URL from a partial, or relative, URL.
Example:
v_ret := wwctx_api.get_proc_path('wwptl_app_favorites?p_arg1=10');
p_url - the relative URL.p_schema - the schema to prefix the URL.function get_product_schema return varchar2
Example:
This example returns TRUE if the current Oracle Portal user is the Portal schema owner. It returns FALSE otherwise.
begin
if wwctx_api.get_user = wwctx_api.get_product_schema then
return TRUE;
else
return FALSE;
end if;
end;
function get_product_version return varchar2
Example:
declare
l_version varchar2(80);
begin
l_version := wwctx_api.get_product_version;
...
end;
function get_proxy_port return integer
This function returns the default proxy port in the proxy settings. This function will be obsoleted and exists currently for backwards compatibility. wwctx_api_proxy.get_default_proxy should be called to get the default proxy information.
Example:
declare
l_proxy_server_port varchar2(80);
begin
l_proxy_server_port := wwctx_api.get_proxy_port;
...
end;
function get_proxy_server return varchar2
This function returns the default proxy host in the proxy settings. This function will be obsoleted and exists currently for backwards compatibility. wwctx_api_proxy.get_default_proxy should be called to get the default proxy information.
Note:
A proxy server provides access to servers outside of a firewall. This proxy server setting is used by Portal when making HTTP requests to other servers from within the database.
Example:
declare
l_proxy_server varchar2(80);
begin
l_proxy_server := wwctx_api.get_proxy_server;
...
end;
function get_public_schema return varchar2
The "public" schema is the default schema to which all lightweight users are mapped. This is the database schema which executes the procedures in the database upon requests from the web.
Example:
declare
l_public_schema varchar2(30);
begin
l_public_schema := wwctx_api.get_public_schema;
...
end;
function get_public_user return varchar2
Before a user logs on to the system, he is unauthenticated, however, an identity is associated with him in order to assess his privileges (of any unauthenticated user). This function returns the identity that is associated with the unauthenticated user. By default, this value is always 'PUBLIC', however, this function should be called rather than hardcoding PUBLIC, in order to protect against future changes.
Example:
declare
l_public_user varchar2(30);
begin
l_public_user := wwctx_api.get_public_user;
...
end;
function get_query_string return varchar2
This API obtains the value of the QUERY_STRING cgi environment variable, which is obtained from the requested url. The query string is the portion of the url which follows the question mark "?".
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_query_string varchar2;
begin
l_query_string := wwctx_api.get_query_string;
end;
function get_remote_addr return varchar2
This API obtains the value of the REMOTE_ADDR cgi environment variable, which contains the IP address of the client making the HTTP request.
This function gets the IP address from the environment of the current request, in contrast to the wwctx_api.get_ip_address which returns the IP address that was logged when the user's session was initially created.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_ip_addr varchar2(23);
begin
l_ip_addr := wwctx_api.get_remote_addr;
end;
function get_request_charset return varchar2
This API obtains the value of the REQUEST_CHARSET cgi environment variable, which is obtained from the Apache configuration as the Port parameter.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_request_charset varchar2;
begin
l_request_charset := wwctx_api.get_request_charset;
end;
function get_schema_user return varchar2
This API gets the name of the schema user and saves it in the package cache. Any subsequent calls to this API in the same databse session do not require database access and thus result in improved performance.
This API is not secure and can be called by any portal user.
Example:
declare
l_user all_users.username%type;
begin
l_user := wwctx_api.get_schema_user;
dbms_output.put_line('The schema user is ' || l_user);
end;
function get_script_name return varchar2
This API obtains the value of the SCRIPT_NAME cgi environment variable. For calls through modplsql, the SCRIPT_NAME is the modplsql path and the DAD, e.g., "/pls/portal".
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_script_name varchar2;
begin
l_script_name := wwctx_api.get_script_name;
end;
function get_script_prefix return varchar2
This API obtains the value of the SCRIPT_PREFIX cgi environment variable. For calls through modplsql, the SCRIPT_PREFIX is the modplsql path component, e.g., "/pls".
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_script_prefix varchar2;
begin
l_script_prefix := wwctx_api.get_script_prefix;
end;
function get_server_name return varchar2
This API obtains the value of the SERVER_NAME cgi environment variable, which is obtained from the Apache configuration as the ServerName parameter when UseCanonicalNames is On.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_server_name varchar2(256);
begin
l_server_name := wwctx_api.get_server_name;
end;
function get_server_port return varchar2
This API obtains the value of the SERVER_PORT cgi environment variable, which is obtained from the Apache configuration as the Port parameter.
This API calls OWA_UTIL to get the referenced environment variable and caches the result in package global variables so that subsequent calls don't need to invoke OWA_UTIL again.
Example:
declare
l_port number;
begin
l_port := to_number(wwctx_api.get_server_port);
end;
function get_server_protocol return varchar2
This function returns the string "http" or "https" depending on which protocol was used for the current page request. If not in the context of a web session, then "http" is returned.
Example:
v_ret := wwctx_api.get_server_protocol;
function get_servlet_path(
p_url in varchar2 default null
) return varchar2This routine will generate a full path, to the configured Parallel Page Engine (PPE), from a partial, or relative, URL.
Example:
v_ret := wwctx_api.get_servlet_path('page?_pageid=1');
would return the following:p_url - the relative URL.function get_session_expire_time return date
Note:This function is defined for future use.
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_session_start_time return date
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_sessionid return number
This function returns the identifier for the session established for the browser connection. Also, a session may be established by a set_context procedure call. A session defines such things as the logged in user, the associated database account under which this user is executing, the nls_language, etc.
Example:
This example returns the session ID of the current Portal session.
declare
l_sessionid number;
begin
l_sessionid := wwctx_api.get_sessionid;
end;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repository
function get_sso_proc_path(
p_url in varchar2,
p_schema in varchar2 default get_sso_schema
) return varchar2This routine will generate a fully qualified URL for the Login Server from a partial, or relative, URL. The Login Server may reside on a different host machine.
Example:
v_ret := wwctx_api.get_sso_proc_path('wwptl_app_favorites?p_arg1=10');
p_url - the relative URL.p_schema - the schema to prefix the URL.function get_sso_product_version return varchar2
This function retrieves the SSO product version.
Example:
l_version := wwctx_api.get_sso_product_version;
function get_sso_query_path(
p_url in varchar2,
p_schema in varchar2 default get_sso_schema
) return varchar2This function returns the configured 'query path' for the login server which needs to be an HTTP URL since the connections are made using UTL_HTTP which doesn't support HTTPS in the current release.
Example:
v_ret := wwctx_api.get_sso_query_path
(
p_url => 'wwsso_app_admin.external_apps_list'
);
p_url - the relative URL.p_schema - the schema to prefix the URL.function get_sso_schema return varchar2
This function returns the name of the schema of the SSO Server associated with this application.
Example:
declare
l_sso_schema varchar2(30);
begin
l_sso_schema := wwctx_api.get_sso_schema;
dbms_output.put_line('The SSO schema name is '|| l_sso_schema);
end;
function get_subscriber_id return number
Note:
This function should not be used from non-web sessions, like SQL*Plus sessions, or DBMS jobs.
function get_sysdate return date
This API gets the system date from the database server and saves it in the package cache. Any subsequent calls to this API in the same databse session do not require database access and thus result in improved performance.
This API is not secure and can be called by any portal user.
Example:
declare
l_sysdate date;
begin
l_sysdate := wwctx_api.get_sysdate;
dbms_output.put_line('The system time is ' ||
to_char(l_sysdate, 'MM/DD/YYYY HH24:MI:SS'));
end;
function get_system_var_names return system_var_names_type
These are used, for example, when a page is being edited: the Parameters tab allows the user to assign a public portlet parameter to any one of the known external system variables. The names of these known system variables is retrieved in the UI by calling this routine.
Example:
l_system_var_names wwctx_api.system_var_names_type;
l_system_var_name wwctx_api.system_var_name_type;
l_system_var_names := wwctx_api.get_system_var_names;
for i in 1..l_system_var_names.count loop
l_system_var_name := l_system_var_names(i);
...
end loop;
function get_system_var_value(
p_system_var_name in system_var_name_type
) return system_var_value_typeThis is used during the portion of page and flow metadata generation to convert a system variable name into its value. For example, a public portlet parameter may have been wired up to get its value from the system variable 'USER_NAME'. During metadata generation, this variable will be converted into its actual value, so the portlet can render different information on the same page, for different users. Note: this routine always returns the same set of names, so the "deterministic" compiler hint is used.
Example:
l_system_var_names wwctx_api.system_var_names_type;
l_system_var_name wwctx_api.system_var_name_type;
l_system_var_value wwctx_api.system_var_value_type;
l_system_var_names := wwctx_api.get_system_var_names;
for i in 1..l_system_var_names.count loop
l_system_var_name := l_system_var_names(i);
l_system_var_value := wwctx_api.get_system_var_value;
...
end loop;
p_system_var_name - IN the system variable name.
Valid names include the SYSTEM_VAR_*
constants defined above, as well as
any name in the set returned by
get_system_var_names. Note that case does
does not matter though.SYSTEM_VAR_NAME_EXCEPTION - raised when the given
system variable name isn't recognized.function get_translation_language return varchar2
Not all languages are available for translations. Whether or not a language is made available for translations is set when the language is installed. If all languages are available for translation, the get_translation_language should match the get_nls_language. However, if a certain language is not available for translation, then its corresponding get_translation_language will be 'us'.
Example:
declare
l_translation_language varchar2(30);
begin
l_translation_language := wwctx_api.get_translation_language;
...
end;
NO_SESSION_EXCEPTION - raised if specified session is not foundINVALID_COOKIE_EXCEPTION - raised if the cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_user return varchar2
Note: When a user is not authenticated, the get_user function will return 'PUBLIC'.
Example:
begin
if wwctx_api.get_user = wwctx_api.get_product_schema then
return TRUE;
else
return FALSE;
end if;
end;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction get_user_id return number
The local identifier for the user is required for certain API calls that require a number parameter instead of the user name.
Example:
declare
l_id number;
begin
l_id := wwctx_api.get_user_id;
...
end;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repositoryfunction is_context_set return boolean
This function checks whether a session context is set for the current session. This can be used to check whether a session context has been set with set_context before attempting some things that require the session context to be set.
function is_in_login_server return boolean
This function indicates whether the current product schema is the SSO schema.
Example:
if wwctx_api.is_in_login_server then
--
end if;
function is_logged_on return boolean
This function indicates whether the user in the current session, is logged on, or is just accessing the portal through the unauthenticated PUBLIC account.
Note:This function is similar to the logged_on function. The logged_on function returns a number instead of a boolean value, so the returned value can be used as a condition for creating a view.
Example:
if wwctx_api.is_logged_on then
--
end if;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repository
function is_proxy_required(
p_url in varchar2
) return booleanThis function indicates whether or not the specified url has a host name which is in the no proxy list. If the host name is not in the no proxy list, a proxy server is required and passed to utl_http.request.
Example:
v_required := wwctx_api.is_proxy_required
(
p_url => 'http://portal.us.oracle.com:3000/pls/portal30'
);
function is_session_authenticated(
p_sessionid in number
) return booleanThis function indicates whether or not the specified session is a current valid authenticated session.
Example:
v_valid := wwctx_api.is_session_authenticated
(
p_sessionid => 5339237590
);
function logged_on return number
Example:
select ...
where wwctx_api.logged_on = 1;
NO_SESSION_EXCEPTION - raised when a session cannot be
restored because the session data is not foundINVALID_COOKIE_EXCEPTION - raised when a session cannot be
restored because the the session cookie is corruptINACTIVE_SESSION_EXCEPTION - raised when a session cannot be
restored because it is marked inactiveUNSYNCED_SESSION_EXCEPTION - raised when a session cannot be
restored because the cookie value does not match the
value stored in the session repository
procedure set_context(
p_user_name in varchar2,
p_password in varchar2 default null,
p_company in varchar2 default null
) This procedure can be used to set the session context for a lightweight user for use in a context that is not in a web session through modplsql -- or it is a web session, but not through a DAD which uses "Single Sign-On" mode.
When making Portal API calls, some operations do authorization checks. In order for these checks to be done properly, the user needs to be authenticated. The standard method of authentication, which is through the login server, is not possible from a SQL*Plus session, or from a non-partner PLSQL application that doesn't have access to the Portal session in the Portal schema.
To address these cases, this API is provided. It allows an application to assert an identity, by providing a username and password, which the Portal will verify with the login server before establishing a session for the asserted user.
If the assertion fails, due to a bad password, for example, an exception will be raised.
Example:
wwctx_api.set_context
p_user_name => 'PORTAL30'
,p_password => 'secretpassword'
,p_company => 'Oracle'
);
p_user_name - IN name of the user to be assertedp_password - IN password of the userAUTHENTICATION_EXCEPTION - when the authentication fails
procedure set_nls_language(
p_nls_language in varchar2 default null,
p_nls_territory in varchar2 default null
) Note: This API can only be used for portal sessions that have been created via SQL*Plus. It is not intended to be used in browser sessions for setting the NLS language and territory. The Set Language portlet should be used in that case.
Example:
begin
wwctx_api.set_nls_language(
p_nls_language => wwnls_api.GREEK,
p_nls_territory => wwnls_api.TER_GREECE
);
exception
when wwnls_api.NLS_VALIDATION_EXCEPTION then
dbms_output.put_line('Error: an invalid language or territory '
|| 'value was passed in');
when wwctx_api.INVALID_SESSION_TYPE_EXCEPTION then
dbms_output.put_line('Error: this API is only allowed for '
|| 'SQL*Plus sessions');
end;
p_nls_language - the NLS language abbreviation of the language to
set. Valid values are listed in the constant group
NLS language constants.
If this parameter is null then
the portal default NLS language is used.p_nls_territory - the NLS territory abbreviation of the territory
to set. Valid values are listed in the constant
group NLS territory constants.
If this parameter is null then the
default territory for the given NLS language
is used.INVALID_SESSION_TYPE_EXCEPTION - raised when this API is called
from a non SQL*Plus portal session.wwnls_api.NLS_VALIDATION_EXCEPTION - raised if the language or
territory code passed is not valid
procedure validate_system_var_name(
p_system_var_name in system_var_name_type
) If the given name isn't valid, an exception will be raised.
p_system_var_name - IN the system variable name.
Valid names include the SYSTEM_VAR_*
constants defined above, as well as
any name in the set returned by
get_system_var_names. Note that case does
does not matter though.SYSTEM_VAR_NAME_EXCEPTION - raised when the given
system variable name isn't recognized.
| Oracle Application Server Portal PL/SQL API Reference - 904 | |||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||
| SUMMARY: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | DETAIL: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | |||||||