Oracle® Fusion Middleware Developer's Guide for Oracle WebCenter 11g Release 1 (11.1.1) Part Number E10148-02 |
|
|
View PDF |
Oracle WebCenter Wiki and Blog Server includes features that enable you to incorporate wikis and blogs into an application or portal. This chapter explains how to integrate wiki and blog functionality into your applications at design time.
This chapter includes the following sections:
Section 22.1, "Adding Wikis or Blogs to Your Application or Portal"
Section 22.2, "Oracle WebCenter Wiki and Blog Server URL Endpoints and Query String Parameters"
Section 22.3, "Oracle WebCenter Wiki and Blog Server Web Services Interface Interface"
You can add wikis or blogs to your application by using the following methods:
Through the Web Clipping portlet or any portlet capable of consuming a URL
Through an iFrame, which you include in a page in your custom WebCenter application
Through the use of a custom-built user interface that you can create using the provided web services
Sample portlets that demonstrate some of these integration methods are located on the Oracle Technology Network at the following URL:
From here, you can learn more about the sample portlets, as well as how to download and install them.
Note:
You can use Oracle Access Manager-based single sign-on, Oracle Single Sign-On (OSSO), and SAML-based security to secure Oracle WebCenter Wiki and Blog Server. For information, see Section 12.7 "Setting Up the Wiki Service" in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.The users you set up for your applications must match the user credentials on the Oracle WebCenter Wiki and Blog Server. Once a user is authenticated, if the user does not exist within the Oracle WebCenter Wiki and Blog Server, then the user is created and a default role is assigned to the user.
You can bring a wiki into your application through the Web Clipping portlet or any portlet capable of consuming a URL. For examples of portlets capable of consuming a URL, see the Oracle WebCenter Suite page on OTN (http://webcenter.oracle.com
).
Oracle WebCenter Framework includes a preconfigured Web Clipping portlet that you can register with your custom WebCenter application. Ensure that your application is secured and that the user credentials match on the Oracle WebCenter Wiki and Blog Server. You can learn more about this portlet in Chapter 32, "Creating Content-Based Portlets with Web Clipping."
Once you run your application to your browser, you can use the Web Clipping Studio to consume the desired URLs into your application. For information about the URL formats to use, see Section 22.2, "Oracle WebCenter Wiki and Blog Server URL Endpoints and Query String Parameters."
Figure 22-1 Sample Wiki Portlet in an Application
You can add wikis and blogs to a page in your application with an iFrame. Simply reference the desired URL from within an iFrame, as shown in Example 22-1 and Figure 22-2. For information about URL formats to use, see Section 22.2, "Oracle WebCenter Wiki and Blog Server URL Endpoints and Query String Parameters."
Example 22-1 Referencing a Wiki URL from an iFrame
<iframe src="http://server:port/owc_wiki/page/show.jz?inline=1&scope=domain" width="100%"></iframe>
In this code, replace the server and port number with those of the Oracle WebCenter Wiki and Blog Server.
Figure 22-2 shows an example of how you can use an iFrame to integrate wiki. This example shows this being done using a portlet.
Figure 22-2 Sample Wiki Portlet in an iFrame at Runtime
Oracle WebCenter Wiki and Blog Server provides web services that enable interaction between your application and the wiki. You can add wikis and blogs to your applications by calling web services along with a custom-built user interface. This requires you to call the web services directly and create the user interface for interactions with the WebCenter Wiki and Blog Server. Alternatively, you can just redirect to the prebuilt wiki and blog pages.
For information about how to use web services, see Section 22.3, "Oracle WebCenter Wiki and Blog Server Web Services Interface Interface."
When you reach the point where you enter the wiki or blog source in the URL-consuming portlet or in the iFrame, use the formats provided in Table 22-1.
If you want to add a hyperlink that references a specific wiki page or a blog, on one of your application pages, use the URL formats provided in Table 22-2.
You can use wiki and blog query string parameters to define context (within the application context or external to it), and look and feel (page background colors and fonts). Query string parameters are bits of information you add to a URL to refine the behavior of the URL target. Table 22-3 lists and describes query string parameters you can use in custom WebCenter application wiki and blog URLs.
Note:
By default, Oracle WebCenter and Oracle WebCenter Wiki and Blog Server do not share cookies. To enable this feature, you can update the settings in theweblogic.xml
file of your custom WebCenter application. For information, see Section 12.7 "Setting Up the Wiki Service" in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.For more information about using these URLs and query string parameters in your custom WebCenter application, see Section 22.1, "Adding Wikis or Blogs to Your Application or Portal."
Table 22-1 URL Formats for Exposing Wikis and Blogs in Applications
Type | URL Format |
---|---|
Wiki |
|
General Blog |
|
Personal Blog |
|
Table 22-2 Formats for Hyperlinks to Wikis and Blogs
Target | URL Format |
---|---|
Wiki |
|
General Blog |
|
Personal Blog |
|
Table 22-3 Query String Parameters to Use in Application Wiki and Blog URLs
All of these URL formats can take query string parameters to focus the result provided on the target page. Parameters, such as inline
and theme
, are session-level variables. Once the URL passes session-level variables to the target, the variable values continue to apply, even if you leave and return to the original target page. Also, session-level variables are applied even when the parameter is not included in subsequent URLs.
Once you have installed the WebCenter Wiki and Blog Server, you can access the Oracle WebCenter Wiki and Blog Server Web Services end point with the following URL:
http://host:port/owc_wiki/services/WikiRemoteService
Note:
In this URL, the host and port information refers to the computer where you installed your Oracle WebCenter Wiki and Blog server.Oracle Wiki and Blog Server Web Services provide access to obtain information and content from wiki pages and domains. It also enables the creation, modification, and removal of wiki pages and domains. You can use Oracle JDeveloper (or other tools) to create a proxy for the Web Services from the WSDL definition, located here:
http://host:port/owc_wiki/services/WikiRemoteService?WSDL
This section describes the Oracle Wiki and Blog Server Web Services interface. For information about the Web services security, refer to Section 22.3.2, "Oracle WebCenter Wiki and Blog Server Web Services Security."
Some of the methods return information in JavaBeans. Table 22-4 shows the attributes of the DomainInfo
and PageInfo
beans. You can also use the getter methods of the described attributes, for example, long getCreated()
.
Table 22-4 Oracle WebCenter Wiki and Blog Server Web Services Data Structures
DomainInfo Bean |
PageInfo Bean |
---|---|
String domain; |
String domain; |
String description; |
String name; |
String author; |
int revision; |
long created; |
int views; |
String startPage; |
String author; |
long created; |
|
String editor; |
|
long modified; |
|
String viewURL; |
|
String editURL; |
The Web Services methods include methods for accessing and performing actions on the domains and pages in the wiki, the blogs, and blog entries, as described in the following tables.
Table 22-5 Domain-Related Methods
Return Type | Method | Description |
---|---|---|
DomainInfo[] |
getAllDomainInfo(int maxResult, int offset, String key) |
Returns a list of all domains. |
DomainInfo |
getDomainInfo(String domainName, String key) |
Returns information about the specified domain. |
void |
createDomain (String domainName, String description, String startPage, String key) |
Creates a domain with the specified attributes. |
void |
deleteDomain(String domainName, String key) |
Deletes the specified domain. |
PageInfo[] |
getAllPageInfo (String domainName, int maxResult, int offset, String key) |
Returns a list of all pages within a domain. |
editDomainInfo |
editDomainInfo (String domainName, String description, String startPage, String key) |
Modifies the specified domain with the specified attributes. |
Table 22-6 Page-Related Methods
Return Type | Method | Description |
---|---|---|
PageInfo |
getPageInfo (String domainName, String pageName, String key) |
Returns information about the specified wiki page. |
void |
createPage (String domainName, String pageName, PageEditMode mode, PageType type, String key) |
Creates a wiki page with the specified attributes. This method supports different editing modes. These are |
void |
deletePage (String domainName, String pageName, String key) |
Deletes the specified wiki page. |
String |
getPlainPage (String domainName, String pageName, String key) |
Returns the page content in the wiki markup format. |
String |
getRenderedPage (String domainName, String pageName, String key) |
Returns the content rendered to HTML. |
void |
savePage (String domainName, String pageName, String content, String key) |
The String content parameter takes text in the format that you specified in the |
Footnote 1 If the wiki administrator has specified a list of members in Domains > Manage Members, then "restricted to members of the domain" displays. The domain membership is otherwise open to all wiki users.
Footnote 2 This option only displays if the currently authenticated user is an administrator of the wiki.
Table 22-7 Administrative Methods
Return Type | Method | Description |
---|---|---|
String key |
login (String username, String passcode) |
Logs in a user and obtains the key that is used on all subsequent web service methods. The web service login expires after 30 minutes. |
null |
logout (String key) |
Logs out the current user as defined by the passed key. |
Table 22-8 Blog-Related Methods
Return Type | Method | Description |
---|---|---|
boolean |
enablePersonalBlog (String description, boolean enable, String key) |
Creates a personal blog for the user associated with the passed key (if it does not exist already). If the personal blog already exists, then this method does nothing. |
String[] |
getListofBlogs (BlogType type, String keyword, int maxResults, int offset, String key) |
Returns a list of all blogs on the server (if |
Table 22-9 Blog Entry-Related Methods
Return Type | Method | Description |
---|---|---|
String[] |
getAllBlogEntries (String blogName, String key) |
Returns a list of blog entries within the specified blog. |
null |
createBlogEntry (String blogName, String title, String content, String key) |
Creates a blog entry in the specified blog with the specified title and content. Can only be performed by the blog author, those identified as additional blog authors (see Oracle Fusion Middleware User's Guide for Oracle WebCenter for more information), and the wiki administrator. If the blog is a domain blog, then only the wiki administrator can perform this task. |
null |
editBlogEntry (String blogEntryID, String title, String content, String key) |
Modifies a specified blog entry with the specified title and content. Can only be performed by the blog author, those identified as additional blog authors (see Oracle Fusion Middleware User's Guide for Oracle WebCenter for more information), and the wiki administrator. If the blog is a domain blog, then only the wiki administrator can perform this task. |
null |
deleteBlogEntry (String blogEntryID, String key) |
Deletes the specified blog entry. Can only be performed by the blog author, those identified as additional blog authors (see Oracle Fusion Middleware User's Guide for Oracle WebCenter for more information), and the wiki administrator. If the blog is a domain blog, then only the wiki administrator can perform this task. |
String |
getBlogEntry (String blogEntryID, String key) |
Returns the content for the specified blog entry. |
Table 22-10 Blog Comment-Related Methods
Return Type | Method | Description |
---|---|---|
String[] |
getAllBlogEntryComments (String blogEntryID, String key) |
Returns all comments on a blog entry. |
void |
createBlogEntryComment (String blogEntryID, String text, String key) |
Creates a comment on the blog entry. |
Table 22-11 Search-Related Methods
Return Type | Method | Description |
---|---|---|
SearchResult |
SearchResult[] search (String searchText, SearchType type, int maxResults, String key) |
Returns URLs to wikis and blog objects that contain the specified keywords (in |
The APIs: getAllDomainInfo()
, getAllPageInfo()
, search()
, and getListOfBlogs()
support pagination. These APIs support the notion of "block fetch," where the clients can specify the maximum number and block of results that should be returned.
ThegetAllDomainInfo()
, getAllPageInfo()
, and getListOfBlogs()
APIs support two parameters, maxResults
and offset
from which the desired (maximum) number of results are returned. However, the calling client must maintain the state of offset
or the cursor. Clients should choose and provide a fixed value for maxResults
in repeated calls to the API to get the correct result.
For example, setting maxResults = 10
, and offset
set to 1
, the first call returns the first 10 rows (if present). Subsequent calls increment the offset parameter (being maintained at the client side) with maxResults fixed at 10
. The subsequent calls return rows from 11-20
, 21-30
and so on until it returns all rows.
A value of <= 0
for maxResults
returns the full result set in one call, without pagination. Also, offset <= 0
returns the full result set in one call (without pagination), starting from the first row.
The search()
method supports the maxResults
parameter, which you can use to restrict the number of rows returned.
All Oracle WebCenter Wiki and Blog Server Web Services methods are protected to prevent unauthorized access. Every method contains a String key parameter to ensure authorized access. This key is generated as a function of a user's name and a preconfigured passcode. The passcode is an arbitrary string that the administrator sets up in the Oracle WebCenter Wiki and Blog Server application after installation. As the Wiki and Blog Server developer, you need to obtain this passcode to use the Web Services interface to access the wiki. For information about the passcode, see Section 12.7 "Setting Up the Wiki Service" in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter
To create the key, use the following method:
String key = client.login(username, passcode);
Note:
In this method, theusername
refers to the name of the user on whose behalf the Web Services is making the call (for example, the user logged into your custom WebCenter application who is accessing the wiki by means of a portlet) and passcode
refers to the parameter key that you configured, as described in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.The following code is an example of a Java program that accesses the Web Services interface. This program lists all the page names in the Training domain.
package oracle.webcenter.wiki.ws.test; import oracle.webcenter.wiki.ws.*; import oracle.webcenter.wiki.security.*; public class ListPages {
In this example, because we have deployed the wiki to a server, using port 6688
, we code the Web Services end point to this URL. You can, however, parameterize the end point.
private static final String endpoint =
"http://localhost:6688/owc_wiki/services/WikiRemoteService";
Each Web Services method must authenticate the caller to the Web Services. Authentication consists of a user name and a preconfigured passcode. In this example, we code these values.
private static final String username = "jsmith"; private static final String passcode = "passcode";
We code the domain name in this example.
private static final String domain = "Training"; public static void main(String[] args) throws Exception { try {
Next, we create a client-side proxy to access the Web Services.
WikiRemoteServiceClient client = new WikiRemoteServiceClient();
We then set the end point of the proxy to the actual location where we deployed the Web Services.
client.setEndpoint(endpoint);
Each Web Services method must pass a security key to authenticate the user and call the method. We can generate this key by calling the login web service using the user's name and the Web Services-configured passcode.
String key = client.login(username, passcode);
Using the Web Services proxy, we fetch into an array the information about all the pages in the selected domain: If there is no such domain, then the program throws an exception. If the domain does not contain any pages, then the program returns an empty array.
PageInfo[] pages = client.getAllPageInfo(domain, key); System.out.println("Pages in " + domain + " domain:");
Throughout the pages array, print the name of each page using the getter method getName()
.
for (int i = 0; i < pages.length; i++) { System.out.println(" " + pages[i].getName()); } } }
If there is an exception, then the program captures the error and prints it.
catch (Exception e) { System.out.println("Exception: " + e); } } }
For more examples of portlets capable of consuming a URL, see the Oracle WebCenter Suite page on the Oracle Technology Network (http://webcenter.oracle.com
).