| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width,initial-scale=1"> |
| <title>Layout Resources :: Apache Isis</title> |
| <link rel="canonical" href="https://isis.apache.org/vro/2.0.0-M5/layout-resources.html"> |
| <meta name="generator" content="Antora 2.3.4"> |
| <link rel="stylesheet" href="../../_/css/site.css"> |
| <link rel="stylesheet" href="../../_/css/site-custom.css"> |
| <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Raleway:300,400,500,700,800|Montserrat:300,400,700" rel="stylesheet"> |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css"/> |
| <link rel="home" href="https://isis.apache.org" title="Apache Isis"> |
| <link rel="next" href="hints-and-tips.html" title="Hints-n-Tips"> |
| <link rel="prev" href="security.html" title="Security"> |
| </head> |
| <body class="article"> |
| <header class="header"> |
| <nav class="navbar"> |
| <div class="navbar-brand"> |
| <a class="navbar-item" href="https://isis.apache.org"> |
| <span class="icon"> |
| <img src="../../_/img/isis-logo-48x48.png"></img> |
| </span> |
| <span>Apache Isis</span> |
| </a> |
| <button class="navbar-burger" data-target="topbar-nav"> |
| <span></span> |
| <span></span> |
| <span></span> |
| </button> |
| </div> |
| <div id="topbar-nav" class="navbar-menu"> |
| <a class="navbar-end"> |
| <div class="navbar-item hide-for-print"> |
| <span> |
| <input id="algolia-search-input" placeholder="Search"></span> |
| </span> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Quick Start</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Starter Apps</span> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/starters/helloworld.html">Hello World</a> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/starters/simpleapp.html">Simple App</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Demos & Tutorials</span> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/demo/about.html">Demo App</a> |
| <a class="navbar-item" href="https://danhaywood.gitlab.io/isis-petclinic-tutorial-docs/petclinic/1.16.2/intro.html">Petclinic (tutorial)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Resources</span> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/resources/cheatsheet.html">Cheatsheet</a> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/resources/icons.html">Icons</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Guides</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Development</span> |
| <a class="navbar-item" href="../../setupguide/2.0.0-M5/about.html">Setup Guide</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Core</span> |
| <a class="navbar-item" href="../../userguide/2.0.0-M5/about.html">User Guide</a> |
| <a class="navbar-item" href="../../refguide/2.0.0-M5/about.html">Reference Guide</a> |
| <a class="navbar-item" href="../../testing/2.0.0-M5/about.html">Testing Guide</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Libraries</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">For Use in Apps</span> |
| <a class="navbar-item" href="../../subdomains/2.0.0-M5/about.html">Subdomain Libraries</a> |
| <a class="navbar-item" href="../../valuetypes/2.0.0-M5/about.html">Value Types</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Integrate between Apps</span> |
| <a class="navbar-item" href="../../mappings/2.0.0-M5/about.html">Bounded Context Mapping Libraries</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Other</span> |
| <a class="navbar-item" href="../../incubator/2.0.0-M5/about.html">Incubator</a> |
| <a class="navbar-item" href="../../legacy/2.0.0-M5/about.html">Legacy</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Components</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Viewers</span> |
| <a class="navbar-item" href="../../vw/2.0.0-M5/about.html">Web UI (Wicket)</a> |
| <a class="navbar-item" href="../../vro/2.0.0-M5/about.html">REST API (Restful Objects)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Security</span> |
| <a class="navbar-item" href="../../security/2.0.0-M5/about.html">Security Guide</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Persistence</span> |
| <a class="navbar-item" href="../../pjpa/2.0.0-M5/about.html">JPA (EclipseLink)</a> |
| <a class="navbar-item" href="../../pjdo/2.0.0-M5/about.html">JDO (DataNucleus)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Extensions</span> |
| <a class="navbar-item" href="../../extensions/2.0.0-M5/about.html">Extensions Catalog</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Support</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Contact</span> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/support/slack-channel.html">Slack</a> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/support/mailing-list.html">Mailing Lists</a> |
| <a class="navbar-item" href="https://issues.apache.org/jira/browse/ISIS">JIRA</a> |
| <a class="navbar-item" href="https://stackoverflow.com/questions/tagged/isis">Stack Overflow</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Releases</span> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/downloads/how-to.html">Downloads</a> |
| <a class="navbar-item" href="../../relnotes/2.0.0-M5/about.html">Release Notes</a> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/archive/1-x.html">Archive (1.x)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Framework</span> |
| <a class="navbar-item" href="../../conguide/2.0.0-M5/about.html">Contributors' Guide</a> |
| <a class="navbar-item" href="../../comguide/2.0.0-M5/about.html">Committers' Guide</a> |
| <a class="navbar-item" href="../../core/2.0.0-M5/about.html">Core Design</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">ASF</a> |
| <div class="navbar-dropdown"> |
| <a class="navbar-item" href="http://www.apache.org/">Apache Homepage</a> |
| <a class="navbar-item" href="https://www.apache.org/events/current-event">Events</a> |
| <a class="navbar-item" href="https://www.apache.org/licenses/">Licenses</a> |
| <a class="navbar-item" href="https://www.apache.org/security/">Security</a> |
| <a class="navbar-item" href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a> |
| <a class="navbar-item" href="https://www.apache.org/foundation/thanks.html">Thanks</a> |
| <hr class="navbar-divider"/> |
| <a class="navbar-item" href="https://whimsy.apache.org/board/minutes/Isis.html">PMC board minutes</a> |
| </div> |
| </div> |
| <a class="navbar-item" href="../../docs/2.0.0-M5/about.html"> |
| <span class="icon"> |
| <img src="../../_/img/home.png"></img> |
| </span> |
| </a> |
| </div> |
| </div> |
| </nav> |
| </header> |
| <div class="body "> |
| <div class="nav-container" data-component="vro" data-version="2.0.0-M5"> |
| <aside class="nav"> |
| <div class="panels"> |
| <div class="nav-panel-pagination"> |
| <a class="page-previous" rel="prev" href="security.html" title="Security"><span></span></a> |
| <a class="page-next" rel="next" |
| href="hints-and-tips.html" title="Hints-n-Tips"><span></span></a> |
| <!-- |
| page.parent doesn't seem to be set... |
| <a class="page-parent disabled" rel="prev" href="" title="Security"><span></span></a> |
| --> |
| </div> |
| <div class="nav-panel-menu is-active" data-panel="menu"> |
| <nav class="nav-menu"> |
| <h3 class="title"><a href="about.html">REST API (Restful Objects Viewer)</a></h3> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="0"> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="1"> |
| <a class="nav-link" href="setup-and-configuration.html">Setup and Configuration</a> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <a class="nav-link" href="ro-spec.html">RO Spec</a> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <a class="nav-link" href="content-negotiation.html">Content Negotiation</a> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="content-negotiation/apache-isis-v2-profile.html">Apache Isis v2 Profile</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="content-negotiation/other-representations.html">Other Representations</a> |
| </li> |
| </ul> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <a class="nav-link" href="security.html">Security</a> |
| </li> |
| <li class="nav-item is-current-page" data-depth="1"> |
| <a class="nav-link" href="layout-resources.html">Layout Resources</a> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <a class="nav-link" href="hints-and-tips.html">Hints-n-Tips</a> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <span class="nav-text">Extensions</span> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="cors/about.html">CORS</a> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </nav> |
| </div> |
| <div class="nav-panel-explore" data-panel="explore"> |
| <div class="context"> |
| <span class="title">REST API (Restful Objects Viewer)</span> |
| <span class="version">2.0.0-M5</span> |
| </div> |
| <ul class="components"> |
| <li class="component"> |
| <span class="title"> </span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../docs/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">BC Mapping Libraries</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../mappings/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Committers' Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../comguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Contributors' Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../conguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Design Docs</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../core/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Extensions Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../extensions/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Incubator Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../incubator/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">JDO/DataNucleus</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../pjdo/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">JPA</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../pjpa/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Legacy Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../legacy/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Reference Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../refguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Release Notes</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../relnotes/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component is-current"> |
| <span class="title">REST API (Restful Objects Viewer)</span> |
| <ul class="versions"> |
| <li class="version is-current is-latest"> |
| <a href="about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Security Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../security/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Setup Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../setupguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Subdomains Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../subdomains/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Testing Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../testing/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Tooling</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../tooling/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">User Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../userguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Value Types Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../valuetypes/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Web UI (Wicket Viewer)</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../vw/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </aside> |
| </div> |
| <main role="main"> |
| <div class="toolbar" role="navigation"> |
| <button class="nav-toggle"></button> |
| <a href="../../docs/2.0.0-M5/about.html" class="home-link"></a> |
| <nav class="breadcrumbs" aria-label="breadcrumbs"> |
| <ul> |
| <li><a href="about.html">REST API (Restful Objects Viewer)</a></li> |
| <li><a href="layout-resources.html">Layout Resources</a></li> |
| </ul> |
| </nav> |
| <div class="edit-this-page"><a href="https://github.com/apache/isis/edit/2.0.0-M5/viewers/restfulobjects/adoc/modules/ROOT/pages/layout-resources.adoc">Edit</a></div> |
| </div> |
| <article class="doc"> |
| <a name="section-top"></a> |
| <h1 class="page">Layout Resources</h1> |
| <div id="preamble"> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>Apache Isis' Restful Objects viewer provides a number of additional resource endpoints (not defined in the <a href="ro-spec.html" class="page">RO spec</a>) that provide representations of the object layout (as per <a href="../../refguide/2.0.0-M5/applib/index/services/grid/GridService.html" class="page">GridService</a>) and of the menu layout (as per <a href="../../refguide/2.0.0-M5/applib/index/services/menu/MenuBarsService.html" class="page">MenuBarsService</a>).</p> |
| </div> |
| <div class="paragraph"> |
| <p>This chapter provides details of these resources, the link <code>Rel</code>s to access them, and the resultant representations.</p> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="menubars"><a class="anchor" href="#menubars"></a>MenuBars</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <a href="../../refguide/2.0.0-M5/applib/index/services/menu/MenuBarsService.html" class="page">MenuBarsService</a> provides the <code>menu.layout.xml</code> XML document which defines how to group the various domain service actions into menubars, menus and menu sections.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example, the <a href="../../docs/2.0.0-M5/starters/helloworld.html" class="page">Hello World starter app</a> has the following layout:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><mb3:menuBars |
| xsi:schemaLocation="..." |
| xmlns:cpt="http://isis.apache.org/applib/layout/component" |
| xmlns:lnk="http://isis.apache.org/applib/layout/links" |
| xmlns:mb3="http://isis.apache.org/applib/layout/menubars/bootstrap3" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| <mb3:primary> |
| <mb3:menu> |
| <mb3:named>Hello World Objects</mb3:named> |
| <mb3:section> |
| <mb3:serviceAction objectType="helloworld.HelloWorldObjects" id="create"> |
| <cpt:named>Create</cpt:named> |
| </mb3:serviceAction> |
| ... |
| </mb3:section> |
| </mb3:menu> |
| <mb3:menu unreferencedActions="true"> |
| <mb3:named>Other</mb3:named> |
| </mb3:menu> |
| ... |
| </mb3:primary> |
| <mb3:secondary> |
| ... |
| </mb3:secondary> |
| <mb3:tertiary> |
| ... |
| </mb3:tertiary> |
| </mb3:menuBars></code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>Note that exactly one <code><mb3:menu></code> must have the <code>unreferencedActions</code> flag set. |
| Any service actions that are not explicitly listed will be added to this menu.</p> |
| </div> |
| <div class="paragraph"> |
| <p>The representation returned by home page resource (<a href="https://www.restfulobjects.org/spec/1.0/section-b/chapter-05.html#5.2-representation">section 5.2 of the RO spec v1.0</a>) has been extended to provide a link to this resource:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-javascript hljs" data-lang="javascript">{ |
| "links": [ |
| ... |
| { |
| "rel": "urn:org.apache.isis.restfulobjects:rels/menuBars", |
| "href": "http://localhost:8080/restful/menuBars", |
| "method": "GET", |
| "type": "application/json;profile='urn:org.restfulobjects:repr-types/layout-menubars'" |
| }, |
| ], |
| ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>The representation returned by the <code>/menuBars</code> resource (assuming an HTTP header of <code>Accept: application/xml</code>) is a superset of the <code>menu.layout.xml</code>; each action also includes a <code>link</code> to the corresponding Restful Objects resource:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><mb3:serviceAction objectType="helloworld.HelloWorldObjects" id="create"> |
| <cpt:named>Create</cpt:named> |
| <cpt:link> |
| <lnk:rel>urn:org.restfulobjects:rels/action</lnk:rel> |
| <lnk:method>GET</lnk:method> |
| <lnk:href> |
| http://localhost:8080/restful/objects/helloworld.HelloWorldObjects/1/actions/create |
| </lnk:href> |
| <lnk:type> |
| application/json;profile="urn:org.restfulobjects:repr-types/object-action" |
| </lnk:type> |
| </cpt:link> |
| </mb3:serviceAction></code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>This can also be obtained in JSON format in the usual way (by specifying an HTTP header of <code>Accept: application/json</code>):</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-json hljs" data-lang="json">"serviceAction": [ |
| { |
| "objectType": "helloworld.HelloWorldObjects", |
| "id": "create", |
| "named": "Create", |
| "link": { |
| "rel": "urn:org.restfulobjects:rels/action", |
| "method": "GET", |
| "href": "http://localhost:8080/restful/objects/helloworld.HelloWorldObjects/1/actions/create", |
| "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"" |
| } |
| }</code></pre> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="domain-object-icon"><a class="anchor" href="#domain-object-icon"></a>Domain Object Icon</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The representation returned by the domain object resource (<a href="https://www.restfulobjects.org/spec/1.0/section-c/chapter-14.html#14.4-representation">section 14.4</a> of the RO spec v1.0) has been extended to provide a link to the icon image (<code>.png</code>) to use:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-javascript hljs" data-lang="javascript">{ |
| "links": [ |
| ... |
| { |
| "rel": "urn:org.apache.isis.restfulobjects:rels/object-layout", |
| "href": "http://localhost:8080/restful/objects/helloworld.HelloWorldObject/0/object-icon", |
| "method": "GET", |
| "type": "image/png", |
| }, |
| ], |
| ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>Note that because of dynamic icons (the |
| <a href="../../refguide/2.0.0-M5/applib-methods/ui-hints.html#iconName" class="page">iconName()</a> supporting method) the image returned can vary on an instance-by-instance basis.</p> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="domain-object-layout"><a class="anchor" href="#domain-object-layout"></a>Domain Object Layout</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <a href="../../refguide/2.0.0-M5/applib/index/services/grid/GridService.html" class="page">GridService</a> provides an XML document which defines the layout of any of domain object. |
| Typically this is the contents of the <code>Xxx.layout.xml</code> file (where <code>Xxx</code> is the domain type).</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example, in the <a href="../../docs/2.0.0-M5/starters/helloworld.html" class="page">Hello World starter app</a> the <code>HelloWorld</code> domain object has a layout defined by <code>HelloWorld.layout.xml</code>.</p> |
| </div> |
| <div class="paragraph"> |
| <p>The representation returned by the domain object resource (<a href="https://www.restfulobjects.org/spec/1.0/section-c/chapter-14.html#14.4-representation">section 14.4</a> of the RO spec v1.0) has been extended to provide a link to this resource:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-javascript hljs" data-lang="javascript">{ |
| "links": [ |
| ... |
| { |
| "rel": "urn:org.apache.isis.restfulobjects:rels/object-layout", |
| "href": "http://localhost:8080/restful/objects/helloworld.HelloWorldObject/0/object-layout", |
| "method": "GET", |
| "type": "application/json;profile='urn:org.restfulobjects:repr-types/object-layout-bs3'", |
| }, |
| ], |
| ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>In a similar way to the <code>menu.layout.xml</code>, the representations is supplemented with <code>link</code>s nodes that link back to the standard Restful Objects resources:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><code>domainObject</code></p> |
| </li> |
| <li> |
| <p><code>property</code></p> |
| </li> |
| <li> |
| <p><code>collection</code></p> |
| </li> |
| <li> |
| <p><code>action</code></p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>For example, the layout for a "HelloWorldObject" instance in the hello world starter app (with <code>Accept: appication/xml</code> HTTP header) is:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
| <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor |
| license agreements. See the NOTICE file distributed with this work for additional |
| information regarding copyright ownership. The ASF licenses this file to |
| you under the Apache License, Version 2.0 (the "License"); you may not use |
| this file except in compliance with the License. You may obtain a copy of |
| the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required |
| by applicable law or agreed to in writing, software distributed under the |
| License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS |
| OF ANY KIND, either express or implied. See the License for the specific |
| language governing permissions and limitations under the License. --> |
| <bs3:grid xmlns:cpt="http://isis.apache.org/applib/layout/component" |
| xmlns:lnk="http://isis.apache.org/applib/layout/links" |
| xmlns:bs3="http://isis.apache.org/applib/layout/grid/bootstrap3"> |
| <bs3:row> |
| <bs3:col span="12" unreferencedActions="true"> |
| <cpt:domainObject bookmarking="AS_ROOT"> |
| <cpt:link> |
| <lnk:rel>urn:org.restfulobjects:rels/element</lnk:rel> |
| <lnk:method>GET</lnk:method> |
| <lnk:href>http://localhost:8080/restful/objects/helloworld.HelloWorldObject/0</lnk:href> |
| <lnk:type>application/json;profile="urn:org.restfulobjects:repr-types/object"</lnk:type> |
| </cpt:link> |
| </cpt:domainObject> |
| </bs3:col> |
| </bs3:row> |
| ... |
| </bs3:grid></code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>This can also be obtained as JSON (using <code>Accept: application/json</code> HTTP header):</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-javascript hljs" data-lang="javascript">{ |
| "row": [ |
| { |
| "cols": [ |
| { |
| "col": { |
| "domainObject": { |
| "link": { |
| "rel": "urn:org.restfulobjects:rels/element", |
| "method": "GET", |
| "href": "http://localhost:8080/restful/objects/helloworld.HelloWorldObject/0", |
| "type": "application/json;profile='urn:org.restfulobjects:repr-types/object'" |
| }, |
| "bookmarking": "AS_ROOT", |
| }, |
| "span": 12, |
| "unreferencedActions": true |
| } |
| } |
| ] |
| } |
| ... |
| ] |
| }</code></pre> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="domain-type-layout"><a class="anchor" href="#domain-type-layout"></a>Domain Type Layout</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The representation of the domain types resource (<a href="https://www.restfulobjects.org/spec/1.0/section-d/chapter-22.html#22.2-representation">section 22.2</a> of RO spec v1.0) has also been extended to return the (type) layout:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-javascript hljs" data-lang="javascript">{ |
| "links": [ |
| ... |
| { |
| "rel": "urn:org.apache.isis.restfulobjects:rels/layout", |
| "href": "http://localhost:8080/restful/domain-types/helloworld.HelloWorldObject/layout", |
| "method": "GET", |
| "type": "application/json;profile='urn:org.restfulobjects:repr-types/layout-bs3'" |
| } |
| ], |
| ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>The representation returned by this resource is essentially exactly the same as the layout returned by <a href="../../refguide/2.0.0-M5/applib/index/services/grid/GridService.html" class="page">GridService</a> (it is not dynamically extended with links).</p> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="static-vs-dynamic-resources"><a class="anchor" href="#static-vs-dynamic-resources"></a>Static vs Dynamic Resources</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <a href="#menu-layout">menu layout</a> representation includes all possible domain services; it does not follow that the current user has access to all of these actions (some may be hidden or disabled).</p> |
| </div> |
| <div class="paragraph"> |
| <p>Similarly, the <a href="#domain-object-layout">domain object layout</a> representation include all <em>possible</em> properties, collections and actions of the domain object; again, the current user may not have access to all of these members. |
| It is also often the case that the domain object’s internal state will determine which members to make available (eg, show only one of "lock" and "unlock" actions at any given time).</p> |
| </div> |
| <div class="paragraph"> |
| <p>To determine what should actually be rendered, the REST client should follow the links to the standard Restful Objects resources.</p> |
| </div> |
| </div> |
| </div> |
| </article> |
| <aside class="article-aside toc hide-for-print" role="navigation"> |
| <p class="toc-title">On this page</p> |
| <div id="article-toc"></div> |
| </aside> |
| </main> |
| </div> |
| <footer class="footer"> |
| <div class="content"> |
| <div class="copyright"> |
| <p> |
| Copyright © 2010~2021 The Apache Software Foundation, licensed under the Apache License, v2.0. |
| <br/> |
| Apache, the Apache feather logo, Apache Isis, and the Apache Isis project logo are all trademarks of The Apache Software Foundation. |
| </p> |
| </div> |
| <div class="revision"> |
| <p>Revision: 2.0.0-M5.20210409-1206</p> |
| </div> |
| </div> |
| </footer> |
| <script src="../../_/js/site.js"></script> |
| <script async src="../../_/js/vendor/highlight.js"></script> |
| <script src="../../_/js/vendor/jquery-3.4.1.min.js"></script> |
| <script src="../../_/js/vendor/jquery-ui-1.12.1.custom.widget-only.min.js"></script> |
| <script src="../../_/js/vendor/jquery.tocify.min.js"></script> |
| |
| <script> |
| $(function() { |
| $("#article-toc").tocify( { |
| showEffect: "slideDown", |
| hashGenerator: "pretty", |
| hideEffect: "slideUp", |
| selectors: "h2, h3", |
| scrollTo: 120, |
| smoothScroll: true, |
| theme: "jqueryui", |
| highlightOnScroll: true |
| } ); |
| }); |
| </script> |
| |
| <script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script> |
| <script> |
| function focusSearchInput () { document.querySelector('#algolia-search-input').focus() } |
| var search = docsearch({ |
| appId: '5ISP5TFAEN', |
| apiKey: '0fc51c28b4ad46e7318e96d4e97fab7c', |
| indexName: 'isis-apache-org', |
| inputSelector: '#algolia-search-input', |
| autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] }, |
| debug: false, |
| }).autocomplete |
| search.on('autocomplete:closed', function () { search.autocomplete.setVal() }) |
| focusSearchInput() |
| window.addEventListener('load', focusSearchInput); |
| </script> |
| |
| <!-- |
| docsearch options: |
| https://docsearch.algolia.com/docs/behavior/ |
| --> |
| <!-- |
| https://www.algolia.com/doc/api-reference/api-parameters/ |
| algoliaOptions: { hitsPerPage: 6 }, |
| --> |
| </body> |
| </html> |