Professional Documents
Culture Documents
Apex Listner PDF Server
Apex Listner PDF Server
Apex Listner PDF Server
March 2011
Oracle Application Express Listener Installation and Developer Guide, Release 1.1
E21058-01
Copyright 2011, Oracle and/or its affiliates. All rights reserved.
Primary Author: Terri Jennings
Contributors: Colm Divilly, Hilary Farrell, Sharon Kennedy, Elizabeth Saunders, and Jason Straub
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this software or related documentation is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data
delivered to U.S. Government customers are "commercial computer software" or "commercial technical data"
pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As
such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and
license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of
the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software
License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
This software is developed for general use in a variety of information management applications. It is not
developed or intended for use in any inherently dangerous applications, including applications which may
create a risk of personal injury. If you use this software in dangerous applications, then you shall be
responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use
of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of
this software in dangerous applications.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks
of their respective owners.
This software and documentation may provide access to or information on content, products, and services
from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all
warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and
its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of
third-party content, products, or services.
Contents
Preface ................................................................................................................................................................ vii
Topic Overview ..........................................................................................................................................
Audience......................................................................................................................................................
Documentation Accessibility ...................................................................................................................
Related Documents ...................................................................................................................................
Conventions .................................................................................................................................................
Third-Party License Information...............................................................................................................
vii
vii
viii
viii
ix
ix
iii
1-14
1-15
1-16
1-17
1-17
1-17
1-18
1-18
1-18
1-18
1-19
1-19
1-20
1-20
1-21
1-22
1-22
1-23
1-23
1-24
1-24
iv
2-11
2-12
2-12
2-12
A-1
A-1
A-1
A-2
A-2
A-3
B Troubleshooting
Oracle Application Express Images Not Displaying........................................................................ B-1
Cannot Log In to Oracle Application Express Listener Administration ...................................... B-3
Index
vi
Preface
Oracle Application Express Listener Installation and Developer Guide explains how to
install and configure Oracle Application Express Listener as well as utilize exposed
RESTful Application Programming Interfaces (APIs).
Topics:
Topic Overview
Audience
Documentation Accessibility
Related Documents
Conventions
Topic Overview
This document contains the following sections:
Title
Description
Troubleshooting
Audience
This document is intended for system administrators or application developers who
are installing Oracle Application Express Listener. This guide assumes you are familiar
with Web technologies and have a general understanding of Windows and UNIX
platforms.
vii
Documentation Accessibility
Our goal is to make Oracle products, services, and supporting documentation
accessible to all users, including users that are disabled. To that end, our
documentation includes features that make information available to users of assistive
technology. This documentation is available in HTML format, and contains markup to
facilitate access by the disabled community. Accessibility standards will continue to
evolve over time, and Oracle is actively engaged with other market-leading
technology vendors to address technical obstacles so that our documentation can be
accessible to all of our customers. For more information, visit the Oracle Accessibility
Program Web site at http://www.oracle.com/accessibility/.
Accessibility of Code Examples in Documentation
Screen readers may not always correctly read the code examples in this document. The
conventions for writing code require that closing braces should appear on an
otherwise empty line; however, some screen readers may not always read a line of text
that consists solely of a bracket or brace.
Accessibility of Links to External Web Sites in Documentation
This documentation may contain links to Web sites of other companies or
organizations that Oracle does not own or control. Oracle neither evaluates nor makes
any representations regarding the accessibility of these Web sites.
Access to Oracle Support
Oracle customers have access to electronic support through My Oracle Support. For
information, visit http://www.oracle.com/support/contact.html or visit
http://www.oracle.com/accessibility/support.html if you are hearing
impaired.
Related Documents
For more information, see these Oracle resources:
For information about Oracle error messages, see Oracle Database Error Messages.
Oracle error message documentation is available only in HTML. If you have access to
the Oracle Database Documentation Library, you can browse the error messages by
viii
range. Once you find the specific range, use your browser's "Find in Page" feature to
locate the specific message. When connected to the Internet, you can search for a
specific error message using the error message search feature of the Oracle online
documentation.
Many books in the documentation set use the sample schemas of the seed database,
which is installed by default when you install Oracle. See Oracle Database Sample
Schemas for information about how these schemas were created, and how you can use
them yourself.
For additional application examples, go to the Learning Library. Search for free online
training content, including Oracle by Example (OBE), demos, and tutorials. To access
the Oracle Learning Library, go to:
http://www.oracle.com/technetwork/tutorials/index.html
Conventions
The following text conventions are used in this document:
Convention
Meaning
boldface
italic
monospace
ix
1
Installing Oracle Application Express
Listener
1-1
Application Server
Supported Release
Release 3 or higher
2.
3.
Note that the version.number in the filename reflects the current release number.
2.
Unzip the downloaded zip file into a directory (folder) of your choice:
2.
When prompted, specify the location of the folder containing the static resources
used by Oracle Application Express.
4.
When prompted, choose a user name and password for the Oracle Application
Express Listener Administrator and Manager roles.
Tip: You will only be prompted for the usernames and passwords
the first time you launch Oracle Application Express Listener.
Where:
5.
1-3
-Dapex.ajp=nnnn
--help
2.
3.
4.
To learn more about installing Oracle WebLogic Server, see Oracle Fusion Middleware
Getting Started With Installation for Oracle WebLogic Server and Oracle Fusion Middleware
Installation Guide for Oracle WebLogic Server.
Tip: This section assumes that you have completed the installation
process and are familiar with Oracle WebLogic Server. If you are
unfamiliar with domains, managed servers, deployment, security,
users and roles, refer to your Oracle WebLogic Server documentation.
Topics:
Where:
1-5
Tip:
The space and period (.) at the end of the command is required.
2.
Where:
3.
4.
If your domain is in Production mode, click the Lock & Edit button on the left-pane
below the submenu Change Center. If your domain is in Development mode this
button will not appear.
2.
Click Install.
3.
4.
5.
Select the servers and/or clusters to which you want to deploy the application or
module and click Next.
Tip: If you have not created additional Managed Servers or clusters,
you will not see this assistant page.
6.
Name - Enter:
apex
b.
c.
7.
Click Next.
1-7
9.
Name - Enter:
i
b.
Security - Select:
DD Only: Use only roles and policies that are defined in the deployment
descriptors
c.
12. If your domain is in Production Mode, then on the Change Center click Activate
Changes.
Verifying the State and Health of apex and i
In the Summary of Deployments, select the Control tab and verify that both the apex
and i State are Active and the Health status is OK.
If apex or i are not Active, then enable them. In the Deployments table, select the check
box adjacent to apex and/or i. Click Start and select Servicing all requests to make
them active.
Create Users
Create Roles
If your domain is in Production mode, click Lock & Edit on the left pane below
Change Center. If your domain is in Development mode, this button does not
display.
2.
1-9
Create Users
Next, create two users. Create an administrator user to access the Oracle Application
Express Listener Administration page and a manager user to access the Oracle
Application Express Listener Status page.
To create users:
1.
In the left pane of the Administration Console, select Security Realms. See "View
Security Realms" on page 1-9.
2.
Select a security realm by clicking the security realm name (for example,
myrealm).
The Settings page displays.
3.
Click the Users and Groups tab and then click the Users tab.
The User table displays the names of all defined users.
4.
Click New.
5.
User names are case sensitive and must be unique. Do not use commas, tabs or
any other characters in the following comma-delimited list:
<>, #, |, &, ?, ( ), { }
6.
7.
From the Provider list, select the Authentication provider for the user.
Next, define a password for the user. Note that the minimum password length for
a user defined in the WebLogic Authentication provider is 8 characters.
8.
9.
Name - managerlistener
Create Roles
Oracle Application Express Listener requires you assign users roles to access the
Application Express Listener Administration. There are two types of roles:
Admin - The user has permission to access the Oracle Application Express
Listener Administration page.
Manager - The user has permission to access the Oracle Application Express
Listener Status Information Page.
To create roles:
1.
In the left pane of the Administration Console, select Security Realms. See "View
Security Realms" on page 1-9.
2.
On the Summary of Security Realms page, select the name of the realm you want
to secure the resource (for example, myrealm).
The Settings page displays.
3.
Select the Roles and Policies tab and then select the Realm Roles.
The Roles page organizes all of the domain's resources and corresponding roles in
a hierarchical tree control.
4.
In the Roles table, expand the Deployment node in the Names column until
you find the resource apex.
b.
5.
6.
b.
Select the Provider Name for the role mapper (for example,
XACMLRoleMapper).
c.
Click OK.
The Stand-Alone Web Application Scoped Roles table with the Admin role
displays.
7.
8.
Create a role condition, which specifies who is in the scoped role and under which
set of conditions:
a.
b.
c.
In User Argument Name, add adminlistener. Then, click Add and then
Finish.
The user adminlistener appears.
d.
Click Save.
A status message appears.
9.
Repeat the steps above starting at step 5 and create another role with the following
information:
a.
b.
In the Role Conditions Predicate List for Manager, select User and add
managerlistener.
c.
Once you have completed creating the Manager role, click Save.
10. If your domain is in Production Mode, in the left pane below the Change Center,
To learn more about installing Oracle GlassFish Server, see GlassFish Server Quick Start
Guide and Oracle GlassFish Server Installation Guide.
Tip: This section assumes that you have completed the installation
process and are familiar with GlassFish Server. If you are unfamiliar
with domains, servers, applications, security, or users, see your Oracle
GlassFish Server documentation.
Topics:
2.
Copy all files and folders in the Oracle Application Express images directory:
<apex directory>/images
Tip: Do not include the images folder. Copy only the files and
folders below the Oracle Application Express images folder.
If the images are not in this location, the Oracle Application Express login page
will appear to be missing images and style sheets.
Launch the Administration Console by typing the following URL in your Web
browser:
http://localhost:4848
2.
About Roles
Create Users
About Roles
Oracle Application Express Listener requires you assign users roles to access the
Application Express Listener Administration. There are two types of roles:
Admin - The user has permission to access the Oracle Application Express
Listener Administration page.
Manager - The user has permission to access the Oracle Application Express
Listener Status Information Page.
You can enable a default principal-to-role mapping on the Application Server using
the Admin Console if the group list names is defined the same as the role names
To enable a default principal-to-role mapping:
1.
2.
3.
Click Save.
Tip: Enabling the Default Principal to Role requires the Group List to
be the same as the role name as described in the sect section.
Create Users
You must create users to access the Oracle Application Express Administration page
and Status page.
To create users:
1.
2.
3.
4.
Select the realm to which to add your user (for example, file).
The Edit Realm page appears.
5.
6.
7.
b.
c.
d.
e.
Click OK.
8.
Repeat the previous steps and create another user for the Oracle Application
Express Listener manager, by specifying the following:
a.
b.
c.
Click OK.
2.
3.
4.
Navigate to the location of the apex.war file, select the file, and click Open.
The Deploy Applications or Modules page displays.
5.
b.
c.
d.
Status: Enabled
e.
f.
The Applications page appears. A check mark should appear in the Enabled field
for apex
If a check mark does not appear in the Enabled column for apex,
then select the check box next to apex and click Enable.
Tip:
Where:
To learn more about installing Oracle Containers for J2EE (OC4J), see Oracle Containers
for J2EE Installation Guide.
Tip: This section assumes that OC4J is already installed and you are
familiar with OC4J. If you are unfamiliar with servers, deployment,
security, users, and roles, refer to your Oracle Containers for J2EE
documentation.
Topics:
2.
Copy all files and folders in the Oracle Application Express images directory:
<apex directory>/images
Tip: Do not include the images folder. Copy only the files and
folders below the Oracle Application Express images folder.
If the images are not in this location, the Oracle Application Express login page
will appear and be missing images and style sheets.
You must start the OC4J Server before you start the Application Server Control
Console. Consider the following example:
cd <oc4j install directory>/j2ee/home
java -jar oc4j.jar
2.
Create Roles
Create Users
Create Roles
Oracle Application Express Listener requires you assign users roles to access the
Application Express Listener Administration. There are two types of roles:
Admin - The user has permission to access the Oracle Application Express
Listener Administration page.
Manager - The user has permission to access the Oracle Application Express
Listener Status Information Page.
To create roles:
1.
2.
3.
4.
5.
6.
7.
8.
9.
b.
c.
Click OK.
b.
c.
Click OK.
Create Users
You must create users to access the Oracle Application Express Administration page
and Status page.
To create users:
1.
In the Instance Security Level page, click the selected realms Users number.
The Users page displays.
2.
3.
4.
b.
c.
d.
Click OK.
Create another user for the Oracle Application Express Listener manager:
a.
b.
c.
d.
Click OK.
2.
3.
Select Archive is present on local host. Upload the archive to the server
where Application Server Control is running.
b.
c.
Click Next.
5.
6.
b.
7.
Click OK.
8.
9.
Verify that apex is listed on the Applications page and the Status displays a green
up-arrow indicating that it is Active.
Topics:
2.
3.
b.
Where:
4.
c.
d.
If your domain is in Production mode, click the Lock & Edit button on the
left-pane below the submenu Change Center. If your domain is in Development
mode this button will not appear.
Go to the WebLogic Server Home Page. Below the Domain Configuration, select
Deployments.
The Summary of Deployments displays.
5.
Click the check box next to apex to enable the Update button.
6.
7.
8.
Click Next.
9.
Changes.
2.
Launch the Administration Console by typing the following URL in your Web
browser:
http://localhost:4848
b.
3.
4.
5.
6.
7.
8.
Click OK.
The Application page appears.
9.
Verify that a check mark displays on the Enabled field next to apex.
2.
Start the OC4J Server. See "Start the OC4J Server" on page 1-18.
Tip: You must start the OC4J Server before you start the Application
Server Control Console.
3.
b.
4.
Click the check box next to apex and then select the Redeploy button.
The Redeploy: Select Archive and deployment plan page displays.
6.
7.
Click Next.
The Redeploy: Application Attributes page displays.
8.
9.
Click Next.
The Redeploy: Deployment Settings displays.
Up (Active).
Copy Application Express Images When Using Oracle Containers for J2EE (OC4J)
Create a Web archive for the images directory. See "Create Web Archive for Oracle
Application Express Images" on page 1-5.
2.
3.
b.
Where:
c.
d.
4.
If your domain is in Production mode, click the Lock & Edit button on the
left-pane below the submenu Change Center. If your domain is in Development
mode this button will not appear.
Go to the WebLogic Server Home Page. Below the Domain Configuration, select
Deployments.
The Summary of Deployments displays.
5.
6.
7.
8.
Click Next.
9.
Changes.
2.
Follow the instructions in "Copy Oracle Application Express Images" on page 1-13.
Copy Application Express Images When Using Oracle Containers for J2EE (OC4J)
To copy Application Express images when using J2EE (OC4J):
1.
2.
Follow the instructions in "Copy Oracle Application Express Images" on page 1-17.
2
Configuring Oracle Application Express
Listener
This section explains how to use Oracle Application Express Listener Administration
to configure Oracle Application Express Listener. It describes how to set up a database
connection, configure security, define file caching, create pre and post processing
procedures, and perform other tasks.
Topics:
Configuring Security
Defining Caching
Viewing Status
2-1
Once you have completed the configuration process, use the following URL to access
Oracle Application Express Listener Administration:
1.
2.
Note that in order to log in using this URL, a user must have the Manager role.
Username - Defines the name of the database user for the connection.
Connection Type - Select Basic, TNS, or Advanced. The fields that display depend
on the type selected.
Note that Username, Connection Type, Port, and SID contain default values.
Topics:
Establish a Basic Connection
2.
For Username, enter the name of the database user for the connection.
3.
4.
5.
6.
7.
a.
b.
Click Apply.
2.
For Username, enter the name of the database user for the connection.
3.
4.
5.
TNS Alias Name - The TNS alias name must match the name in the
tnsnames.ora file.
b.
Click Apply.
2.
For Username, enter the name of the database user for the connection.
3.
2-3
4.
5.
SID:
jdbc:oracle:thin:<host>:<port>:<sid>
Example:
jdbc:oracle:thin:myhost:1521:orcl
jdbc:oracle:oci8:myhost:1521:orcl
Service name:
jdbc:oracle:thin:@//<host>:<port>/<servicename>
Example:
jdbc:oracle:thin:@//myhost:1521/orcl.us.oracle.com
6.
Click Apply.
See Also: Oracle Database Net Services Administrator's Guide for more
information about connection formats.
2.
For Username, enter the name of the database user for the connection.
3.
4.
5.
6.
Configuring Security
7.
Click Apply.
Tip: Except for the JDBC Driver type, JDBC options can also be
changed during run time
Configuring Security
Use the Security tab to validate procedure requests and determine if a user is allowed
to access the procedure. Click each section heading to expose the content.
Topics:
2.
3.
Note that the wildcard characters asterisk (*) and question mark (?) are
supported. Use an asterisk (*) to substitute zero or more characters and a question
mark (?) to substitute for any one character.
2-5
Configuring Security
If the Inclusion list field is left blank, then the Oracle Application Express Listener
does not validate the procedure names to determine if the procedure is allowed for
processing.
4.
Click Apply.
Tip: The advantage of using Allowed Procedures is that the
procedure names and procedure patterns are stored in the Oracle
Application Express Listener, whereas invoking the Database
Validation Function requires a database round-trip.
2.
3.
Note that the wildcard characters asterisk (*) and question mark (?) are
supported. Use an asterisk (*) to substitute zero or more characters and a question
mark (?) to substitute for any one character.
If the Exclusion list field is left blank, then the Oracle Application Express Listener
does not validate the procedure names to determine if the procedure is allowed for
processing.
4.
To disable this feature, select Disable Default Internal Exclusion List. See "About
the Internal Exclusion List" on page 2-6.
5.
Click Apply.
Configuring Security
This option enables you to disable the default internal exclusion list, however, Oracle
does not recommend this approach. Instead, Oracle recommends using the external
exclusion list solely for debugging purposes.
Disabling the Internal Exclusion List To disable the internal exclusion list:
1.
2.
3.
4.
Click Apply.
2.
3.
In the field provided, enter the name of the Database Validation Function.
The validation function you specify is a stored function that resides in the
database. If the validation function you specify does not exist, an error message
displays.
The validation function returns true if the procedure is allowed for processing.
Otherwise, it returns false.
If the Validation Functions field is left blank, then Oracle Application Express
Listener does not validate the procedure name to determine if the procedure
should be allowed for processing.
4.
Click Apply.
2-7
Configuring Security
RETURN true;
ELSE
RETURN false;
END IF;
END CHECK_VALID_PROCEDURE;
2.
3.
Total Cache Entries - Displays the total number of procedure names that are
valid or invalid in the Security Cache.
Clear Cache - If the total cache entries is greater than zero, then the Clear
Cache button displays, enabling you to delete the cache entries.
As a best practice, clear the cache whenever a Database Validation Function is
updated.
4.
Click Apply.
2.
3.
Defining Caching
Defining Caching
The Oracle Application Express Listener enables you to cache file-based content for
quick access. Caching is only enabled if you specify the procedure names.
Topics:
2.
Option
Procedure Name
Description
Specify the procedure names to allow for caching of their files.
The procedure names can contain the wildcard characters
asterisk (*) and question mark (?). Use an asterisk (*) to
substitute zero or more characters and a question mark (?) to
substitute for any one character
Separate multiple procedures with a comma, for example:
p, wwv_flow_file*, download_my_file
If selected, files that are most recently used will remain in the
cache.
Maximum entries
Expires after
Specify the length of time after the files expire. Note the
selected value must be a numeric value greater than 0.
duration
Select the amount of time from the list. Options include: days,
hours, or minutes.
2-9
Tip: Once you specify a Procedure Name, the Keep files for the
specified duration and Keep most recently used files button are
enabled.
3.
4.
a.
Total Cache Entries - Displays the total number of files that are cached.
b.
Clear Cache - If the total cache entries is greater than zero, then the Clear
Cache button displays, enabling you to delete the cache entries.
c.
Click Apply.
Oracle Application Express Listener executes the procedures in the order specified in
the Procedure Names field (for example, proc1, proc2, . . . , procN).
Viewing Status
Oracle Application Express Listener executes the procedures in the order specified in
the Procedure Names field (for example, proc1, proc2, . . . , procN).
Viewing Status
Click the Status tab to view statistics, error tracking, and logging information.
Tip:
Users with the manager role only see the Status tab.
Topics:
About Statistics
About Logging
About Statistics
Click Statistics to expand or hide this section.
Statistics displays the following Oracle Application Express Listener information:
Server uptime.
Total accesses, total traffic, total errors, total file downloads, and total processing
time.
Active requests.
Security enabled or disabled, and its cache entries and maximum entries.
Cache file enabled or disabled, and its cache entries and maximum entries.
About Logging
Click Logging to expand or hide the log of the different types of activities that occur in
the Oracle Application Express Listener. The log includes activities such as adding a
procedure to the cache, finding a procedure in the cache, or reloading a procedure. The
log displays the database time and processing time in milliseconds for that procedure.
2.
Default Web Page - Specify the default page to display (for example, apex).
Show debug messages on console - Select this option to display debugging
messages on the application server console.
Show error messages on browser - Select this option to display error messages
on the browser.
Keep most recent error messages - Select this option to retain the error
messages.
Maximum Error Entries - Specify the total number of error messages to retain.
Total Error Entries - If the total error entries is greater than zero, then the Clear
Cache button is enabled. Click the Clear Cache button to delete the error
entries.
Under Logging:
Keep most recent log messages - Select this option to retain log messages.
Maximum Log Entries - Specify the total number of error messages to retain.
3.
Total Log Entries - If the total log entries is greater than zero, then the Clear
Cache button is enabled. Click the Clear Cache button to delete log entries.
Click Apply.
If the Oracle Application Express Listener detects missing data or incorrect
information, then an error message displays. When saved, the data is written to
the Oracle Application Express Listener configuration file and the specified default
Web page appears.
See Also:
3
RESTful APIs and Resource Templates
This section describes how to use Oracle Application Express Listener RESTful
Application Programming Interfaces (APIs) to expose data stored in an Oracle
database.
Topics:
The URI template may contain zero or more parameters (for example, {userid})
which along with the HTTP headers sent with a HTTP request can be bound to
parameters in the SQL query or anonymous PL/SQL block.
RESTful APIs and Resource Templates
3-1
2.
The literal value World is bound to the URI Template parameter named person.
About URI Template Grammar Currently there is no standardized URI Template syntax.
Oracle Application Express Listener supports a limited subset of the current draft
specification. The following grammar rules apply:
Parameter names must start with an alphabetic character followed by zero or more
alphanumeric characters and the characters: underscore (_) or hyphen (-).
There is no support for optional parameters.
Secure Hash - The contents of the returned resource representation are hashed
using a secure digest function to provide a unique fingerprint for a given resource
version.
Query - Manually define a query that uniquely identifies a resource version.
Instead of hashing the entire resource representation, only the result of the query is
hashed. A manually defined query can often generate an entity tag more
efficiently than hashing the entire resource representation.
None - Do not generate an entity tag.
Referencing Parameters
2.
Choose the HTTP method you wish to implement. See "About Supported HTTP
Methods" on page 3-3.
3.
Click Add.
Each resource handler displays as a separate tab identified by the HTTP method
that it implements.
3-3
Comma Separated Values Query - Executes an SQL and transforms the result set
into a CSV representation.
Query - Executes an SQL Query and transforms the result set into a JSON
(JavaScript Object Notation) representation. A specialization of this strategy,
generates a single JSON result. Note that the result is not wrapped in a JSON
array.
PL/SQL Block - Executes an anonymous PL/SQL block and transforms any OUT
or INOUT parameters into a JSON representation.
Media Resource - Executes a SQL Query conforming to a specific format and
turns the result set into a binary representation with an accompanying HTTP
Content-Type header identifying the internet media type of the representation.
2.
Name - Enter the name of the parameter as passed to the resource handler
(required).
Aliasing - Enter the original name of the parameter if you wish to rename a
parameter (optional).
Source - Enter either the header (that is, the HTTP header) or URI (that is, the
parameter from the URI template).
Access - IN, INOUT, or OUT. URI Template parameters can only be IN. A value
of IN for a header parameter implies the header will be present in the HTTP
request. A value of INOUT indicates the value will be present in both the HTTP
request and response. A value of OUT indicates the value will only be present
in the HTTP response.
Type - The primitive data type of the parameter: String, Integer, Double,
Boolean, or Long
Tip:
Referencing Parameters
You can reference parameters in the resource handler definition by prefixing the
parameter name with a colon character, for example:
3-4 Oracle Application Express Listener Installation and Developer Guide
select 'Hello ' || :person || ' from APEX' greeting from dual
This example causes the :person token to be replaced with the actual value of the
person parameter when the resource template is evaluated. Parameter substitution
uses the standard Oracle Prepared Statement facilities, so the normal rules apply as to
when and where parameters can be placed.
For example the following example is not valid, because the table name cannot be
specified using a parameter:
select * from :table where some_id = :id
Secure - The resource must be accessed over a secure channel (for example,
HTTPS).
Secure & Authenticated - User must be logged in and the channel must be secure.
The security constraint can only be applied when the Oracle Application Express
Listener is correctly configured to use one of the supported security configurations.
For more information, see "About Resource Template Security" on page 3-16
Query
Media Resource
PL/SQL Block
Query
This resource handler type evaluates the supplied query and turns the resulting rows
into a JSON representation. Consider the following example:
select 'Hello ' || :person || ' from APEX' greeting from dual
3-5
In this example:
The column name will always be in lower-case and the case of the value will be
preserved
If the query has no results, the items property referred to above will just contain an
empty array
Since a query can only retrieve data and can never change the state of the database, the
Query resource handler can only be used the HTTP GET Method.
hardware4,memory components/upgrades,14,10
hardware5,"processors, sound and video cards, network cards, motherboards",15,10
...
In this example:
Columns containing commas or double quotes will be quoted with the double
quote character
Media Resource
This resource handler type evaluates a specially structured SQL query and returns the
resulting row as a binary representation. The query must follow the following format:
select <content_type>, <content_body> from ... where ...
In this format:
The query must return one row and one row only
Similar to the Query resource handler, the Media resource handler can only be used for
the HTTP GET method, since it can only evaluate an SQL Query. This resource handler
type is very useful for generating XML and HTML representations.
The following example generates a KML representation of customer locations by state,
making it possible to easily share customer location data with GIS applications:
select 'application/vnd.google-earth.kml+xml', xmlquery('
<k:kml xmlns:k="http://www.opengis.net/kml/2.2">
<k:Folder>
<k:name>{$state}</k:name>
{ for $c in ora:view("oe","customers")/ROW
let $loc := $c/CUST_GEO_LOCATION/SDO_POINT
where $c/CUST_ADDRESS/STATE_PROVINCE = $state
return
<k:Placemark>
<k:name>{concat($c/CUST_FIRST_NAME," ",
$c/CUST_LAST_NAME)}</k:name>
<k:Point>
<k:coordinates>{$loc/X/text()},
{$loc/Y/text()},0</k:coordinates>
</k:Point>
</k:Placemark>
}
</k:Folder>
</k:kml>' passing :state as "state" returning content) from dual
3-7
PL/SQL Block
This resource handler type evaluates the supplied PL/SQL block and turns any
outbound parameters into a JSON representation. This resource handler type is
typically used to service HTTP POST,PUT and DELETE operations. This handler has
several features aimed at increasing ease of use, including:
For example, suppose you have a Resource Template with the following definition:
Aliasing
Source
Access
Type
name
Slug
Header
IN
String
status
X-APEX-STATUS-CODE
Header
OUT
Integer
location
X-APEX-FORWARD
Header
OUT
String
The above handler inserts the supplied image into the scott.gallery table, returns
the location of the stored image, and indicates the operation created a new resource.
Note the following:
When the Oracle Application Express Listener sees this header in the response, it
abandons generating a JSON representation of the outbound parameters and
attempts to return a representation of the indicated location.
Note that this example assumes that there is a separately defined Resource
Template that retrieves resources of the form gallery/<name>.
Upload Images
About URIs
About URIs
Throughout this example, URIs and URI Templates are referenced using an
abbreviated form that omits the host name and context path. Consider the following
example:
gallery
To access this URI in your Web browser, you would use a URI in the following format:
http://<host>:<port>/apex/gallery
Where:
<host> is the host on which the Oracle Application Express Listener is running.
<port> is the port on which the Oracle Application Express Listener is running.
apex is the Web application context where the Oracle Application Express
Listener is deployed.
3-9
Enumerates all the images in the gallery. For each image, you must know:
Upload Images
This gallery URI functions as the endpoint to which clients can submit new images.
The upload facility should be able to accept requests containing the actual image data
and also requests containing multipart form-data (as generated by HTML forms).
To build the upload features:
1.
2.
Name
Aliasing
Source
Access
Type
title
Slug
Header
IN
String
status
X-APEX-STATUS-CODE
Header
OUT
Integer
location
X-APEX-FORWARD
Header
OUT
String
3.
4.
PL/SQL block assigns a unique id to the image (image_id) and inserts the
image data, image title, and image content type into the scott.gallery
table.
Block returns a 201 status which indicates a new resource has been created.
Block indicates the location of the created resource is of the form
gallery/<imageid>.
Once you create the Resource Template, save it, and proceed to the next step.
2.
Note that:
This illustrates a simple way to generate static text resources using Oracle
Application Express Listener. Notice that the first column in the query is
mapped to the content type of the resource and the second column becomes
the body of the resource.
Oracle does not typically recommend this approach since the SQL literal
strings cannot be very big and it involves a database round-trip for data that is
not actually retrieved from the database.
Instead, Oracle recommends having your Web application serve static
resources directly.
3.
This form contains two fields. The first indicates the image title and the second
the image content
When you have created the Resource Template, try it in your browser. Enter a URL
with the format:
http://<host>:<port>/apex/upload
2.
Name
Aliasing
imageid
3.
Source
Access
Type
URI
IN
Integer
Note that this query retrieves the content type and image data for the specified
image.
Open the gallery Resource Template and add the following data for a GET
resource handler:
HTTP Method
GET
Handler Type
Media Resource
This will enable you to display the data stored in the gallery.
2.
Media resource handler is used to define a HTML resource and the HTML is
generated dynamically using the xmlquery() SQL function.
Content type of the resource is specified as text/x-apex-html. This is an
Oracle Application Express specific content type. When Oracle Application
Express Listener encounters this content type it expects the content of the
resource to be well formed XML. It then transforms this XML into HTML.
Generated HTML includes a link to an alternate JSON representation of the
gallery data:
<link rel="alternate" type="application/json"
href="gallery?alt=json"/>
For each image in the gallery a <li> element is generated. The <li> element
is marked up with Microdata to assist clients in extracting the gallery data
from the HTML. Microdata is a feature of HTML5 enabling structured
semantic data to be interwoven into HTML documents. This semantic data can
be easily and reliably parsed by clients.
3.
When you have updated the Resource Template go ahead and try it. In your Web
browser, enter a URL using the format:
http://<host>:<port>/<apex>/gallery
Create gallery.css
Create gallery.js
Create gallery.css
To create gallery.css:
1.
2.
This style sheet transforms the numbered list of images into a series of thumbnails.
It uses some modern CSS features such as transforms and shadows which will not
work on older Web browsers.
3.
When you have created the Resource Template edit the gallery Resource
Template and add the following in the <head> section:
<link rel="stylesheet" href="gallery.css" type="text/css"/>
4.
Save your changes and view the gallery again using a URL in the format:
http://<host>:<port>/apex/gallery
Create gallery.js
To create gallery.js:
1.
2.
This script uses the JQuery UI framework to transform the Upload Image link to a
clickable button.
The structured semantic data that clients need to interact with the API is encoded in
the HTML as microdata. Clients have two choices for processing this microdata, they
can either:
Parse it directly from the HTML (browser-based applications will be able to use
the HTML5 Microdata JavaScript APIs)
Process the alternate JSON representation that Oracle Application Express Listener
generates automatically
New Images can be uploaded by posting data to the URI indicated by the
gallery property.
Note that the client only knows about a single URI (gallery) and discovers all other
URIs from this initial URI. It does not know anything about the structure of the URIs.
It only knows the names of properties that identify certain link types. As the
application evolves, the URIs are free to change and clients will not be affected.
When you configure either of these two options, Oracle Application Express Listener
can honor any Security Constraint values specified in the Resource Template. Note
3-16 Oracle Application Express Listener Installation and Developer Guide
that the identity of the authenticated user is available to the Resource Template using
the X-APEX-USER header that is passed with the request.
Topics:
2.
3.
Click Save.
2.
3.
Click Save.
2.
3.
A
About the Configuration File
The section describes the Oracle Application Express Listener configuration file.
Topics:
2.
2.
3.
${user.home}/<Mount-Point>/apex-config.xml.
4.
A-1
5.
$HOME/apex-config.xml
6.
Where:
2.
3.
Remove the comment markers (<!--, -->) around the <init-param> for
config.dir.
4.
Edit the value of the <param-value> element to point to the location where you
created apex-config.xml.
5.
6.
Note that some application servers unzip the apex.war file into a folder after
deploying the application. In that case, navigate to the unpacked version of web.xml
created by the application server and edit it directly. After editing the file, restart the
application server.
<entry key="key.name">value</entry>
<entry key="key.name">value</entry>
. . .
<entry key="key.name">value</entry>
</properties>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment> Created: Tue Apr 27 03:00:39 PDT 2010 Version: 0.10.111.13.51 </comment>
<entry key="apex.db.username">APEX_PUBLIC_USER</entry>
<entry key="apex.db.password">@05D783103A9583BF206ABCA52F7D2E850B</entry>
<entry key="apex.db.connectionType">basic</entry>
<entry key="apex.db.hostname">localhost</entry>
<entry key="apex.db.port">1521</entry>
<entry key="apex.db.sid">ora111</entry>
<entry key="apex.db.servicename"></entry>
<entry key="apex.db.tnsAliasName">MY_TNSALIAS</entry>
<entry key="apex.db.tnsDirectory">C:\ORACLE\NETWORK\ADMIN</entry>
<entry key="apex.db.customURL">
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(HOST=myhost)(PORT=1521))(CONNECT_DATA=(SERVICE_
NAME=ora111.us.oracle.com)))</entry>
<entry key="apex.jdbc.DriverType">thin</entry>
<entry key="apex.jdbc.InitialLimit">3</entry>
<entry key="apex.jdbc.MinLimit">1</entry>
<entry key="apex.jdbc.MaxLimit">10</entry>
<entry key="apex.jdbc.MaxStatementsLimit">10</entry>
<entry key="apex.jdbc.InactivityTimeout">1800</entry>
<entry key="apex.jdbc.AbandonedConnectionTimeout">900</entry>
<entry key="apex.security.inclusionList">apex, p, v, f, wwv_*, apple, y*,
c*</entry>
<entry key="apex.security.exclusionList">customer_account,bank*, employe?</entry>
<entry key="apex.security.disableDefaultExclusionList">false</entry>
<entry key="apex.security.requestValidationFunction">CHECK_VALID_PROCEDURE</entry>
<entry key="apex.security.maxEntries">2000</entry>
<entry key="apex.cache.caching">true</entry>
<entry key="apex.cache.procedureNameList">p,download_file</entry>
<entry key="apex.cache.type">lru</entry>
<entry key="apex.cache.maxEntries">500</entry>
<entry key="apex.cache.expiration">7</entry>
<entry key="apex.cache.duration">days</entry>
<entry key="apex.cache.monitorInterval">60</entry>
<entry key="apex.cache.directory">C:\data\cachefiles</entry>
<entry key="apex.procedure.preProcess">SCOTT.PREPROC1, INITIALIZE,
PKG1.PROC</entry>
<entry key="apex.procedure.postProcess">SCHEMA1.SUBMIT.REQUEST,FINISHTASK</entry>
<entry key="apex.misc.defaultPage">apex</entry>
<entry key="apex.debug.debugger">false</entry>
<entry key="apex.debug.printDebugToScreen">false</entry>
<entry key="apex.error.keepErrorMessages">true</entry>
<entry key="apex.error.maxEntries">50</entry>
<entry key="apex.log.logging">true</entry>
<entry key="apex.log.maxEntries">50</entry>
</properties>
A-3
Table A1
Key
Type
Description
Example
apex.cache.caching
boolean
Supported values:
true
true
false (default)
string
C:\data\cachefiles
apex.cache.duration
string
Supported values:
days
days (default)
minutes
hours
numeric
Defaults to 7.
apex.cache.maxEntries
numeric
500
Defaults to 500.
apex.cache.monitorInter numeric
val
60
p, download_file
apex.db.connectionType
string
string
Supported values:
expire
iru (default)
basic
tns
advanced
iru
basic
Type
Description
Example
apex.db.customURL
string
jdbc:oracle:thin:@(DESCR
IPTION=(ADDRESS=
(PROTOCOL=TCP)
(HOST=myhost)(PORT=1521)
)
(CONNECT_DATA=(SERVICE_
NAME=ora111.us.example.c
om)))
apex.db.hostname
string
myhostname
apex.db.password
string
!password4user
apex.db.port
numeric
1521
apex.db.servicename
string
ora111.example.com
apex.db.sid
string
ora111
apex.db.tnsAliasName
string
MY_TNSALIAS
apex.db.tnsDirectory
string
C:\ORACLE\NETWORK\ADMIN
apex.db.username
string
APEX_PUBLIC_USER
apex.debug.debugger
boolean
false
Supported values:
apex.debug.printDebugTo boolean
Screen
true
false (default)
false
Supported values:
apex.error.keepErrorMes boolean
sages
true
false (default)
true
Supported values:
apex.error.maxEntries
numeric
true
false (default)
50
Defaults to 50.
A-5
Type
apex.jdbc.AbandonedConn numeric
ectionTimeout
Description
Example
900
Specify how long a borrowed (in
use) connection can remain unused
before it is considered as
abandoned and reclaimed. The
abandoned connection timeout is in
seconds.
Defaults to 900.
apex.jdbc.DriverType
string
apex.jdbc.InactivityTim numeric
eout
thin
oci8
thin
apex.jdbc.InitialLimit
numeric
Defaults to 3
apex.jdbc.MaxLimit
numeric
10
Defaults to 10
apex.jdbc.MaxStatements numeric
Limit
10
Defaults to 10.
apex.jdbc.MinLimit
numeric
Defaults to 1.
apex.log.logging
boolean
true
Supported values:
apex.log.maxEntries
numeric
true
false (default)
50
Defaults to 50.
apex.misc.defaultPage
string
apex.procedure.postProc string
ess
apex
SCHEMA1.SUBMIT.REQUEST,F
INISHTASK
Type
Description
Example
apex.procedure.preProce string
ss
SCOTT.PREPROC1,
INITIALIZE, PKG1.PROC
apex.security.disableDe boolean
faultExclusionList
Supported values:
false
apex.security.exclusion string
List
true
false (default)
customer_account,bank*,
employe?
apex, p, v, f, wwv_*,
y*, c*
2000
Defaults to 2000.
Specify a validation function to
determine if the requested
procedure in the URL should be
allowed or disallowed for
processing. The function should
return true if the procedure is
allowed; otherwise, return false.
CHECK_VALID_PROCEDURE
A-7
B
Troubleshooting
For Oracle WebLogic Server - See "Create Web Archive for Oracle Application
Express Images" on page 1-5 and "Install the Deployment" on page 1-6.
For Oracle GlassFish Server - See "Copy Oracle Application Express Images" on
page 1-13.
For Oracle Containers for J2EE (OC4J) - See "Copy Oracle Application Express
Images" on page 1-17.
Issue 1: Oracle Application Express Images Copied But Still Not Displaying
You have copied the Oracle Application Express images to your application server as
described in "Installing Oracle Application Express Listener" on page 1-1. However,
the images are still not displaying:
Resolution:
1. Make sure the Oracle Application Express images that you copied to your
application server are the same Oracle Application Express version that is installed
in your database.
2.
Troubleshooting B-1
Resolution:
1. Execute reset_image_prefix.sql utility located in Oracle Application
Express to change the default image prefix path (for example, /i/ ) to your Web
applications context root for the images. Execute this utility using SQL*Plus and
connect as SYS. See Oracle Application Express Installation Guide.
The default Web applications context root for the Oracle
Application images is i. Oracle recommends to use the default context
root, i, for the Oracle Application images unless your business
practice requires to change it.
Note:
The prefix path is case-sensitive and must begin and end with a forward slash.
Consider the following example:
SQL> @<apex directory>\utilities\reset_image_prefix.sql
Enter the Application Express image prefix [/i/] /apeximages/myfolder/
. . .
Image Prefix update complete
2.
Next, update the image prefix for each application in Oracle Application Express
Application Builder.
To update the image prefix for each application in Oracle Application Express,
release 4.0:
a.
b.
c.
Select an application.
d.
Click the Edit Application Properties button to the right of the application
name.
The Edit Application page appears.
e.
f.
To update the image prefix for each application in Oracle Application Express,
release 3.0:
a.
b.
c.
Select an application.
d.
e.
f.
g.
Troubleshooting B-3
Index
A
Apache JServ Protocol (AJP), 3-17
apex-config.xml, A-1
about configuration parameters, A-2
configurable parameters, A-3
locating, A-1
setting config.dir parameter, A-2
apex-config.xml parameters
apex.cache.caching, A-4
apex.cache.directory, A-4
apex.cache.duration, A-4
apex.cache.expiration, A-4
apex.cache.maxEntries, A-4
apex.cache.monitorInterval, A-4
apex.cache.procedureNameList, A-4
apex.cache.type, A-4
apex.db.connectionType, A-4
apex.db.customURL, A-5
apex.db.hostname, A-5
apex.db.port, A-5
apex.db.servicename, A-5
apex.db.sid, A-5
apex.db.tnsAliasName, A-5
apex.db.tnsDirectory, A-5
apex.db.username, A-5
apex.debug.debugger, A-5
apex.debug.printDebugToScreen, A-5
apex.error.keepErrorMessages, A-5
apex.error.maxEntries, A-5
apex.jdbc.DriverType, A-6
apex.jdbc.InactivityTimeout, A-6
apex.jdbc.InitialLimit, A-6
apex.jdbc.MaxLimit, A-6
apex.jdbc.MaxStatementsLimit, A-6
apex.jdbc.MinLimit, A-6
apex.log.logging, A-6
apex.log.maxEntries, A-6
apex.misc.defaultPage, A-6
apex.procedure.postProcess, A-6
apex.procedure.preProcess, A-7
apex.security.disableDefaultExclusionList, A-7
apex.security.exclusionList, A-7
apex.security.inclusionList, A-7
apex.security.maxEntries, A-7
apex.security.requestValidationFunction, A-7
Application Express
missing images, B-1
Application Express Listener
about, 1-1
about RESTful APIs, 3-1
about upgrading, 1-20
accessing Listener Administration, 2-1
configuration file, A-1
configuration file, locating, A-1
configuring, 2-1
default Web page, 2-12
downloading, 1-2
error reporting, 2-12
installation overview, 1-2
logging, 2-12
redeploying Oracle Containers for J2EE
(OC4J), 1-22
redeploying Oracle GlassFish Server, 1-22
redeploying Oracle WebLogic Server, 1-21
supported Java Enterprise Edition application
servers, 1-1
system requirements, 1-2
viewing status information, 2-2
Application Express Listener Administration
about, 2-2
accessing, 2-1
cannot log in, B-3
configuring miscellaneous, 2-12
configuring security, 2-5
creating Pre-Post processing procedures, 2-10
defining caching, 2-9
establishing a database connection, 2-2
viewing status, 2-11
Application Express Listener caching
specifying procedure names to allow, 2-9
Application Express Listener post-processing
about, 2-10
Application Express Listener pre-processing
about, 2-10
D
database connection
Advanced connection, 2-3
Basic connection, 2-3
establishing, 2-2
Index-1
E
entity tag
strategies to generate, 3-3
error reporting, 2-12
G
GlassFish Server
See Oracle GlassFish Server,
1-24
I
installation
overview, 1-2
installation options
Oracle Containers for J2EE (OC4J), 1-17
Oracle GlassFish Server, 1-12
Oracle WebLogic Server, 1-5
standalone mode, 1-3
L
Listener security
about security settings, 2-8
specifying allowed procedures, 2-5
specifying blocked procedures, 2-6
specifying database validation functions,
understanding security processing, 2-8
logging, 2-12
2-7
O
Oracle Containers for J2EE (OC4J), 1-2
accessing Application Express Listener
Administration, 1-20
copying Application Express images, 1-17
copying Application Express images
directory, 1-24
creating roles, 1-18
creating users, 1-19
creating users and roles, 1-18
installing the deployment, 1-19
installing with, 1-17
redeploying when upgrading, 1-22
starting the Application Server Control
Console, 1-18
starting the OC4J server, 1-18
Oracle GlassFish Server, 1-2
about roles, 1-14
accessing Application Express Listener
Administration, 1-16
copying Application Express images, 1-13
copying Application Express images
directory, 1-24
create users and roles, 1-13
creating users, 1-14
Index-2
S
standalone mode
about JServ Protocol (AJP) support, 1-5
T
troubleshooting, B-1
Application Express missing images, B-1
cannot log in to Listener Administration, B-3
U
Uniform Resource Identifier (URI), 3-2
grammar, 3-2
upgrading Application Express
about, 1-23
copying images directory with J2EE (OC4J), 1-24
copying images directory with Oracle GlassFish
Server, 1-24
copying images directory with Oracle WebLogic
Server, 1-23
Index-3
Index-4