Fluent builder for registering a URL to controller mapping for a custom app, reached from controllerMappings.adminController() for admin screens or controllerMappings.websiteController() for website controllers. Set the path, view and any role privileges, add one JS function per HTTP method with addMethod, then call build to create the mapping and, unless the app engine has already finished initialising, register it for routing.

Group: Builders


Properties

PropertyReturnsDescription
rolePrivsMap<String,List<Priviledge>>The privileges configured so far on this builder, keyed by role name. May be null if no role has been added yet.

Methods

addRole(String roleName, String privNames) · addRole(String roleName, List<Priviledge> privs) · getRolePrivs() · path(String s) · pathSegmentName(String s) · pathSegmentResolver(String groupName, Object resolver) · title(Object s) · breadCrumbs(String functionName) · breadCrumbs(Map breadCrumbMap) · uniqueId(Object uniqueId) · modifiedDate(Object modifiedDate) · contentLength(Object contentLength) · seoContent(Object s) · addPathResolver(String groupName, Object resolver) · enabled(boolean b) · defaultView(View view) · addMethod(String method, String function) · addFunction(String method, VarArgFunction function) · addMethod(String method, String functionName, String requiredParam) · addFunction(String method, VarArgFunction function, String requiredParam) · addMethod(String method, String functionName, String requiredParam, View view) · addFunction(String method, VarArgFunction function, String requiredParam, View view) · isPublic(Boolean isPub) · postPriviledge(String s) · types(String[] types) · addType(String type) · mountRepository(String repoName) · build() · child(ControllerMappingBuilder childBuilder)

addRole(String roleName, String privNames)

Returns: ControllerMappingBuilder

Grants the named role the given privileges on this controller. Unknown privilege names are logged and skipped rather than failing the whole call.

ParameterDescription
roleNamethe role to grant privileges to
privNamesthe names of the AccessControlledResource.Priviledge values to grant; unknown names are ignored

addRole(String roleName, List<Priviledge> privs)

Returns: ControllerMappingBuilder

Grants the named role the given privileges on this controller.

ParameterDescription
roleNamethe role to grant privileges to
privsthe privileges to grant

getRolePrivs()

Returns: Map<String,List<Priviledge>>

The privileges configured so far on this builder, keyed by role name. May be null if no role has been added yet.

path(String s)

Returns: ControllerMappingBuilder

Sets the path or regular expression this controller is mapped to, for example /services/uploads/*.

ParameterDescription
sthe path pattern to match incoming requests against

pathSegmentName(String s)

Returns: ControllerMappingBuilder

Sets this mapping as a single dynamic path segment with a fixed name, rather than a fixed path or regular expression.

ParameterDescription
sthe segment name to match

pathSegmentResolver(String groupName, Object resolver)

Returns: ControllerMappingBuilder

Sets this mapping as a single dynamic path segment whose value is resolved at request time by the given resolver, registered under the given group name.

ParameterDescription
groupNamethe name the resolver is registered under
resolverthe resolver used to compute this segment's value at request time

title(Object s)

Returns: ControllerMappingBuilder

Sets the title for this controller, either a literal value or the name of a JS function invoked to compute it at request time.

ParameterDescription
sthe title, or the name of a function that computes it

Returns: ControllerMappingBuilder

Sets the breadcrumbs for this controller to be computed at request time by the named JS function.

ParameterDescription
functionNamename of the JS function invoked to generate the breadcrumbs

Returns: ControllerMappingBuilder

Sets a fixed, prebuilt set of breadcrumbs for this controller. Useful for statically defined pages; the map should be a LinkedHashMap to retain entry ordering.

ParameterDescription
breadCrumbMapthe prebuilt breadcrumbs map

uniqueId(Object uniqueId)

Returns: ControllerMappingBuilder

Sets the unique id for this controller, either a literal value or the name of a JS function invoked to compute it at request time.

ParameterDescription
uniqueIdthe unique id, or the name of a function that computes it

modifiedDate(Object modifiedDate)

Returns: ControllerMappingBuilder

Sets the modified date for this controller, either a literal value or the name of a JS function invoked to compute it at request time.

ParameterDescription
modifiedDatethe modified date, or the name of a function that computes it

contentLength(Object contentLength)

Returns: ControllerMappingBuilder

Sets the content length for this controller, either a literal value or the name of a JS function invoked to compute it at request time.

ParameterDescription
contentLengththe content length, or the name of a function that computes it

seoContent(Object s)

Returns: ControllerMappingBuilder

Sets the SEO content for this controller, typically the name of a JS function invoked to populate it at request time.

ParameterDescription
sthe SEO content, or the name of a function that computes it

addPathResolver(String groupName, Object resolver)

Returns: ControllerMappingBuilder

Registers a resolver used to compute the value of a named path segment at request time.

ParameterDescription
groupNamethe named regular expression group the resolver applies to
resolverthe resolver used to compute that segment's value at request time

enabled(boolean b)

Returns: ControllerMappingBuilder

Sets whether this controller mapping is active. A disabled mapping is not matched to incoming requests.

ParameterDescription
btrue to enable the mapping

defaultView(View view)

Returns: ControllerMappingBuilder

Sets the view used to render this controller's response when a matched method does not specify its own view.

ParameterDescription
viewthe default view for this controller

addMethod(String method, String function)

Returns: ControllerMappingBuilder

Registers a JS function to handle the given HTTP method on this controller, with no required parameter.

ParameterDescription
methodthe HTTP method to handle, for example GET or POST
functionname of the JS function to invoke

addFunction(String method, VarArgFunction function)

Returns: ControllerMappingBuilder

Registers a JS function reference to handle the given HTTP method on this controller, with no required parameter.

ParameterDescription
methodthe HTTP method to handle, for example GET or POST
functionthe JS function to invoke

addMethod(String method, String functionName, String requiredParam)

Returns: ControllerMappingBuilder

Registers a JS function to handle the given HTTP method on this controller, only invoked when the given request parameter is present.

ParameterDescription
methodthe HTTP method to handle, for example GET or POST
functionNamename of the JS function to invoke
requiredParamname of the request parameter that must be present for this method to match

addFunction(String method, VarArgFunction function, String requiredParam)

Returns: ControllerMappingBuilder

Registers a JS function reference to handle the given HTTP method on this controller, only invoked when the given request parameter is present.

ParameterDescription
methodthe HTTP method to handle, for example GET or POST
functionthe JS function to invoke
requiredParamname of the request parameter that must be present for this method to match

addMethod(String method, String functionName, String requiredParam, View view)

Returns: ControllerMappingBuilder

Registers a JS function to handle the given HTTP method on this controller, only invoked when the given request parameter is present, rendering its result with the given view instead of this mapping's default view.

ParameterDescription
methodthe HTTP method to handle, for example GET or POST
functionNamename of the JS function to invoke
requiredParamname of the request parameter that must be present for this method to match
viewthe view used to render this method's result

addFunction(String method, VarArgFunction function, String requiredParam, View view)

Returns: ControllerMappingBuilder

Registers a JS function reference to handle the given HTTP method on this controller, only invoked when the given request parameter is present, rendering its result with the given view instead of this mapping's default view.

ParameterDescription
methodthe HTTP method to handle, for example GET or POST
functionthe JS function to invoke
requiredParamname of the request parameter that must be present for this method to match
viewthe view used to render this method's result

isPublic(Boolean isPub)

Returns: ControllerMappingBuilder

Sets whether this controller can be accessed without authentication. A null value is treated as true.

ParameterDescription
isPubtrue or null to make the controller public, false to require authentication

postPriviledge(String s)

Returns: ControllerMappingBuilder

Sets the privilege a user must hold to POST to this controller.

ParameterDescription
sthe name of an AccessControlledResource.Priviledge value

types(String[] types)

Returns: ControllerMappingBuilder

Replaces this controller's resource type tags with the given set, used to match roles and other type-based rules against it.

ParameterDescription
typesthe type tags to set; a null value clears the tags to an empty set

addType(String type)

Returns: ControllerMappingBuilder

Adds a single resource type tag to this controller, used to match roles and other type-based rules against it, without replacing tags already set.

ParameterDescription
typethe type tag to add

mountRepository(String repoName)

Returns: ControllerMappingBuilder

Mounts the named content repository at this controller's path and marks the mapping as a collection.

ParameterDescription
repoNamethe name of the content repository to mount

build()

Returns: ControllerMapping

Builds the ControllerMapping configured on this builder and, unless the app engine has already finished initialising, registers it with the root mappings list it was created against for routing.

child(ControllerMappingBuilder childBuilder)

Returns: ControllerMappingBuilder

Builds the given child builder and adds the resulting mapping as a child of this controller, marking this mapping as a collection. The child mapping is not itself registered with the root mappings list.

ParameterDescription
childBuilderthe builder for the child controller to add
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.