Example Web scripts

AWPr comes bundled with a couple of example Web scripts that can be used to see the portlet in action. The following sections describe how to install and use those Web scripts.

Note: If you installed the Liferay version of AWPr using the plugin installer or directly downloaded the WAR file you will have to get the AMP for the example webscripts from the downloads page.

AWPr My Spaces Web script

The first of the two Web scripts is a modified version of the familiar Alfresco My Spaces Web script that many of you might have already seen. The modifications were necessary to make this Web script work as a remotely accessed script. This was especially challenging since My Spaces makes use of a javascript call that is made from the end-user's browser to get another Web script called My Spaces Panel (this Web script is what shows the contents of a folder and is where most of the user interaction occurs), and if the domain in which the portal is hosted is different from where Alfresco is hosted you run into cross-domain security issues. The work around for this issue is to host both Portal and Alfresco within the same domain and front them with a proxy. For example you can have the following:

Apache/mod_jk => Portal => Alfresco, where

  • Apache web server runs on portal.rivetlogic.com:80
  • Portal runs on 192.168.1.100:8080[ajp:8009]
  • Alfresco runs on 192.168.1.200:8080[ajp:8009]

The mod_jk configuration would then reflect the following:

portal.rivetlogic.com/portal/* => 192.168.1.100:8009
portal.rivetlogic.com/alfresco/* => 192.168.1.200:8009

Another challenge was that the javascript used by this Web script (myspaces.js) calls a method that is expected to return the context path of the Alfresco instance but will instead return the portal's context path. So we modified the Web script to take an extra argument called alfUrl. The value of this argument must match the full path to the Alfresco instance. So for the example above:

You must provide a value for this argument if you want to use the AWPr My Spaces Web script. The portlet preferences' values of an AWPr instance running the AWPr My Spaces Web script should look like this:

alfrescoHost = http://portal.rivetlogic.com
alfrescoContextPath = /alfresco
webscriptUrl = /ui/awprmyspaces
httpMethod = GET
webscriptParams = {f}[0],{p}[/Company Home/Folder]
constantScriptParams = {alfUrl}[http://portal.rivetlogic.com/alfresco]
proxyUrls = {/ui/awprmyspaces}
jsVariable = uiawprmyspaces
charEncodingType = UTF-8

Note: For AWPr 1.3.0 and above you don't "have to" include {f}[],{p}[]. For AWPr versions prior to 1.3.0 you must be sure to include the f and p parameters as shown even if their values are blank. To read about why this is required go to the "Things you ought to know" section of the AWPr Design page.

What's New Web script

This Web script is a lot simpler. All it does is pull the most recently modified or created documents that the logged in user can see. The AWPr portlet preferences to use this Web script would be as follows:

alfrescoHost =http://portal.rivetlogic.com
alfrescoContextPath = /alfresco
webscriptUrl = /whatsnew
httpMethod = GET

constantScriptParams={days}[number]

proxyUrls = {/whatsnew}
jsVariable = whatsnew
charEncodingType = UTF-8

Note: Variable {days} is to obtain the documents for the last past days, its default value is 14.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.