Spring Surf Reference Documentation

Yong Qu

Michael Uzquiano

1.0.0-SNAPSHOT

Copyright (C) 2005-2009 Alfresco Software Limited.

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.


I. Welcome to Spring Surf Project
II. Appendices
A. RESTful API Reference
A.1. Package Webscript Global
A.1.1. Resource Webscript Message
A.1.1.1. Web Script Global messages bundle
A.2. Package Spring Surf Core
A.2.1. Resource Web Framework
A.2.1.1. Web Script Web Framework Console
A.2.1.2. Web Script Web Framework Maintenance
A.2.2. Resource Surf Object
A.2.2.1. Web Script Surf API - Delete an object
A.2.2.2. Web Script Surf API - Get an object
A.2.2.3. Web Script Surf API - Create an object
A.2.2.4. Web Script Surf API - Update an object
A.2.2.5. Web Script Surf API - Retrieve list of objects
A.3. Package Spring Surf Client
A.3.1. Resource Client
A.3.1.1. Web Script Surf - Client JS API
A.4. Package Spring Surf Format
A.4.1. Resource Format
A.4.1.1. Web Script Surf API - list of configured formats
A.5. Package Spring Surf Model Content
A.5.1. Resource Content Association
A.5.1.1. Web Script Surf API - removes a content association
A.5.1.2. Web Script Surf API - Adds a content association
A.5.2. Resource Others
A.5.2.1. Web Script Surf API - Retrieves Content Associations
A.6. Package Spring Surf Model Page
A.6.1. Resource Page Template
A.6.1.1. Web Script Surf API - Removes a page's template association
A.6.1.2. Web Script Surf API - Adds a page to template association
A.6.1.3. Web Script Surf API - Retrieves Page Templates
A.7. Package Spring Surf Model Site
A.7.1. Resource Site Configuration
A.7.1.1. Web Script Surf API - Retrieves Site Configuration
A.7.1.2. Web Script Surf API - Updates Site Configuration
A.8. Package Webscript Core
A.8.1. Resource Index
A.8.1.1. Web Script Web Scripts Home
A.8.1.2. Web Script Web Script Maintenance
A.8.1.3. Web Script All Web Scripts Index
A.8.1.4. Web Script Failed Web Scripts Index
A.8.1.5. Web Script Web Script Family Index
A.8.1.6. Web Script Web Script Lifecycle Index
A.8.1.7. Web Script Web Script Package Index
A.8.1.8. Web Script Web Script URI Index
A.8.2. Resource Javascript Debugger
A.8.2.1. Web Script Javascript Debugger
A.8.2.2. Web Script Javascript Debugger Maintenance
A.8.3. Resource Tools
A.8.3.1. Web Script Web Script Description
A.8.3.2. Web Script Display Web Script
A.8.3.3. Web Script Web Script Installer Form
A.8.3.4. Web Script Install Web Script
A.8.4. Resource Others
A.8.4.1. Web Script Web Script Package Documentation
B. JavaScript Root Object Reference
B.1. atom
B.2. jsonUtils
B.3. logger
B.4. remote
B.5. server
B.6. stringUtils
C. JavaScript API Reference
C.1. org.springframework.extensions.webscripts.ScriptLogger
C.2. org.springframework.extensions.webscripts.ScriptRemote
C.3. org.springframework.extensions.webscripts.ScriptRemoteConnector
C.4. org.springframework.extensions.webscripts.ScriptRenderContext
C.5. org.springframework.extensions.webscripts.ScriptSurf
C.6. org.springframework.extensions.webscripts.ScriptableUtils
C.7. org.springframework.extensions.webscripts.atom.AtomService
C.8. org.springframework.extensions.webscripts.json.JSONUtils
D. Template Root Object Reference
D.1. argreplace
D.2. atom
D.3. date
D.4. dateCompare
D.5. encodeuri
D.6. jsonUtils
D.7. server
D.8. stringUtils
D.9. xmldate
E. Template API Reference
E.1. org.springframework.extensions.webscripts.AbsoluteUrlMethod
E.2. org.springframework.extensions.webscripts.ArgReplaceMethod
E.3. org.springframework.extensions.webscripts.ClientUrlFunctionMethod
E.4. org.springframework.extensions.webscripts.DateCompareMethod
E.5. org.springframework.extensions.webscripts.FormatWriterMethod
E.6. org.springframework.extensions.webscripts.FreemarkerI18NMessageMethod
E.7. org.springframework.extensions.webscripts.ISO8601DateFormatMethod
E.8. org.springframework.extensions.webscripts.MessageMethod
E.9. org.springframework.extensions.webscripts.ScriptRenderContext
E.10. org.springframework.extensions.webscripts.ScriptSurf
E.11. org.springframework.extensions.webscripts.ScriptUrlMethod
E.12. org.springframework.extensions.webscripts.ScriptableUtils
E.13. org.springframework.extensions.webscripts.UrlEncodeMethod
E.14. org.springframework.extensions.webscripts.atom.AtomService
E.15. org.springframework.extensions.webscripts.json.JSONUtils

Part I. Welcome to Spring Surf Project

Welcome to Surf Project

Part II. Appendices

The final part of the reference guide provides appendices and background information that does not neatly belong within the other parts. The information is intended to be treated as a reference and not read consecutively.

Appendix A. RESTful API Reference

This document displays list of available Web Scripts of this project. Web Scripts are grouped in the heirachy of Package, Resource and Web Script.

Within each package, web Scripts that don't belong to any resource will be placed under the default 'Others' resource.

This project has total 33 web scripts.

A.1. Package Webscript Global

Package /org/springframework/extensions

Global Webscripts.

A.1.1. Resource Webscript Message

Webscripts for managing Spring webscript messages.

A.1.1.1. Web Script Global messages bundle

Web Scripts global messages bundle as a JavaScript response

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/messages.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : none

  • Buffer Size : 4096

  • Transaction Required : none

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/messages.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /messages?locale={locale}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.2. Package Spring Surf Core

Package /org/springframework/extensions/surf

Spring Surf Core Webscripts.

A.2.1. Resource Web Framework

Webscripts for Spring Surf Web Framework console and maintenance.

A.2.1.1. Web Script Web Framework Console

Web Framework Console

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/console.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : none

  • Buffer Size : 4096

  • Transaction Required : none

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/console.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /console

  • Life Cycle : internal

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.2.1.2. Web Script Web Framework Maintenance

Web Framework Maintenance

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/console.post

  • Kind : undefined

  • Method : POST

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : none

  • Buffer Size : 4096

  • Transaction Required : none

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/console.post.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /console?reset={reset?}

  • Life Cycle : internal

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.2.2. Resource Surf Object

Webscripts for Spring Surf Object CRUD operations.

A.2.2.1. Web Script Surf API - Delete an object

Surf API - Delete an object

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/object.delete

  • Kind : undefined

  • Method : DELETE

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/object.delete.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/object/{type}/{id}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.2.2.2. Web Script Surf API - Get an object

Surf API - Get an object

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/object.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/object.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/object/{type}/{id}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.2.2.3. Web Script Surf API - Create an object

Surf API - Create an object

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/object.post

  • Kind : undefined

  • Method : POST

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/object.post.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/object/{type}?id={id?}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.2.2.4. Web Script Surf API - Update an object

Surf API - Update an object

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/object.put

  • Kind : undefined

  • Method : PUT

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/object.put.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/object/{type}/{id}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.2.2.5. Web Script Surf API - Retrieve list of objects

Surf API - Retrieve list of objects

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/objects.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/objects.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/objects/{type}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.3. Package Spring Surf Client

Package /org/springframework/extensions/surf/client

Spring Surf Client Webscripts.

A.3.1. Resource Client

Spring Surf Client Webscripts.

A.3.1.1. Web Script Surf - Client JS API

Surf - Client JS API

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/client/client.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/client

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/client/client.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : html

  • URLs

    • /surf/js

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.4. Package Spring Surf Format

Package /org/springframework/extensions/surf/format

Spring Surf Format Webscripts.

A.4.1. Resource Format

Spring Surf Format Webscripts.

A.4.1.1. Web Script Surf API - list of configured formats

Surf API - list of configured formats

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/format/formats.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/format

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/format/formats.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : html

  • URLs

    • /api/surf/formats

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.5. Package Spring Surf Model Content

Package /org/springframework/extensions/surf/model/content

Spring Surf Model Content related Webscripts.

A.5.1. Resource Content Association

Webscripts for managing Spring Surf content association.

A.5.1.1. Web Script Surf API - removes a content association

Surf API - removes a content association

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/model/content/association.delete

  • Kind : undefined

  • Method : DELETE

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/model/content

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/model/content/association.delete.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/content/type/{type}/association?dest={dest}&assocType={assocType?}&f={format?}
    • /api/surf/content/instance/{id}/association?dest={dest}&assocType={assocType?}&f={format?}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.5.1.2. Web Script Surf API - Adds a content association

Surf API - Adds a content association

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/model/content/association.post

  • Kind : undefined

  • Method : POST

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/model/content

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/model/content/association.post.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/content/type/{type}/association?dest={dest}&assocType={assocType?}&f={format?}
    • /api/surf/content/instance/{id}/association?dest={dest}&assocType={assocType?}&f={format?}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.5.2. Resource Others

This is the resource for all Web Scripts which don't belong to any resouce.

A.5.2.1. Web Script Surf API - Retrieves Content Associations

Surf API - Retrieves Content Associations

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/model/content/associations.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/model/content

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/model/content/associations.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/content/associations?dest={dest?}&assocType={assocType?}&f={format?}
    • /api/surf/content/type/associations?dest={dest?}&assocType={assocType?}&f={format?}
    • /api/surf/content/type/{type}/associations?dest={dest?}&assocType={assocType?}&f={format?}
    • /api/surf/content/instance/associations?dest={dest?}&assocType={assocType?}&f={format?}
    • /api/surf/content/instance/{id}/associations?dest={dest?}&assocType={assocType?}&f={format?}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.6. Package Spring Surf Model Page

Package /org/springframework/extensions/surf/model/page

Spring Surf Model Page related Webscripts.

A.6.1. Resource Page Template

Webscripts for managing Spring Surf page templates.

A.6.1.1. Web Script Surf API - Removes a page's template association

Surf API - Removes a page's template association

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/model/page/template.delete

  • Kind : undefined

  • Method : DELETE

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/model/page

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/model/page/template.delete.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/page/{id}/template?format={formatId?}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.6.1.2. Web Script Surf API - Adds a page to template association

Surf API - Adds a page to template association

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/model/page/template.post

  • Kind : undefined

  • Method : POST

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/model/page

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/model/page/template.post.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/page/{id}/template/{templateId}?f={formatId?}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.6.1.3. Web Script Surf API - Retrieves Page Templates

Surf API - Retrieves Page Templates

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/model/page/templates.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/model/page

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/model/page/templates.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : html

  • URLs

    • /api/surf/page/{id}/templates

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.7. Package Spring Surf Model Site

Package /org/springframework/extensions/surf/model/site

Spring Surf Model Site related Webscripts.

A.7.1. Resource Site Configuration

Webscripts for managing Spring Surf site configuration.

A.7.1.1. Web Script Surf API - Retrieves Site Configuration

Surf API - Retrieves Site Configuration

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/model/site/configuration.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/model/site

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/model/site/configuration.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/site/config

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.7.1.2. Web Script Surf API - Updates Site Configuration

Surf API - Updates Site Configuration

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/surf/model/site/configuration.put

  • Kind : undefined

  • Method : PUT

  • Run As : undefined

  • Script Path : org/springframework/extensions/surf/model/site

  • Store Path : classpath:surf/webscripts

  • Authentication : none

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/surf/model/site/configuration.put.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : json

  • URLs

    • /api/surf/site/config

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8. Package Webscript Core

Package /org/springframework/extensions/webscripts

Core webscripts for index page, js debugger, installation etc.

A.8.1. Resource Index

Index related webscripts.

A.8.1.1. Web Script Web Scripts Home

Web Scripts Home

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/index.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/index.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /index

  • Life Cycle : internal

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.1.2. Web Script Web Script Maintenance

Maintain index of Web Scripts

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/index.post

  • Kind : undefined

  • Method : POST

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/index.post.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /index?reset={reset?}
    • /?reset={reset?}

  • Life Cycle : internal

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.1.3. Web Script All Web Scripts Index

Retrieve an index of all Web Scripts

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/indexall.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/indexall.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /index/all?package={package?}&url={url?}&family={family?}
    • /index/all.mediawiki?package={package?}&url={url?}&family={family?}

  • Life Cycle : internal

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.1.4. Web Script Failed Web Scripts Index

Retrieve an index of all failed Web Scripts

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/indexfailures.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/indexfailures.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /index/failures

  • Life Cycle : internal

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.1.5. Web Script Web Script Family Index

Provide an index of Web Scripts for the specified family

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/indexfamily.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/indexfamily.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /index/family/{family}

  • Life Cycle : internal

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.1.6. Web Script Web Script Lifecycle Index

Provide an index of Web Scripts in the various lifecycle states
  
none   : This web script is not part of a lifecycle.
sample : This web script is a sample and is not intended for production use.
draft  : This method may be incomplete, experimental or still subject to change.
public_api : This method is part of the Alfresco public api and should be stable and well tested.
draft_public_api : This method is intended to eventually become part of the public api but is 
                   incomplete or still subject to change.
deprecated : This method should be avoided.  It may be removed in future versions of Alfresco.
internal   : This script is for Alfresco use only. This script should not be relied upon between 
             versions.It is likely to change.

  

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/indexlifecycle.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/indexlifecycle.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /index/lifecycle/{lifecycle}

  • Life Cycle : internal

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.1.7. Web Script Web Script Package Index

Provide an index of Web Scripts for the specified Web Script package

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/indexpackage.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/indexpackage.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /index/package/{package}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.1.8. Web Script Web Script URI Index

Provide an index of Web Scripts for the specified Web Script URI

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/indexuri.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/indexuri.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : html

  • URLs

    • /index/uri/{uri}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.2. Resource Javascript Debugger

Webscripts for managing Javascript Debugger.

A.8.2.1. Web Script Javascript Debugger

Javascript Debugger

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/jsdebugger.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/jsdebugger.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /api/javascript/debugger

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.2.2. Web Script Javascript Debugger Maintenance

Javascript Debugger Maintenance

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/jsdebugger.post

  • Kind : undefined

  • Method : POST

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/jsdebugger.post.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /api/javascript/debugger?active={active?}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.3. Resource Tools

Tools for Webscript inspection, display, installation etc.

A.8.3.1. Web Script Web Script Description

Retrieve description document for identified Web Script

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/scriptdescription.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/scriptdescription.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : html

  • URLs

    • /description/{serviceId}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.3.2. Web Script Display Web Script

Full inspection of Web Script implementation - useful for diagnostics and download/upload

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/scriptdump.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/scriptdump.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : argument

  • Default Format : html

  • URLs

    • /script/{serviceId}

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.3.3. Web Script Web Script Installer Form

Web Script Installer Form

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/scriptinstall.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/scriptinstall.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /installer

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.3.4. Web Script Install Web Script

Install Web Script

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/scriptinstall.post

  • Kind : undefined

  • Method : POST

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/scriptinstall.post.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /installer

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

A.8.4. Resource Others

This is the resource for all Web Scripts which don't belong to any resouce.

A.8.4.1. Web Script Web Script Package Documentation

Provides reference documentation for the specified Web Script package

The Web script description document specifies the following options:

  • Id : org/springframework/extensions/webscripts/indexpackagedoc.get

  • Kind : undefined

  • Method : GET

  • Run As : undefined

  • Script Path : org/springframework/extensions/webscripts

  • Store Path : classpath:webscripts

  • Authentication : admin

  • Cache Public : false

  • Cache Must Validate : true

  • Never Cache : true

  • Transaction : required

  • Buffer Size : 4096

  • Transaction Required : required

  • Transaction Capability : readwrite

  • Web Script Descriptor : org/springframework/extensions/webscripts/indexpackagedoc.get.desc.xml

  • Extensions : undefined

  • Familys : none

  • Format Style : any

  • Default Format : html

  • URLs

    • /index/package/{package}/doc

  • Life Cycle : none

  • Multipart Processing : true

  • Negotiated Formats : undefined

Appendix B. JavaScript Root Object Reference

This document displays list of available JavaScript root objects that can be used in JavaScript templates. Root objects are listed in alphabetic order according to their names.

Each JavaScript root object in the following list is backed by a server-side java class respectively. Public methods of the java class are exposed as APIs for corresponding JavaScript root object.

For example

var myObj = {'name':'Test Object','size':100};
var myObjAsString = jsonUtils.toJSONString(myObj);

This project has total 6 JavaScript root objects.

B.1. atom

  • Java Class : org.springframework.extensions.webscripts.atom.AtomService

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of Atom related methods.

  • Sample Code :

    //JavaScript Sample Code
     var object = entry.getExtension(atom.names.cmis_object);
    //Freemarker Sample Code
    <#assign cmis_object=entry.getExtension(atom.names.cmis_object)>

  • Methods

    • Method : createEntry

      • Help :

        Constructs an empty entry

      • Return : Empty entry

    • Method : createQName

      • Help :

        Creates a QName

      • Return : QName

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Uri string

        • Parameter : var1

          • Java Class : java.lang.String

          • Help :

            Local name

    • Method : getNames

      • Help :

        Gets pre-configured Atom Extensions (QNames)

      • Return : map of QNames by alias

    • Method : createFeed

      • Help :

        Constructs an empty feed

      • Return : Empty feed

    • Method : toMimeType

      • Help :

        Establishs mimetype of atom content

      • Return : mimetype (or null, if it could not be established)

      • Parameters

        • Parameter : var0

          • Java Class : org.apache.abdera.model.Entry

          • Help :

            Entry

    • Method : toAtom

      • Help :

        Parses an Atom element

      • Return : Element

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom element

    • Method : toAtom

      • Help :

        Parses an Atom element

      • Return : Element

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom element string

    • Method : toService

      • Help :

        Parses an Atom service

      • Return : Atom servce

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom entry

    • Method : toService

      • Help :

        Parses an Atom service

      • Return : Atom service

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom entry string

    • Method : toEntry

      • Help :

        Parses an Atom Entry

      • Return : Entry

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom entry

    • Method : toEntry

      • Help :

        Parses an Atom entry

      • Return : Entry

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom entry string

    • Method : toFeed

      • Help :

        Parses an Atom feed

      • Return : Feed

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom feed

    • Method : toFeed

      • Help :

        Parses an Atom feed

      • Return : Feed

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom feed string

B.2. jsonUtils

  • Java Class : org.springframework.extensions.webscripts.json.JSONUtils

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of JSON Utility methods.

  • Sample Code :

    //JavaScript Sample Code
    var myObj = {'name':'Test Object','size':100};
    var myObjAsString = jsonUtils.toJSONString(myObj);
    
    //Freemarker Template Sample Code
    [
        <#list tags as tag>
            ${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
        </#list>
    ]

  • Methods

    • Method : toObject

      • Help :

        Takes a JSON string and converts it to a native java script object

      • Sample Code :

        //JavaScript Sample Code
        model.postCode = jsonUtils.toObject(json).postCode;

      • Return : the created native JS object that represents the JSON object

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            A valid json string

    • Method : toObject

      • Help :

        Takes a JSON object and converts it to a native java script object

      • Sample Code :

        //JavaScript Sample Code
        model.postCode = jsonUtils.toObject(json).postCode;

      • Return : the created native object

      • Parameters

        • Parameter : var0

          • Java Class : org.json.JSONObject

          • Help :

            The json object

    • Method : toJSONString

      • Help :

        Converts a given JavaScript native object and converts it to the relevant JSON string.

      • Sample Code :

        //JavaScript Sample Code
        var myObj = {'name':'Test Object','size':100};
        var myObjAsString = jsonUtils.toJSONString(myObj);

      • Return : JSON string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.Object

          • Help :

            JavaScript object

    • Method : encodeJSONString

      • Help :

        Encodes a JSON string value

      • Return : Encoded value

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.Object

          • Help :

            Value to encode

B.3. logger

  • Java Class : org.springframework.extensions.webscripts.ScriptLogger

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Provides functions to aid debugging of scripts.

  • Sample Code :

    logger.log("Command Processor: isEmailed=" + isEmailed);

  • Methods

    • Method : log

      • Help :

        Logs a message

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Message to log

    • Method : warn

      • Help :

        Logs a warning message

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Message to log

    • Method : isLoggingEnabled

      • Help :

        Returns true if logging is enabled.

      • Sample Code :

        var loggerStatus = logger.isLogginEnabled();

      • Return : true if logging is enabled

    • Method : isWarnLoggingEnabled

      • Help :

        Returns true if warn logging is enabled.

      • Sample Code :

        var loggerStatus = logger.isWarnLogginEnabled();

      • Return : true if warn logging is enabled

B.4. remote

  • Java Class : org.springframework.extensions.webscripts.ScriptRemote

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Provides useful functions for working with endpoints, connectors and credentials.

  • Sample Code :

    // get a connector to the Alfresco repository endpoint
    var connector = remote.connect("alfresco");
    // retrieve the web script index page 
    var indexHtml = connector.get("/index");

  • Methods

    • Method : connect

      • Help :

        Constructs a remote connector to a default endpoint (if configured).
        If a default endpoint is not configured, null will be returned.

      • Return : The remote client

    • Method : connect

      • Help :

        Constructs a remote connector to a specific endpoint (if configured).
        If a default endpoint is not configured, null will be returned.

      • Return : The remote client

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

    • Method : call

      • Help :

        Invoke a specific URI on the default endpoint

      • Return : The reponse

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

    • Method : getEndpointIds

      • Help :

        Returns a list of the application endpoint ids

      • Return : List of the application endpoint ids

    • Method : getEndpointName

      • Help :

        Returns the name of an endpoint

      • Return : Endpoint name

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint id

    • Method : getEndpointDescription

      • Help :

        Returns the description of an endpoint

      • Return : Endpoint description

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint id

    • Method : isEndpointPersistent

      • Help :

        Checks if an endpoint is persistent or not

      • Return : True if the endpoint is persistent

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint id

    • Method : getEndpointURL

      • Help :

        Returns the configured URL for the given endpoint

      • Return : The endpoint url

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint id

B.5. server

  • Java Class : org.springframework.extensions.webscripts.PresentationContainer$PresentationServerModel

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

B.6. stringUtils

  • Java Class : org.springframework.extensions.webscripts.ScriptableUtils

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of script utility methods for working with strings etc.

  • Sample Code :

    //JavaScript Sample Code
    model.biohtml = stringUtils.replaceLineBreaks(bio);
    
    //Freemarker Template Sample Code
    ${stringUtils.stripUnsafeHTML(item.node.content)?substring(0, contentLength)}

  • Methods

    • Method : urlDecode

      • Help :

        Decodes input URL string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : stripEncodeUnsafeHTML

      • Help :

        Strips encode unsafe HTML tags from the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : stripUnsafeHTML

      • Help :

        Strips unsafe HTML tags from the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : replaceLineBreaks

      • Help :

        Replaces line breaks in the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : encodeHTML

      • Help :

        Encodes input HTML string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : encodeJavaScript

      • Help :

        Encodes input JavaScript string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : urlEncode

      • Help :

        Encodes input string using URLEncoder

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : urlEncodeComponent

      • Help :

        Encode input URL string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : parseXMLNodeModel

      • Help :

        Converts an xml string to a freemarker node model

      • Return : Freemarker node model

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input XML string

Appendix C. JavaScript API Reference

This document displays list of available JavaScript APIs that can be used in JavaScript templates.

All JavaScript APIs are backed by server-side java classes. Public methods of the server-side java class are exposed as APIs for corresponding JavaScript object.

For example

var myObj = {'name':'Test Object','size':100};
var myObjAsString = jsonUtils.toJSONString(myObj);

This project has total 8 JavaScript objects.

C.1. org.springframework.extensions.webscripts.ScriptLogger

  • Java Class : org.springframework.extensions.webscripts.ScriptLogger

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Provides functions to aid debugging of scripts.

  • Sample Code :

    logger.log("Command Processor: isEmailed=" + isEmailed);

  • Methods

    • Method : log

      • Help :

        Logs a message

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Message to log

    • Method : warn

      • Help :

        Logs a warning message

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Message to log

    • Method : isLoggingEnabled

      • Help :

        Returns true if logging is enabled.

      • Sample Code :

        var loggerStatus = logger.isLogginEnabled();

      • Return : true if logging is enabled

    • Method : isWarnLoggingEnabled

      • Help :

        Returns true if warn logging is enabled.

      • Sample Code :

        var loggerStatus = logger.isWarnLogginEnabled();

      • Return : true if warn logging is enabled

C.2. org.springframework.extensions.webscripts.ScriptRemote

  • Java Class : org.springframework.extensions.webscripts.ScriptRemote

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Provides useful functions for working with endpoints, connectors and credentials.

  • Sample Code :

    // get a connector to the Alfresco repository endpoint
    var connector = remote.connect("alfresco");
    // retrieve the web script index page 
    var indexHtml = connector.get("/index");

  • Methods

    • Method : connect

      • Help :

        Constructs a remote connector to a default endpoint (if configured).
        If a default endpoint is not configured, null will be returned.

      • Return : The remote client

    • Method : connect

      • Help :

        Constructs a remote connector to a specific endpoint (if configured).
        If a default endpoint is not configured, null will be returned.

      • Return : The remote client

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

    • Method : call

      • Help :

        Invoke a specific URI on the default endpoint

      • Return : The reponse

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

    • Method : getEndpointIds

      • Help :

        Returns a list of the application endpoint ids

      • Return : List of the application endpoint ids

    • Method : getEndpointName

      • Help :

        Returns the name of an endpoint

      • Return : Endpoint name

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint id

    • Method : getEndpointDescription

      • Help :

        Returns the description of an endpoint

      • Return : Endpoint description

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint id

    • Method : isEndpointPersistent

      • Help :

        Checks if an endpoint is persistent or not

      • Return : True if the endpoint is persistent

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint id

    • Method : getEndpointURL

      • Help :

        Returns the configured URL for the given endpoint

      • Return : The endpoint url

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint id

C.3. org.springframework.extensions.webscripts.ScriptRemoteConnector

  • Java Class : org.springframework.extensions.webscripts.ScriptRemoteConnector

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Describes a connector to a remote endpoint.

  • Sample Code :

    // get a connector to the Alfresco repository endpoint
    var connector = remote.connect("alfresco"); 
    // retrieve the web script index page 
    var indexHtml = connector.get("/index");

  • Methods

    • Method : get

      • Help :

        Invokes a GET request URI on the endpoint.

      • Return : Response object from the call

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

    • Method : put

      • Help :

        Invokes a URI on a remote service, passing the supplied body as a PUT request.

      • Return : Response object from the call

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

        • Parameter : var1

          • Java Class : java.lang.String

          • Help :

            Body of the PUT request.

    • Method : put

      • Help :

        Invokes a URI on a remote service, passing the supplied body as a PUT request.

      • Return : Response object from the call

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

        • Parameter : var1

          • Java Class : java.lang.String

          • Help :

            Body of the PUT request.

        • Parameter : var2

          • Java Class : java.lang.String

          • Help :

            Content mimetype of the request.

    • Method : getDescriptor

      • Help :

        Returns the endpoint descriptor

      • Return : Endpoint descriptor

    • Method : post

      • Help :

        Invokes a URI on a remote service, passing the supplied body as a POST request.

      • Return : Response object from the call

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

        • Parameter : var1

          • Java Class : java.lang.String

          • Help :

            Body of the POST request.

    • Method : post

      • Help :

        Invokes a URI on a remote service, passing the supplied body as a POST request.

      • Return : Response object from the call

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

        • Parameter : var1

          • Java Class : java.lang.String

          • Help :

            Body of the POST request.

        • Parameter : var2

          • Java Class : java.lang.String

          • Help :

            Content mimetype of the request body

    • Method : call

      • Help :

        Invokes a URI on the endpoint via a GET request.

      • Return : Response object from the call

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

    • Method : del

      • Help :

        Invokes a URI on a remote service as DELETE request.
        NOTE: the name of the method is 'del' not 'delete' so as to not
        interfere with JavaScript Object.delete() method.

      • Return : Response object from the call

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Endpoint Url

    • Method : getEndpoint

      • Help :

        Returns the endpoint string

      • Return : Endpoint

C.4. org.springframework.extensions.webscripts.ScriptRenderContext

  • Java Class : org.springframework.extensions.webscripts.ScriptRenderContext

  • Module Artifact Id : spring-surf

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Render context for the current rendering object

  • Methods

    • Method : getResource

      • Help :

        Gets the currently rendering content resource

      • Return : The currently rendering ScriptResource or null if none

    • Method : getId

      • Help :

        Gets the id of the request context

    • Method : getParameters

      • Help :

        A key/value map of parameters in the incoming request.

    • Method : getTemplate

      • Help :

        Gets the currently rendering template.

      • Return : The ScriptModelObject for the Template or null if a template is not being rendered.

    • Method : getUser

      • Help :

        Gets the user object.

      • Return : The ScriptUser for the current user or null if a user is not logged in.

    • Method : getPage

      • Help :

        Gets the currently rendering page.

      • Return : The ScriptModelObject for the Page or null if a page is not being rendered.

    • Method : getFormatId

      • Help :

        Gets the requested format id

    • Method : getThemeId

      • Help :

        Gets the currently rendering theme id.

    • Method : getTheme

      • Help :

        Gets the currently rendering theme.

      • Return : The ScriptModelObject for the Theme or null if a theme is not being rendered.

    • Method : getPageId

      • Help :

        Gets the id of the currently rendering page.
        Returns null if a page is not being rendered.

    • Method : getRootPage

      • Help :

        Gets the root page for the site.

      • Return : The ScriptModelObject for the root page.

    • Method : getSiteConfiguration

      • Help :

        Gets the site configuration.

      • Return : The ScriptModelObject for the site configuration or null if a site configuration is not set up.

    • Method : getLinkBuilder

      • Help :

        Returns the ScriptLinkBuilder instance for the current request.

    • Method : getTemplateId

      • Help :

        Gets the id of the currently rendering template.
        Returns null if a template is not being rendered.

    • Method : getContentId

      • Help :

        Gets the id of the currently rendering content resource

      • Return : The id of the content resource or null if none

    • Method : setThemeId

      • Help :

        Sets the theme for the current user session by providing the theme id.

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

    • Method : getAuthenticated

      • Help :

        Returns whether the current user is authenticated.

    • Method : getExternalAuthentication

      • Help :

        Returns whether the current user is externally authenticated.

C.5. org.springframework.extensions.webscripts.ScriptSurf

  • Java Class : org.springframework.extensions.webscripts.ScriptSurf

  • Module Artifact Id : spring-surf

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Root-scoped Java object that represents the configuration of Spring Surf

  • Methods

    • Method : getLoginEnabled

      • Help :

        Indicates whether Spring Surf has a non-default User Factory configured for it

      • Return : Whether a user factory is configured

C.6. org.springframework.extensions.webscripts.ScriptableUtils

  • Java Class : org.springframework.extensions.webscripts.ScriptableUtils

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of script utility methods for working with strings etc.

  • Sample Code :

    //JavaScript Sample Code
    model.biohtml = stringUtils.replaceLineBreaks(bio);
    
    //Freemarker Template Sample Code
    ${stringUtils.stripUnsafeHTML(item.node.content)?substring(0, contentLength)}

  • Methods

    • Method : urlDecode

      • Help :

        Decodes input URL string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : stripEncodeUnsafeHTML

      • Help :

        Strips encode unsafe HTML tags from the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : stripUnsafeHTML

      • Help :

        Strips unsafe HTML tags from the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : replaceLineBreaks

      • Help :

        Replaces line breaks in the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : encodeHTML

      • Help :

        Encodes input HTML string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : encodeJavaScript

      • Help :

        Encodes input JavaScript string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : urlEncode

      • Help :

        Encodes input string using URLEncoder

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : urlEncodeComponent

      • Help :

        Encode input URL string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : parseXMLNodeModel

      • Help :

        Converts an xml string to a freemarker node model

      • Return : Freemarker node model

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input XML string

C.7. org.springframework.extensions.webscripts.atom.AtomService

  • Java Class : org.springframework.extensions.webscripts.atom.AtomService

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of Atom related methods.

  • Sample Code :

    //JavaScript Sample Code
     var object = entry.getExtension(atom.names.cmis_object);
    //Freemarker Sample Code
    <#assign cmis_object=entry.getExtension(atom.names.cmis_object)>

  • Methods

    • Method : createEntry

      • Help :

        Constructs an empty entry

      • Return : Empty entry

    • Method : createQName

      • Help :

        Creates a QName

      • Return : QName

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Uri string

        • Parameter : var1

          • Java Class : java.lang.String

          • Help :

            Local name

    • Method : getNames

      • Help :

        Gets pre-configured Atom Extensions (QNames)

      • Return : map of QNames by alias

    • Method : createFeed

      • Help :

        Constructs an empty feed

      • Return : Empty feed

    • Method : toMimeType

      • Help :

        Establishs mimetype of atom content

      • Return : mimetype (or null, if it could not be established)

      • Parameters

        • Parameter : var0

          • Java Class : org.apache.abdera.model.Entry

          • Help :

            Entry

    • Method : toAtom

      • Help :

        Parses an Atom element

      • Return : Element

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom element

    • Method : toAtom

      • Help :

        Parses an Atom element

      • Return : Element

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom element string

    • Method : toService

      • Help :

        Parses an Atom service

      • Return : Atom servce

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom entry

    • Method : toService

      • Help :

        Parses an Atom service

      • Return : Atom service

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom entry string

    • Method : toEntry

      • Help :

        Parses an Atom Entry

      • Return : Entry

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom entry

    • Method : toEntry

      • Help :

        Parses an Atom entry

      • Return : Entry

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom entry string

    • Method : toFeed

      • Help :

        Parses an Atom feed

      • Return : Feed

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom feed

    • Method : toFeed

      • Help :

        Parses an Atom feed

      • Return : Feed

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom feed string

C.8. org.springframework.extensions.webscripts.json.JSONUtils

  • Java Class : org.springframework.extensions.webscripts.json.JSONUtils

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of JSON Utility methods.

  • Sample Code :

    //JavaScript Sample Code
    var myObj = {'name':'Test Object','size':100};
    var myObjAsString = jsonUtils.toJSONString(myObj);
    
    //Freemarker Template Sample Code
    [
        <#list tags as tag>
            ${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
        </#list>
    ]

  • Methods

    • Method : toObject

      • Help :

        Takes a JSON string and converts it to a native java script object

      • Sample Code :

        //JavaScript Sample Code
        model.postCode = jsonUtils.toObject(json).postCode;

      • Return : the created native JS object that represents the JSON object

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            A valid json string

    • Method : toObject

      • Help :

        Takes a JSON object and converts it to a native java script object

      • Sample Code :

        //JavaScript Sample Code
        model.postCode = jsonUtils.toObject(json).postCode;

      • Return : the created native object

      • Parameters

        • Parameter : var0

          • Java Class : org.json.JSONObject

          • Help :

            The json object

    • Method : toJSONString

      • Help :

        Converts a given JavaScript native object and converts it to the relevant JSON string.

      • Sample Code :

        //JavaScript Sample Code
        var myObj = {'name':'Test Object','size':100};
        var myObjAsString = jsonUtils.toJSONString(myObj);

      • Return : JSON string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.Object

          • Help :

            JavaScript object

    • Method : encodeJSONString

      • Help :

        Encodes a JSON string value

      • Return : Encoded value

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.Object

          • Help :

            Value to encode

Appendix D. Template Root Object Reference

This document displays list of available Template root objects that can be used in view templates. Root objects are listed in alphabetic order according to their names.

Each template root object in the following list is backed by a server-side java class respectively. Public methods of the server-side java class are exposed as APIs for corresponding Template root object.

For example

{
   "data":
   {
    "ticket":"${jsonUtils.encodeJSONString(ticket)}"
   }
}

This project has total 9 Template root objects.

D.1. argreplace

  • Java Class : org.springframework.extensions.webscripts.ArgReplaceMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Given a URL string and N named/value pairs, replace each URL argument with 
    respective name/value pair (if name matches existing URL argument), or add 
    name/value pair to URL (if name does not match existing URL argument).

    Usage: argreplace(url.args, "skipCount", cursor.nextPage, ...)

  • Sample Code :

    [#if cursor.hasFirstPage]
    <link rel="first" href="${absurl(encodeuri(scripturl(argreplace(url.args, pageNo,
    cursor.firstPage, pageSize, cursor.pageSize))))?xml}" type="${format.type}"/>
    [/#if]

  • Methods

D.2. atom

  • Java Class : org.springframework.extensions.webscripts.atom.AtomService

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of Atom related methods.

  • Sample Code :

    //JavaScript Sample Code
     var object = entry.getExtension(atom.names.cmis_object);
    //Freemarker Sample Code
    <#assign cmis_object=entry.getExtension(atom.names.cmis_object)>

  • Methods

    • Method : createEntry

      • Help :

        Constructs an empty entry

      • Return : Empty entry

    • Method : createQName

      • Help :

        Creates a QName

      • Return : QName

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Uri string

        • Parameter : var1

          • Java Class : java.lang.String

          • Help :

            Local name

    • Method : getNames

      • Help :

        Gets pre-configured Atom Extensions (QNames)

      • Return : map of QNames by alias

    • Method : createFeed

      • Help :

        Constructs an empty feed

      • Return : Empty feed

    • Method : toMimeType

      • Help :

        Establishs mimetype of atom content

      • Return : mimetype (or null, if it could not be established)

      • Parameters

        • Parameter : var0

          • Java Class : org.apache.abdera.model.Entry

          • Help :

            Entry

    • Method : toAtom

      • Help :

        Parses an Atom element

      • Return : Element

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom element

    • Method : toAtom

      • Help :

        Parses an Atom element

      • Return : Element

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom element string

    • Method : toService

      • Help :

        Parses an Atom service

      • Return : Atom servce

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom entry

    • Method : toService

      • Help :

        Parses an Atom service

      • Return : Atom service

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom entry string

    • Method : toEntry

      • Help :

        Parses an Atom Entry

      • Return : Entry

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom entry

    • Method : toEntry

      • Help :

        Parses an Atom entry

      • Return : Entry

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom entry string

    • Method : toFeed

      • Help :

        Parses an Atom feed

      • Return : Feed

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom feed

    • Method : toFeed

      • Help :

        Parses an Atom feed

      • Return : Feed

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom feed string

D.3. date

  • Java Class : java.util.Date

D.4. dateCompare

  • Java Class : org.springframework.extensions.webscripts.DateCompareMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Perform a test to see how two dates compare, optionally offset by a specified number of
    milliseconds.

    Usage: 
      dateCompare(dateA, dateB) - 1 if dateA if greater than dateB
      dateCompare(dateA, dateB, millis) - 1 if dateA is greater than dateB by at least millis, else 0
      dateCompare(dateA, dateB, millis, test) - same as above, but the 'test' variable is one of the
      following strings ">", "<", "==" - greater than, less than or equal - as the test to perform.

  • Sample Code :

    <#if (dateCompare(child.properties["cm:modified"], date, 1000*60*60*24*7) == 1)>
    </#if>

  • Methods

D.5. encodeuri

  • Java Class : org.springframework.extensions.webscripts.UrlEncodeMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Encode a URL Path.

    Usage: pathencode(String url)

  • Sample Code :

    <link rel="self" href="${absurl(encodeuri(url.full))?xml}"/>

  • Methods

D.6. jsonUtils

  • Java Class : org.springframework.extensions.webscripts.json.JSONUtils

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of JSON Utility methods.

  • Sample Code :

    //JavaScript Sample Code
    var myObj = {'name':'Test Object','size':100};
    var myObjAsString = jsonUtils.toJSONString(myObj);
    
    //Freemarker Template Sample Code
    [
        <#list tags as tag>
            ${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
        </#list>
    ]

  • Methods

    • Method : toObject

      • Help :

        Takes a JSON string and converts it to a native java script object

      • Sample Code :

        //JavaScript Sample Code
        model.postCode = jsonUtils.toObject(json).postCode;

      • Return : the created native JS object that represents the JSON object

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            A valid json string

    • Method : toObject

      • Help :

        Takes a JSON object and converts it to a native java script object

      • Sample Code :

        //JavaScript Sample Code
        model.postCode = jsonUtils.toObject(json).postCode;

      • Return : the created native object

      • Parameters

        • Parameter : var0

          • Java Class : org.json.JSONObject

          • Help :

            The json object

    • Method : toJSONString

      • Help :

        Converts a given JavaScript native object and converts it to the relevant JSON string.

      • Sample Code :

        //JavaScript Sample Code
        var myObj = {'name':'Test Object','size':100};
        var myObjAsString = jsonUtils.toJSONString(myObj);

      • Return : JSON string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.Object

          • Help :

            JavaScript object

    • Method : encodeJSONString

      • Help :

        Encodes a JSON string value

      • Return : Encoded value

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.Object

          • Help :

            Value to encode

D.7. server

  • Java Class : org.springframework.extensions.webscripts.PresentationContainer$PresentationServerModel

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

D.8. stringUtils

  • Java Class : org.springframework.extensions.webscripts.ScriptableUtils

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of script utility methods for working with strings etc.

  • Sample Code :

    //JavaScript Sample Code
    model.biohtml = stringUtils.replaceLineBreaks(bio);
    
    //Freemarker Template Sample Code
    ${stringUtils.stripUnsafeHTML(item.node.content)?substring(0, contentLength)}

  • Methods

    • Method : urlDecode

      • Help :

        Decodes input URL string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : stripEncodeUnsafeHTML

      • Help :

        Strips encode unsafe HTML tags from the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : stripUnsafeHTML

      • Help :

        Strips unsafe HTML tags from the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : replaceLineBreaks

      • Help :

        Replaces line breaks in the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : encodeHTML

      • Help :

        Encodes input HTML string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : encodeJavaScript

      • Help :

        Encodes input JavaScript string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : urlEncode

      • Help :

        Encodes input string using URLEncoder

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : urlEncodeComponent

      • Help :

        Encode input URL string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : parseXMLNodeModel

      • Help :

        Converts an xml string to a freemarker node model

      • Return : Freemarker node model

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input XML string

D.9. xmldate

  • Java Class : org.springframework.extensions.webscripts.ISO8601DateFormatMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Render Date to ISO8601 format. Or parse ISO6801 format string date to a Date object.

    Usage: xmldate(Date date)
            xmldate(String date)

  • Sample Code :

    <updated>${xmldate(date)}</updated>

  • Methods

Appendix E. Template API Reference

This document displays list of available custom Template methods that can be used in view templates if they are registered as Template root objects.

Each custom template method is backed by a server-side java class. For custom Freemarker template method, it will need to implement interface freemarker.template.TemplateMethodModelEx.

For example

var myObj = {'name':'Test Object','size':100};
var myObjAsString = jsonUtils.toJSONString(myObj);

This project has total 15 avaialble custom Template methods

E.1. org.springframework.extensions.webscripts.AbsoluteUrlMethod

  • Java Class : org.springframework.extensions.webscripts.AbsoluteUrlMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Render absolute url for the specified url (only if the url isn't already absolute).

    Usage: absurl(String url)

  • Sample Code :

    ${absurl(url.context)}

  • Methods

E.2. org.springframework.extensions.webscripts.ArgReplaceMethod

  • Java Class : org.springframework.extensions.webscripts.ArgReplaceMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Given a URL string and N named/value pairs, replace each URL argument with 
    respective name/value pair (if name matches existing URL argument), or add 
    name/value pair to URL (if name does not match existing URL argument).

    Usage: argreplace(url.args, "skipCount", cursor.nextPage, ...)

  • Sample Code :

    [#if cursor.hasFirstPage]
    <link rel="first" href="${absurl(encodeuri(scripturl(argreplace(url.args, pageNo,
    cursor.firstPage, pageSize, cursor.pageSize))))?xml}" type="${format.type}"/>
    [/#if]

  • Methods

E.3. org.springframework.extensions.webscripts.ClientUrlFunctionMethod

  • Java Class : org.springframework.extensions.webscripts.ClientUrlFunctionMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Render a client side javascript function to build urls to this service.

    Usage: clientUrlFunction(String funcName)

  • Sample Code :

    ${clienturlfunction("encUrl")}

  • Methods

E.4. org.springframework.extensions.webscripts.DateCompareMethod

  • Java Class : org.springframework.extensions.webscripts.DateCompareMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Perform a test to see how two dates compare, optionally offset by a specified number of
    milliseconds.

    Usage: 
      dateCompare(dateA, dateB) - 1 if dateA if greater than dateB
      dateCompare(dateA, dateB, millis) - 1 if dateA is greater than dateB by at least millis, else 0
      dateCompare(dateA, dateB, millis, test) - same as above, but the 'test' variable is one of the
      following strings ">", "<", "==" - greater than, less than or equal - as the test to perform.

  • Sample Code :

    <#if (dateCompare(child.properties["cm:modified"], date, 1000*60*60*24*7) == 1)>
    </#if>

  • Methods

E.5. org.springframework.extensions.webscripts.FormatWriterMethod

  • Java Class : org.springframework.extensions.webscripts.FormatWriterMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Render object to mimetype of web script template.  If object cannot be serialized to mimetype
    then no output is written.

    Usage: formatwrite(object)

  • Methods

E.6. org.springframework.extensions.webscripts.FreemarkerI18NMessageMethod

  • Java Class : org.springframework.extensions.webscripts.FreemarkerI18NMessageMethod

  • Module Artifact Id : spring-surf

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Returns an I18N message resolved for the current locale and specified message ID.

    Usage: message(String id)

  • Sample Code :

    ${message("templates.doc_info.name")}

  • Methods

E.7. org.springframework.extensions.webscripts.ISO8601DateFormatMethod

  • Java Class : org.springframework.extensions.webscripts.ISO8601DateFormatMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Render Date to ISO8601 format. Or parse ISO6801 format string date to a Date object.

    Usage: xmldate(Date date)
            xmldate(String date)

  • Sample Code :

    <updated>${xmldate(date)}</updated>

  • Methods

E.8. org.springframework.extensions.webscripts.MessageMethod

  • Java Class : org.springframework.extensions.webscripts.MessageMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Returns an I18N message resolved for the current locale and specified message ID.

    Usage: message(String id)

  • Sample Code :

    ${message("templates.doc_info.name")}

  • Methods

E.9. org.springframework.extensions.webscripts.ScriptRenderContext

  • Java Class : org.springframework.extensions.webscripts.ScriptRenderContext

  • Module Artifact Id : spring-surf

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Render context for the current rendering object

  • Methods

    • Method : getResource

      • Help :

        Gets the currently rendering content resource

      • Return : The currently rendering ScriptResource or null if none

    • Method : getId

      • Help :

        Gets the id of the request context

    • Method : getParameters

      • Help :

        A key/value map of parameters in the incoming request.

    • Method : getTemplate

      • Help :

        Gets the currently rendering template.

      • Return : The ScriptModelObject for the Template or null if a template is not being rendered.

    • Method : getUser

      • Help :

        Gets the user object.

      • Return : The ScriptUser for the current user or null if a user is not logged in.

    • Method : getPage

      • Help :

        Gets the currently rendering page.

      • Return : The ScriptModelObject for the Page or null if a page is not being rendered.

    • Method : getFormatId

      • Help :

        Gets the requested format id

    • Method : getThemeId

      • Help :

        Gets the currently rendering theme id.

    • Method : getTheme

      • Help :

        Gets the currently rendering theme.

      • Return : The ScriptModelObject for the Theme or null if a theme is not being rendered.

    • Method : getPageId

      • Help :

        Gets the id of the currently rendering page.
        Returns null if a page is not being rendered.

    • Method : getRootPage

      • Help :

        Gets the root page for the site.

      • Return : The ScriptModelObject for the root page.

    • Method : getSiteConfiguration

      • Help :

        Gets the site configuration.

      • Return : The ScriptModelObject for the site configuration or null if a site configuration is not set up.

    • Method : getLinkBuilder

      • Help :

        Returns the ScriptLinkBuilder instance for the current request.

    • Method : getTemplateId

      • Help :

        Gets the id of the currently rendering template.
        Returns null if a template is not being rendered.

    • Method : getContentId

      • Help :

        Gets the id of the currently rendering content resource

      • Return : The id of the content resource or null if none

    • Method : setThemeId

      • Help :

        Sets the theme for the current user session by providing the theme id.

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

    • Method : getAuthenticated

      • Help :

        Returns whether the current user is authenticated.

    • Method : getExternalAuthentication

      • Help :

        Returns whether the current user is externally authenticated.

E.10. org.springframework.extensions.webscripts.ScriptSurf

  • Java Class : org.springframework.extensions.webscripts.ScriptSurf

  • Module Artifact Id : spring-surf

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Root-scoped Java object that represents the configuration of Spring Surf

  • Methods

    • Method : getLoginEnabled

      • Help :

        Indicates whether Spring Surf has a non-default User Factory configured for it

      • Return : Whether a user factory is configured

E.11. org.springframework.extensions.webscripts.ScriptUrlMethod

  • Java Class : org.springframework.extensions.webscripts.ScriptUrlMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Render script url independent of script hosting environment e.g. render inside / outside

    Usage: scripturl(String url)
            xmldate(String date)

  • Sample Code :

    ${scripturl("?nodeRef=" + n.parent.nodeRef + "&n=" + n.nodeRef + "&a=p")}

  • Methods

E.12. org.springframework.extensions.webscripts.ScriptableUtils

  • Java Class : org.springframework.extensions.webscripts.ScriptableUtils

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of script utility methods for working with strings etc.

  • Sample Code :

    //JavaScript Sample Code
    model.biohtml = stringUtils.replaceLineBreaks(bio);
    
    //Freemarker Template Sample Code
    ${stringUtils.stripUnsafeHTML(item.node.content)?substring(0, contentLength)}

  • Methods

    • Method : urlDecode

      • Help :

        Decodes input URL string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : stripEncodeUnsafeHTML

      • Help :

        Strips encode unsafe HTML tags from the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : stripUnsafeHTML

      • Help :

        Strips unsafe HTML tags from the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : replaceLineBreaks

      • Help :

        Replaces line breaks in the input string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : encodeHTML

      • Help :

        Encodes input HTML string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : encodeJavaScript

      • Help :

        Encodes input JavaScript string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : urlEncode

      • Help :

        Encodes input string using URLEncoder

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : urlEncodeComponent

      • Help :

        Encode input URL string

      • Return : Processed string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input string

    • Method : parseXMLNodeModel

      • Help :

        Converts an xml string to a freemarker node model

      • Return : Freemarker node model

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Input XML string

E.13. org.springframework.extensions.webscripts.UrlEncodeMethod

  • Java Class : org.springframework.extensions.webscripts.UrlEncodeMethod

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Encode a URL Path.

    Usage: pathencode(String url)

  • Sample Code :

    <link rel="self" href="${absurl(encodeuri(url.full))?xml}"/>

  • Methods

E.14. org.springframework.extensions.webscripts.atom.AtomService

  • Java Class : org.springframework.extensions.webscripts.atom.AtomService

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of Atom related methods.

  • Sample Code :

    //JavaScript Sample Code
     var object = entry.getExtension(atom.names.cmis_object);
    //Freemarker Sample Code
    <#assign cmis_object=entry.getExtension(atom.names.cmis_object)>

  • Methods

    • Method : createEntry

      • Help :

        Constructs an empty entry

      • Return : Empty entry

    • Method : createQName

      • Help :

        Creates a QName

      • Return : QName

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Uri string

        • Parameter : var1

          • Java Class : java.lang.String

          • Help :

            Local name

    • Method : getNames

      • Help :

        Gets pre-configured Atom Extensions (QNames)

      • Return : map of QNames by alias

    • Method : createFeed

      • Help :

        Constructs an empty feed

      • Return : Empty feed

    • Method : toMimeType

      • Help :

        Establishs mimetype of atom content

      • Return : mimetype (or null, if it could not be established)

      • Parameters

        • Parameter : var0

          • Java Class : org.apache.abdera.model.Entry

          • Help :

            Entry

    • Method : toAtom

      • Help :

        Parses an Atom element

      • Return : Element

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom element

    • Method : toAtom

      • Help :

        Parses an Atom element

      • Return : Element

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom element string

    • Method : toService

      • Help :

        Parses an Atom service

      • Return : Atom servce

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom entry

    • Method : toService

      • Help :

        Parses an Atom service

      • Return : Atom service

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom entry string

    • Method : toEntry

      • Help :

        Parses an Atom Entry

      • Return : Entry

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom entry

    • Method : toEntry

      • Help :

        Parses an Atom entry

      • Return : Entry

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom entry string

    • Method : toFeed

      • Help :

        Parses an Atom feed

      • Return : Feed

      • Parameters

        • Parameter : var0

          • Java Class : org.springframework.extensions.surf.util.Content

          • Help :

            Atom feed

    • Method : toFeed

      • Help :

        Parses an Atom feed

      • Return : Feed

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            Atom feed string

E.15. org.springframework.extensions.webscripts.json.JSONUtils

  • Java Class : org.springframework.extensions.webscripts.json.JSONUtils

  • Module Artifact Id : spring-webscripts

  • Module Group Id : org.springframework.extensions.surf

  • Module Version : 1.0.0.CI-SNAPSHOT

  • Java Doc : link

  • Help :

    Collection of JSON Utility methods.

  • Sample Code :

    //JavaScript Sample Code
    var myObj = {'name':'Test Object','size':100};
    var myObjAsString = jsonUtils.toJSONString(myObj);
    
    //Freemarker Template Sample Code
    [
        <#list tags as tag>
            ${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
        </#list>
    ]

  • Methods

    • Method : toObject

      • Help :

        Takes a JSON string and converts it to a native java script object

      • Sample Code :

        //JavaScript Sample Code
        model.postCode = jsonUtils.toObject(json).postCode;

      • Return : the created native JS object that represents the JSON object

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.String

          • Help :

            A valid json string

    • Method : toObject

      • Help :

        Takes a JSON object and converts it to a native java script object

      • Sample Code :

        //JavaScript Sample Code
        model.postCode = jsonUtils.toObject(json).postCode;

      • Return : the created native object

      • Parameters

        • Parameter : var0

          • Java Class : org.json.JSONObject

          • Help :

            The json object

    • Method : toJSONString

      • Help :

        Converts a given JavaScript native object and converts it to the relevant JSON string.

      • Sample Code :

        //JavaScript Sample Code
        var myObj = {'name':'Test Object','size':100};
        var myObjAsString = jsonUtils.toJSONString(myObj);

      • Return : JSON string

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.Object

          • Help :

            JavaScript object

    • Method : encodeJSONString

      • Help :

        Encodes a JSON string value

      • Return : Encoded value

      • Parameters

        • Parameter : var0

          • Java Class : java.lang.Object

          • Help :

            Value to encode