URL references in XPages

Aaaah URL references, I guess everyone with Domino and XPages have struggled with them. At first you think you have tackled them, but then you open your app from another perspective (e.g. web browser launch – open designated xpage) and you discover the references did no work like you thought they would.

So how do they work? I made an xpage to demonstrate their working:

url-references

I made 6 types of references:

/.ibmxspres/domino -> this brings me back to the root of the server (or data directory)

/.ibmxspres/global -> this brings me to the folder domjava/xsp/ on the server. This is where for example server-side themes are installed

/.ibmxspres/dojoroot -> this brings me back to the folder /xsp/.ibmxspres/dojoroot-1.9.7/ on the server. This is the installation folder of dojo.

/ -> this brings me to the root of the nsf (when standing on an xpage ofcourse).

./ -> this brings me also to the root of my nsf.

../ -> a step to much, the filename is cut off, so I am standing in the installation folder of my nsf.

Can you fix the broken ones? Ofcourse:

/.ibmxspres/domino -> compute: return “/.ibmxspres/domino/” + database.getFilePath() + “/” + the resource where you want to point to.

/.ibmxspres/global -> compute: “/.ibmxspres/global/” + “../../” + database.getFilePath() + “/” + the resource where you want to point to.

/.ibmxspres/dojoroot -> compute: “/.ibmxspres/dojoroot/” + “../../../” + database.getFilePath() + “/” + the resource where you want to point to.

../ -> “../” + database.getFileName() + “/” + the resource where you want to point to.

If you have a custom stylesheet called custom.css in your nsf you can refer to it in a Theme design element as followed:

<resource>
<content-type>text/css</content-type>
<href>/.ibmxspres/domino/css/custom.css</href>
</resource>

I made the sample available on Github. Hopefully next time I do not make the same mistakes with URL references. Happy development =)

Add 20 years of experience to your workforce

You can 20 years of experience within IBM Notes and Web development to your workforce by hiring me.

Interested? Read my curriculum vitae on LinkedIn: http://www.linkedin.com/in/patrickkwinten and get in contact.

I am happy to work WITH you !

 

 

Resource optimization for Anonymous users

The ‘Use runtime optimized … resources’ is a great XSP Properties property to downsize the amount of calls to the Domino server for downloading stylesheet and javascript resources.

In order to reduce the size of the download(s) the rendered property in a Theme design element can be handy.

For example resources that are used in Xpages that are not accessible by Anonymous users you can initially restrict via:

Screen Shot 2016-03-08 at 12.15.01

When they later logon and access XPages that use the resource, it will be available.

Just a simple tip. Happy development =)

Presentations from EntwicklerCamp 2014 – Track 2

Track Session Subject Download Presentation
Track2 Session1 IBM Connections http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/e76eba65a7777a5fc1257be200295cc3/$FILE/T2S1-IBM%20Connections.pdf
Track2 Session2 XPages und Connections http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/3ce43336a0c21017c1257be200295cb1/$FILE/T2S2-Xpages%20und%20Connections.pdf
Track2 Session3 iNotes deep dive http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/5aa8d31062adfd72c1257be200295ca9/$FILE/T2S3-iNotesDevPres.pdf
Track2 Session4 Notes Database Security – Analyse, Konzept und Techniken http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/fd4c7bc91a89f2c2c1257be200295c97/$FILE/T2S4%20Notes%20Database%20Security.pdf
Track2 Session5 XPages und Java http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/eaa095462aa6e95cc1257be200295cb9/$FILE/T2S5-XPages_und_Java_2014.pdf
Track2 Session6 Einsatz von Resource-Bundles am Beispiel der Realisierung von Mehrsprachigkeit und flexibler Menüstrukturen der XPage-Applikation. Managed Beans http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/ee334362683c38f4c1257be200295cb8/$FILE/T2S6-ResourceBundles.pdf
Track2 Session7 iNotes http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/ba851a9f69b08b99c1257be200295cbb/$FILE/T2S7-iNotesXPagesDevPres.pdf
Track2 Session8 WebServices und REST http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/4dd3a39f66807004c1257be200295cbd/$FILE/T2S8-XPages_WebServices_und_REST.pdf