Referencia independiente del servidor en un tema de XPages

I have the following in the theme but I want to make it server independent so that it can be moved seemlessly from deve to test to prod.

how do I genericize http://www.devserver.com?

<resource>
    <content-type>text/css</content-type>
    <href>http://www.devserver.com/CommonElements.nsf/commonMAX.css</href>
</resource>

I would assume the following - but doesn't work as it makes the reference relative to the current .nsf

<resource>
    <content-type>text/css</content-type>
    <href>/CommonElements.nsf/commonMAX.css</href>
</resource>

preguntado el 09 de marzo de 12 a las 14:03

4 Respuestas

Desde un artículo on the Notes & Domino App Dev wiki:

"When the XPages runtime emits a URL, it assumes that the root "/" is the root of the application (e.g. /mydb.nsf). But as this notion doesn't exist in the browser, this is added by the JSF runtime. To work around this add the syntax "/.ibmxspres/domino" to the beginning of the path to set the root as the Domino data directory."

respondido 09 mar '12, 14:03

Thanks Mark! Was also pointed out to me that it is in Mastering XPages - pg. 597 - marky roden

In Chapter 14 of Mastering XPages there is a discussion of Themes. Beginning on page 597 there is a discussion of "Resource Paths" and the Path Aliases for three key paths:

/.ibmxspres/domino points to: /data/domino/html/

/.ibmxspres/global points to: /data/domino/java/xsp/

/.ibmxspres/dojoroot points to: /data/domino/js/dojo-1.4.3/ (or the current version of dojo)

So your block is:

<resource>
   <content-type>text/css</content-type>
   <href>/.ibmxspres/domino/CommonElements.nsf/commonMAX.css</href>
</resource>

Feliz codificación

/ Newbs

respondido 09 mar '12, 14:03

sadly the database name + path of this href property can not be computed? - Patrick Kwinten

Another option is to investigate the XSP Starter Kit on OpenNTF.org

This will allow you to build an OSGi plugin library for XPages and one of the starter examples that you can extend in the library shows you how to create your own resourceProvider service.

Depending on how you refactor the XSP Starter Kit to your own name space you would be able add your css and other files ( common icons, logos etc ) and then you can access them using your own file path of /.ibmxspres/.yourNameSpace/file.ext. You can even build your own directory structure in the library to make managing the files easier.

One big advantage of this over storing them in a NSF is that they are cached by the end users browser whereas files served via nsf are not always cached.

Also, if the library is set as a global library on the server then you don;t need to add a dependency to the calling application, the resource provider will be available for anything that needs it.

respondido 09 mar '12, 15:03

This works if your application is in root. ./commonMAX.css

respondido 09 mar '12, 14:03

sorry, this is the way I refrerences my css and it works <href>intra_20120229.css</href> - Tomás Adrián

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.