With the inclusion of the Extension Library as core in Notes and Domino 9, there are eleven new @Functions provided for SSJS. They can be found in the Designer Help in IBM Domino Designer User Guide > Designing XPages Applications > Adding Controls from the XPages Extension Library > @Function (Extension Library). Note, you will not find these @Functions listed alongside the other XPages @Functions, so if you use search scopes in the Eclipse-based help, you’ll need to add this section.
And you’ll want to, because they are very useful if you use a lot of SSJS. Some of them fall into distinct groups.
The second group of @Functions are for URL handling – @AbsoluteUrl, @EncodeUrl, @FullUrl and @IsAbsoluteUrl. @FullUrl provides the URL for the resource relative to the server, @AbsoluteUrl includes the server host name and protocol. For those getting started with XPages, @AbsoluteUrl, @EncodeUrl and @FullUrl call static methods in the NotesFunctionsEx method that can be called from Java – absoluteUrl(String), encodeUrl(String) and fullUrl(String). So you can call them from Java as well. The last one already exists in Java – com.ibm.xsp.util.FacesUtil.isAbsoluteUrl(String).
The remaining new @Functions are @NormalizeSubject, @TopParentID, @TopParentUNID and @ViewIconUrl. @NormalizeSubject is useful to return “Untitled” if the text passed in is blank or restrict it to a number of characters, by default 80. Again, there’s a Java method in the same class, normalizeSubject(String subject, int maxlength). @ViewIconUrl is useful for taking a view icon number and returning the URL for the relevant icon. That doesn’t have a specific static method, but there’s nothing stopping you using the code, if you want to use native Java.
The other point of this is to highlight the amount of code required to provide SSJS @Functions. For those 11 @Functions, the Java class is 599 lines long. We’re looking to provide the same functionality for the new methods in org.openntf.domino, and we currently have about 50 new methods. Needless to say, it takes quite a bit of work to extend them to SSJS. We’ve already added them for the DateTime class, but there are a number of others yet to do. But we want to get there.
So in the meantime enjoy the @Functions provided now out-of-the-box in Notes and Domino 9.