ShowTable of Contents
Here is a list of useful URLs for XPages and Domino web development.
XPages URLs
$$OpenDominoDocument.xsp?id=<UNID>
Opens the document with the given UNID. Tries to find a suitable XPage for opening by using these rules:
- Check if the document's form has the "open in XPage property"
- Check if there is a XPage with the same name as the document#s form
xpage.xsp?documentId=<UNID>&action=openDocument
Opens the given XPage with the document given by <UNID> in read mode.
xpage.xsp?documentId=<UNID>&action=editDocument
Opens the given XPage with the document given by <UNID> in edit mode.
Domino URLs
Most important Domino URLs:
http://domino.acme.com/database.nsf?OpenDatabase
http://domino.acme.com/_replicaID?OpenDatabase
http://domino.acme.com/database.nsf?OpenAbout
http://domino.acme.com/database.nsf?OpenHelp
http://domino.acme.com/database.nsf?OpenIcon
http://domino.acme.com/database.nsf/view?OpenView
http://domino.acme.com/database.nsf/view?OpenView&start=10&count=100
http://domino.acme.com/database.nsf/view?OpenView&ExpandView
http://domino.acme.com/database.nsf/view?OpenView&CollapseView
http://domino.acme.com/database.nsf/view?OpenView&Expand=<rownumber>
http://domino.acme.com/database.nsf/view?OpenView&Collapse=<rownumber>
http://domino.acme.com/database.nsf/view?OpenView&RestrictToCategory=<category>
http://domino.acme.com/database.nsf/view?OpenView&StartKey=<element to start with>
http://domino.acme.com/database.nsf/view?ReadViewEntries
(read view as XML)
http://domino.acme.com/database.nsf/view?ReadViewEntries&outputformat=JSON
(read view as JSON)
http://domino.acme.com/database.nsf/view?ReadViewEntries&PreFormat
(converts all data types to text)
http://domino.acme.com/database.nsf/agent?OpenAgent
http://domino.acme.com/database.nsf/<UNID>?OpenDocument
http://domino.acme.com/database.nsf/<UNID>?EditDocument
http://domino.acme.com/database.nsf/<UNID>?DeleteDocument
http://domino.acme.com/database.nsf/<UNID>?SaveDocument
http://domino.acme.com/database.nsf/<UNID>/$FILE/attachment.jpg?Open
http://domino.acme.com/database.nsf/<file resource name>?OpenFileResource
More URLs at the Domino Wiki: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/07302008084503AMKMKGXS.htm
Accessing the history of URLs
You find a history of opened URLs in your XPages app in context.getHistoryUrl(level).
Redirecting to an URL
facesContext.getExternalContext().redirect("http://www.somehost.com")
Note: the URL needs to be complete with http:// and hostname.
Get path or URL of current request
Current path:
facesContext.getExternalContext().getRequest().getContextPath()
Full path inclusive page name:
facesContext.getExternalContext().getRequest().getRequestURI()
Full URL:
facesContext.getExternalContext().getRequest().getRequestURL()
Decode an URL
resultstring=java.net.URLDecoder.decode(urlstring,"UTF-8");
Get an URL parameter
Normally you can use
context.getUrlParameter("parameter")
But this does not work with your parameter is named "id" or you use some other reserved word.
In that case you can use:
q = facesContext.getExternalContext().getRequest().getQueryString();
k = "id";
if (q.indexOf(k+"=")>-1) {
v = q.substring(q.indexOf(k+"=")+k.length()+1, q.length());
v = (v.indexOf("&")>-1?v.substring(0,v.indexOf("&")):v);
}
Referencing the domino html directory
In some places you can only use relative URLs, for example when defining the URL to an image resource. Nevertheless you can access the /data/domino/html directory using the following string:
/.ibmxspres/domino/
Note the missing "html" part.
For example, to refence an image saved in /data/domino/html/myimages/test.jpg you can write:
/.ibmxspres/domino/myimages/test.jpg
Or to access a standard icon:
/.ibmxspres/domino/icons/ecblank.gif
(Found by Paul Withers
)
Referencing Dojo Root Directory
If you want to import for example a special CSS file from the Domino's dojo files, you can use a path like this:
/.ibmxspres/dojoroot/dojox/grid/resources/Grid.css
For example, in a style sheet import tag:
<xp:styleSheet href="/.ibmxspres/dojoroot/dojox/grid/resources/Grid.css"></xp:styleSheet>
Relative URLs to another NSF
To use a relative URL, prefix it with /.ibmxspres/domino/ like in this example:
/.ibmxspres/domino/somedb.nsf/someotherxpage.xsp
Yes, it's the same prefix as used to access the dominodata/domino/html directory.
Special attachment URLs
See Blog entry at Stephan Wissel's Site
Notes URLs
You can address Lotus Notes resources with these kind of URLs:
Notes://cn-name-of-domino-server/replica-id-or-path/designElement-or-documentUNID
Examples:
Notes://domino/mail/jbuss.nsf/($Inbox)?OpenView
Notes://domino/mail/jbuss.nsf/Memo?OpenForm
Notes://domino/mail/jbuss.nsf/C5B41C859FE92C4AC12575940058765F?OpenDocument
There are useful hardcoded replica IDs:
Notes:///0000000000000E00
(the user's current mail database)
Notes:///0000000000000E01
(the user's personal address book)
Notes:///0000000000000E02
(the user's subscription database)
Notes:///0000000000000E03
(the user's bookmark.nsf)
Getting the referer
function getReferer() {
return facesContext.getExternalContext().getRequest().getHeader("Referer");
}