1
votes

in order to open a document with an XPages, we have to call an url with following format : http://server/database/name_of_xpage.xsp&documentID=xxxx

In one of my databases, the documents to open contain a "title" field. I'd like to open the document by using an url like this : http://server/database/title_value

How to force the domino server to answer to such an url and to open the related XPage (like it's working on stackoverflow web site)

3
Many thanks for your quick answer. after having read the given link and the answers, but I do not know how to do it without external settings (apache). Does it mean with the navigationRules and pageBaseURL I can achieve my objective ? I do not understand how these properties worksTechn0fil
I believe that this answer should help you: stackoverflow.com/a/20376535/785061Per Henrik Lausten

3 Answers

0
votes

There are few options:

  • administrative solution - you can configure Domino to translate URLs at server level
  • XAgent, Form opening script, LotusScript agent - to redirect to correct URL
  • Form property to redirect to XPage, described below.

All you need is to make a view with short name or alias, "key" for example. First sorted column should contain your key value. Form property of every document should define XPage to open on web. Then url like this http://server/database/key/title_value will work. With one small caveat.

0
votes
0
votes

You could create an XAgent (I called mine "open"), and take in smaller parameters to open the document. For example, let's say your main XPage "form" is called "xpDoc". Here is your XAgent (code in afterRenderResponse):

var val = context.getUrlParameter('title');
var nd:NotesDocument = database.getView('viewname').getDocumentByKey(val);
context.redirectToPage('xpDoc.xsp?documentId=' + nd.getUniversalID() + '?OpenDocument');

So, using this simple XAgent, you can use URLs to open documents, like so:

http://server/database/open.xsp?title=title_value

I just tried it out in a development db I have, and it seems to work pretty well. You can always make the XAgent name and "title" parameter smaller, to make the link smaller.

Take note that with this option, you won't need to update the NAB with any website rules. Since you want to link to documents, I'm assuming that you have more than a handful of documents in your application. Adding website rules in the NAB, I don't think, would be a good option as this would add a lot of extra maintenance. With the above method, everything can be done within your application.