Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

...

Implementation tracked in

MAGNOLIA-3895@jira

...

.

Intro

  • A selector is the part between the first selector delimiter and the extension of an URI. I.e.

...

  • given

...

  • a

...

  • URI

...

  • like

...

...

  • and

...

  • the

...

  • tilde

...

  • character

...

  • as

...

  • the

...

  • delimiter,

...

  • the

...

  • entire

...

  • selector

...

  • is

...

  • ~x~foo=bar

...

  • .

...

  • A

...

  • selector

...

  • can

...

  • be

...

  • split

...

  • in

...

  • turn

...

  • into

...

  • several

...

  • selectors

...

  • separated

...

  • from

...

  • each

...

  • other

...

  • by

...

  • the

...

  • same

...

  • delimiter.

...

Rationale

  • Selectors existed prior to Magnolia 4.5

...

  • and

...

  • they

...

  • use

...

  • the

...

  • .

...

  • (dot)

...

  • char

...

  • as

...

  • a

...

  • delimiter.

...

  • As

...

  • Magnolia

...

  • 4.5

...

  • introduces

...

  • the

...

  • possibility

...

  • to

...

  • have

...

  • the

...

  • dot

...

  • .

...

  • character

...

  • in

...

  • the

...

  • node

...

  • names

...

  • (as

...

  • by

...

  • JCR

...

  • specification

...

...

...

...

...

...

...

...

...

...

  • )

...

  • the

...

  • delimiter

...

  • character

...

  • needs

...

  • to

...

  • be

...

  • changed.

...

Delimiter

  • info.magnolia.cms.core.Path

...

  • has

...

  • a

...

  • SELECTOR_DELIMITER

...

  • constant

...

  • (a

...

  • string)

...

  • set

...

  • as

...

  • ~

...

  • (tilde).

...

Selector

...

name-value

...

pair

...

  • a

...

  • selector

...

  • can

...

  • now

...

  • also

...

  • be

...

  • in

...

  • the

...

  • form

...

  • name=value.

...

  • I.e.

...

  • given

...

  • a

...

  • URI

...

...

  • foo=bar

...

  • is

...

  • name

...

  • value

...

  • selector.

...

  • This

...

  • kind

...

  • of

...

  • selector

...

  • is

...

  • exposed

...

  • by

...

  • MgnlContext.getAttribute(selectorName)

...

  • and

...

  • has

...

  • a

...

  • "local"

...

  • scope

...

  • (similar

...

  • to

...

  • HttpServletRequest

...

  • scope).

...

  • Thus,

...

  • in

...

  • the

...

  • current

...

  • example,

...

  • MgnlContext.getAttribute("foo")

...

  • will

...

  • return

...

  • the

...

  • String

...

  • "bar"

...

  • ,

...

  • whereas

...

  • MgnlContext.getAttribute("foo",

...

  • Context.SESSION_SCOPE)

...

  • or

...

  • MgnlContext.getAttribute("foo",

...

  • Context.APPLICATION_SCOPE)

...

  • will

...

  • return

...

  • null

...

  • .

...

AggregationState

  • this class exposes some methods to set and get selectors.
    • setSelector(String selector) is currently used by info.magnolia.cms.filters.RepositoryMappingFilter

...

    • where

...

    • the

...

    • request

...

    • URI

...

    • is

...

    • parsed

...

    • and

...

    • the

...

    • selector

...

    • part

...

    • extracted.

...

    • String getSelector()

...

    • returns

...

    • the

...

    • whole

...

    • selector.

...

    • I.e

...

    • given

...

    • the

...

    • URI

...

...

    • this

...

    • method

...

    • will

...

    • return

...

    • the

...

    • String

...

    • x~foo=bar

...

    • String[] getSelectors()

...

    • returns

...

    • the

...

    • selector

...

    • split

...

    • into

...

    • its

...

    • discrete

...

    • elements.

...

    • I.e

...

    • given

...

    • the

...

    • URI

...

...

    • this

...

    • method

...

    • will

...

    • return

...

    • an

...

    • array

...

    • of

...

    • two

...

    • elements

...

    • containing

...

    • the

...

    • "x"

...

    • and

...

    • the

...

    • "foo=bar"

...

    • String(s)

...

SelectorUtil

  • this is a utility class already existing before Magnolia 4.5.

...

  • It

...

  • provides

...

  • two

...

  • methods

...

  • which

...

  • are

...

  • basically

...

  • shortcuts

...

  • to

...

  • the

...

  • getters

...

  • in

...

  • AggregationState

...

  • :
    • String getSelector()

...

    • String getSelector(int

...

    • index)

...