Server independent reference in an XPages theme

后端 未结 4 1322
别那么骄傲
别那么骄傲 2020-12-20 12:27

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://w

相关标签:
4条回答
  • From an article 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."

    0 讨论(0)
  • 2020-12-20 13:11

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

    0 讨论(0)
  • 2020-12-20 13:13

    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.

    0 讨论(0)
  • 2020-12-20 13:15

    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>
    

    Happy coding

    /Newbs

    0 讨论(0)
提交回复
热议问题