Articles is a simple content management application with richly documented source code and a self-installation process to help you quickly master information that is most important to developing applications. As the name implies, Articles enables the management of article assets.
This chapter contains the following sections:
The Articles home page displays two articles that can be edited directly in WEM, from the custom interface that you see in the figure above. The application demonstrates usage of the WebCenter Sites REST API to perform a search query from Java code and an asset modification query from JavaScript code. The Articles application and REST services can be run on different application servers. Cross-domain restrictions in JavaScript prevent AJAX calls directly from the Articles application to the REST services. This is why a simple ProxyController is introduced. It redirects calls from JavaScript to WEM REST Web Services. Custom implementations may reuse this controller implementation.
The application's home page looks like this:
The Articles application is based on the Spring MVC framework. Articles includes a predefined administrative user named fwadmin
with password xceladmin
, who is assigned to the REST group named RestAdmin
. The application's self-installer contains specifications for registering the Articles application and installing its asset model and sample articles. The application does not have internally configured sites or role-protected functions. It has a single, iframe view. Additional specifications are available in Chapter 71, "WEM Framework: The Articles Sample Application."
In this section, you will first build and deploy the Articles application, then run the installer.
This section contains the following topics:
Section 71.2.1, "Building and Deploying the 'Articles' Application"
Section 71.2.2, "Registering the Articles Sample Application"
Determine or create the site to which you will assign the sample articles application. The default site is FirstSiteII (a sample WebCenter Sites CM site). It is possible that FirstSiteII is not installed on your system.
To select or create a site, log in to WEM Admin at the URL:
http://<server>:<port>/<cs_application_context>/login
using the credentials of a general administrator (fwadmin
/ xceladmin
are the default values).
Note:
In step 5, you will specify the site you have chosen here, which will allow the installer to enable the application's asset model and assets on that site.
Download and install SUN JDK (1.5 or later) from the following URL:
http://java.sun.com/
Download the latest Apache Ant from http://ant.apache.org/
and place the Ant bin
directory into the system PATH
.
Copy servlet-api.jar
to the Articles application lib
folder. The jar
file can be taken from your application server's home directory (for example, Tomcat's servlet-api.jar
is located in the home
lib
directory).
Set the following parameters in the applicationContext.xml
file (in src\articles\src\main\webapp\WEB-INF\
):
casUrl
: Specify the URL of the CAS application: http://<server>:<port>/<context_path>
csSiteName
: Specify the name of the site that you selected in step 1.
csUrl
: Specify the URL where the WebCenter Sites platform is running: http://<server>:<port>/<context>
csUserName
: The default value is fwadmin
. This is the application's predefined user, a general administrator with membership in the RestAdmin
group which has unrestricted permissions to REST services. If you specify a different user, you must name a user equivalent to fwadmin
. For instructions on creating a general administrator, see the Oracle Fusion Middleware WebCenter Sites Administrator's Guide.
csPassword
: Specify the predefined user's password.
articlesUrl
: Point to the URL where the sample application will be accessed.
Run the Ant build with the default target (enter ant on the command line).
Deploy the resulting target/articles-1.0.war
to an application server.
On deployment, the following content is copied from source to target: The contents of the lib
folder are copied to /WEB-INF/lib
. The contents of the resources
folder are copied to /WEB-INF/classes/
. For information about the structure of the source application, see Chapter 72, "WEM Framework: Developing Applications."
The Articles application has a self-installer, which starts running when you log in to the install.app
page. The installer registers the sample application (including the view) and creates its data model and assets in the WebCenter Sites database.
Note:
Specifications for the registration asset types FW_View
and FW_Application
can be found in the Oracle Fusion Middleware WebCenter Sites REST API Bean Reference and in Chapter 78, "WEM Framework: Registering Applications Manually".
Navigate to the install.app
page:
http://<hostname>:<portnumber>/<context_path>/install.app
For example:
http://localhost:9080/articles-1.0/install.app
Use any credentials to log in (the application's predefined user, specified by csUserName
and csPassword
(see Section 71.2.1, "Building and Deploying the 'Articles' Application"), provides you with permissions to the application. The sample application does not perform authorization checks as it does not use roles.)
The self-installation process invokes InstallController.java
, which first registers the application (including the view, in an application Bean), then writes the sample asset type and assets to the database.
InstallController.java
registers the Articles application with the WEM Framework:
InstallController.java
creates an application asset named Articles
(asset type FW_Application
) in the WebCenter Sites database.
The iconurl
attribute points to the URL where the icon representing the application is located.
The layouturl
attribute specifies the URL of the layout.app
page (implemented by LayoutController.java
). The layout.app
page defines the application layout.
The layouttype
attribute takes the default (and only) value: layoutrenderer
. Using the layoutrenderer
value, the UI container is responsible for rendering the application's associated views by using the layout.app
page, specified by layouturl
.
InstallController.java
creates a view asset named ArticlesView
(asset type FW_View
) in the WebCenter Sites database. The association between the view asset and the application asset is made through the views
attribute in the FW_Application
asset type.
InstallController.java
installs the application's asset model and sample assets:
Creates the application's FW_Article
asset type in the WebCenter Sites database. (FW_Article
is a basic asset type defined in InstallController.java
.)
Enables the FW_Article
asset type on the site that was specified in the csSiteName
parameter in applicationContext.xml
(step 5 of Section 71.2.1, "Building and Deploying the 'Articles' Application").
Writes the two sample article assets to the FW_Article
asset type tables. (The articles' text and images are stored in: /sample app/articles/src/main/resources/install
)
InstallController.java
creates an asset type-based index to support searches on assets of type FW_Article
. (The controller specifies index configuration data.)
When the installation process completes successfully, InstallController.java
displays the following page (at http://<server>:<port>/articles/install.app
), where Home is home.app
:
Navigate to the home.app
page:
http://<hostname>:<portnumber>/<context_path>/home.app
For example:
http://localhost:8080/articles-1.0/home.app
Use any credentials to log in (the application's predefined user, specified by csUserName
and csPassword
(see Section 71.2.1, "Building and Deploying the 'Articles' Application"), provides you with permissions to the application. The sample application does not perform authorization checks as it does not use roles.)
WEM displays the application's home page:
If you wish to experiment with this application (for example assign it to other sites and add users), use WEM Admin. For more information on the Web Experience Management Framework, see the Oracle Fusion Middleware WebCenter Sites Administrator's Guide.