Class HtmlCardType
- All Implemented Interfaces:
CardTypeHandler
html card type: markup-only (JSON5 bodies are E-25), with an optional body auto-captured
as a <template data-card="{id}">. A bare html card (no body) emits an empty fragment — the
shell paints an empty .jc-card and nothing more.
Trust boundary for src:
An html card in a page contract may instead name a src endpoint. The src must be a
same-origin path (checked at page build, by PageCapture.addCard for FreeMarker and PageSpec cards
and by CardTypeRegistry.toCard for lifted ones; the shell checks it again before the fetch). The shell
fetches it and inserts the returned HTML as-is, unsanitized, the same trust level as
footer.text. The endpoint must therefore be a trusted first-party route, must never be derived from request
data, and must escape any data it embeds in the fragment.
A card that cannot guarantee that can opt in with "sanitize": true (or sanitize=true on
<@card>, or CardSpec.sanitize(true)). The shell then rebuilds the fetched fragment through the views
attribute-allowlist sanitizer, the one behind the SANITIZED_HTML detail format, so script, on*
handlers, unsafe URLs and unlisted attributes are dropped. The page must load the views toolkit; without it the
card fails closed with E-JS-8 and paints nothing. The flag only affects src cards, and the default is
unchanged (unsanitized).
Example:
CardSource
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAn html card handles only the shell'srefreshop.An html card is markup: it takes only the shell'srefresh/paramsroles.toFragment(CardSource source) Validates the authored card and returns its contract fragment.type()The type name this handler serves.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.juneau.console.CardTypeHandler
implicitTopics, requiredPacks
-
Constructor Details
-
HtmlCardType
public HtmlCardType()
-
-
Method Details
-
type
Description copied from interface:CardTypeHandlerThe type name this handler serves.- Specified by:
typein interfaceCardTypeHandler- Returns:
- The type name; must match
^[a-z][a-z0-9-]{0,31}$(E-21).
-
acceptedRoles
An html card is markup: it takes only the shell'srefresh/paramsroles.- Specified by:
acceptedRolesin interfaceCardTypeHandler- Returns:
- The accepted role names, or
nullif unknown.
-
acceptedOps
An html card handles only the shell'srefreshop.- Specified by:
acceptedOpsin interfaceCardTypeHandler- Returns:
- The handled op names, or
nullif unknown.
-
toFragment
Description copied from interface:CardTypeHandlerValidates the authored card and returns its contract fragment.- Specified by:
toFragmentin interfaceCardTypeHandler- Parameters:
source- The authored card (attributes plus body).- Returns:
- The fragment merged flat onto the card's base keys; must not contain a reserved key (E-23).
-