You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/12/18 10:22:45 UTC
[2/2] isis-site git commit: ISIS-1237 docs and migration guide
ISIS-1237 docs and migration guide
Project: http://git-wip-us.apache.org/repos/asf/isis-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis-site/commit/524735aa
Tree: http://git-wip-us.apache.org/repos/asf/isis-site/tree/524735aa
Diff: http://git-wip-us.apache.org/repos/asf/isis-site/diff/524735aa
Branch: refs/heads/asf-site
Commit: 524735aa828c00fa78fa9d351a18b3452383befc
Parents: d2df3da
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Dec 18 09:20:49 2015 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri Dec 18 09:20:49 2015 +0000
----------------------------------------------------------------------
content/guides/ugbtb.html | 5 +++-
content/guides/ugsec.html | 15 ++++++----
content/guides/ugvro.html | 37 ++++++++++++++++-------
content/migration-notes.html | 62 ++++++++++++++++++++++++++++++++-------
4 files changed, 91 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis-site/blob/524735aa/content/guides/ugbtb.html
----------------------------------------------------------------------
diff --git a/content/guides/ugbtb.html b/content/guides/ugbtb.html
index 9d918a6..381a669 100644
--- a/content/guides/ugbtb.html
+++ b/content/guides/ugbtb.html
@@ -4490,7 +4490,7 @@ re-propagates the exception. The use case is simply to ensure that all exception
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
-<td>what the servlet should do if no existing session was found. Usual values are either <code>unauthorized</code> or <code>basicAuthChallenge</code>. Discussed in more detail below.</td>
+<td>what the servlet should do if no existing session was found. Usual values are either <code>unauthorized</code>, <code>basicAuthChallenge</code> or <code>auto</code> (<code>1.11.0-SNAPSHOT</code>). Discussed in more detail below.</td>
</tr>
<tr>
<td><i class="conum" data-value="3"></i><b>3</b></td>
@@ -4518,6 +4518,9 @@ re-propagates the exception. The use case is simply to ensure that all exception
<p><code>basicAuthChallenge</code> will also generate a 401 response, and also issues a Basic Auth challenge using <code>WWW-Authenticate</code> response header</p>
</li>
<li>
+<p><code>auto</code> (<code>1.11.0-SNAPSHOT</code>) combines the <code>unauthorized</code> and <code>basicAuthChallenge</code> strategies: it will generate a 401 response, but only issues a Basic Auth challenge if it detects that the request originates from a web browser (ie that the HTTP <code>Accept</code> header is set to <code>text/html</code>). This means that custom Javascript apps can perform their authentication correctly, while the REST API can still be explored using the web browser (relying upon the web browser’s in-built support for HTTP Basic Auth).</p>
+</li>
+<li>
<p><code>continue</code>, in which case the request is allowed to continue but the destination expected to know that there will be no open session</p>
</li>
<li>
http://git-wip-us.apache.org/repos/asf/isis-site/blob/524735aa/content/guides/ugsec.html
----------------------------------------------------------------------
diff --git a/content/guides/ugsec.html b/content/guides/ugsec.html
index 10c85dc..a1af572 100644
--- a/content/guides/ugsec.html
+++ b/content/guides/ugsec.html
@@ -1737,7 +1737,11 @@ public <span class="type">interface</span> <span class="class">AuthenticationSes
<span class="tag"></init-param></span>
<span class="tag"><init-param></span>
<span class="tag"><param-name></span>whenNoSession<span class="tag"></param-name></span>
- <span class="tag"><param-value></span>basicAuthChallenge<span class="tag"></param-value></span> <i class="conum" data-value="2"></i><b>(2)</b>
+ <span class="tag"><param-value></span>auto<span class="tag"></param-value></span> <i class="conum" data-value="2"></i><b>(2)</b>
+ <span class="tag"></init-param></span>
+ <span class="tag"><init-param></span>
+ <span class="tag"><param-name></span>passThru<span class="tag"></param-name></span>
+ <span class="tag"><param-value></span>/restful/swagger<span class="tag"></param-value></span> <i class="conum" data-value="3"></i><b>(3)</b>
<span class="tag"></init-param></span>
<span class="tag"></filter></span></code></pre>
</div>
@@ -1750,14 +1754,15 @@ public <span class="type">interface</span> <span class="class">AuthenticationSes
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
-<td>what to do if no session was found; we indicate to issue a 401 basic authentication challenge</td>
+<td>what to do if no session was found; we use <code>auto</code> (<code>1.11.0-SNAPSHOT</code>) so as to issue a 401 status code with basic authentication challenge if the request originated from a web browser. (Prior to <code>1.11.0-SNAPSHOT</code> this parameter was set either to <code>basicAuthChallenge</code> (which works when requested from web browser) or to <code>unauthorized</code> (which works when requested from a suitably coded custom Javascript app).</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="3"></i><b>3</b></td>
+<td>(<code>1.11.0-SNAPSHOT</code>) which paths are allowed to be accessed directly, without a session. The <code>/restful/swagger</code> path provides access to the SwaggerResource that dynamically generates swagger spec files from the Apache Isis metamodel.</td>
</tr>
</table>
</div>
<div class="paragraph">
-<p>The <code>IsisSessionFilter</code> has a further plugin point if no session was found (that is, if <code>AuthenticationSessionStrategy#lookupValid()</code> returns null), which is how to respond. The value "basicAuthChallenge" means to return a 401, which is what triggers the web browser to pop-up the basic HTTP challenge dialog box.</p>
-</div>
-<div class="paragraph">
<p>The above filter must then be chained before the servlet that actually handles the REST requests:</p>
</div>
<div class="listingblock">
http://git-wip-us.apache.org/repos/asf/isis-site/blob/524735aa/content/guides/ugvro.html
----------------------------------------------------------------------
diff --git a/content/guides/ugvro.html b/content/guides/ugvro.html
index 86d04b2..1a0f430 100644
--- a/content/guides/ugvro.html
+++ b/content/guides/ugvro.html
@@ -1034,21 +1034,24 @@ this resource:</p>
<div class="content">
<pre class="CodeRay highlight"><code>{
"$$href" : "http://localhost:8080/restful/objects/TODO/45", <i class="conum" data-value="1"></i><b>(1)</b>
- "$$title" : "Buy bread due by 2015-12-04", <i class="conum" data-value="2"></i><b>(2)</b>
- "description" : "Buy bread", <i class="conum" data-value="3"></i><b>(3)</b>
+ "$$instanceId" : "45", <i class="conum" data-value="2"></i><b>(2)</b>
+ "$$title" : "Buy bread due by 2015-12-04", <i class="conum" data-value="3"></i><b>(3)</b>
+ "description" : "Buy bread", <i class="conum" data-value="4"></i><b>(4)</b>
"category" : "Domestic",
"subcategory" : "Shopping",
"complete" : false,
"atPath" : "/users/sven",
...
- "similarTo" : [ { <i class="conum" data-value="4"></i><b>(4)</b>
+ "similarTo" : [ { <i class="conum" data-value="5"></i><b>(5)</b>
"$$href" : "http://localhost:8080/restful/objects/TODO/46",
+ "$$instanceId" : "46",
"$$title" : "Buy milk due by 2015-12-04",
"description" : "Buy milk",
"category" : "Domestic",
...
}, {
"$$href" : "http://localhost:8080/restful/objects/TODO/47",
+ "$$instanceId" : "47",
"$$title" : "Buy stamps due by 2015-12-04",
"description" : "Buy stamps",
"category" : "Domestic",
@@ -1076,18 +1079,22 @@ this resource:</p>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
-<td>title of the domain object</td>
+<td>instance id of the domain object (unique within its type)</td>
</tr>
<tr>
<td><i class="conum" data-value="3"></i><b>3</b></td>
-<td>all the properties of the domain object (to which the caller has access), as key/value pairs</td>
+<td>title of the domain object</td>
</tr>
<tr>
<td><i class="conum" data-value="4"></i><b>4</b></td>
-<td>contents of each collection</td>
+<td>all the properties of the domain object (to which the caller has access), as key/value pairs</td>
</tr>
<tr>
<td><i class="conum" data-value="5"></i><b>5</b></td>
+<td>contents of each collection</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="6"></i><b>6</b></td>
<td>special <code>$$ro</code> json-prop, being the normal RO Spec representation for this object</td>
</tr>
</table>
@@ -1138,8 +1145,9 @@ this resource:</p>
<pre class="CodeRay highlight"><code>[ <i class="conum" data-value="1"></i><b>(1)</b>
{
"$$href" : "http://localhost:8080/restful/objects/TODO/46", <i class="conum" data-value="2"></i><b>(2)</b>
- "$$title" : "Buy milk due by 2015-12-04", <i class="conum" data-value="3"></i><b>(3)</b>
- "description" : "Buy milk", <i class="conum" data-value="4"></i><b>(4)</b>
+ "$$instanceId" : "46", <i class="conum" data-value="3"></i><b>(3)</b>
+ "$$title" : "Buy milk due by 2015-12-04", <i class="conum" data-value="4"></i><b>(4)</b>
+ "description" : "Buy milk", <i class="conum" data-value="5"></i><b>(5)</b>
"category" : "Domestic",
...
}, {
@@ -1157,7 +1165,7 @@ this resource:</p>
},
...
, {
- "$$ro" : { <i class="conum" data-value="5"></i><b>(5)</b>
+ "$$ro" : { <i class="conum" data-value="6"></i><b>(6)</b>
"id" : "similarTo",
"memberType" : "collection",
"links" : [ ... ],
@@ -1180,14 +1188,18 @@ this resource:</p>
</tr>
<tr>
<td><i class="conum" data-value="3"></i><b>3</b></td>
-<td>title of the domain object</td>
+<td>instance id of the domain object (unique within its type)</td>
</tr>
<tr>
<td><i class="conum" data-value="4"></i><b>4</b></td>
-<td>all the properties of the domain object (to which the caller has access), as key/value pairs</td>
+<td>title of the domain object</td>
</tr>
<tr>
<td><i class="conum" data-value="5"></i><b>5</b></td>
+<td>all the properties of the domain object (to which the caller has access), as key/value pairs</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="6"></i><b>6</b></td>
<td>last element is a special object with a single <code>$$ro</code> json-prop, being the normal RO Spec representation for this object</td>
</tr>
</table>
@@ -1236,6 +1248,7 @@ this resource:</p>
<div class="content">
<pre class="CodeRay highlight"><code>{
"$$href" : "http://localhost:8080/restful/objects/TODO/45",
+ "$$instanceId" : "45",
"$$title" : "Buy bread due by 2015-12-04",
"description" : "Buy bread",
"category" : "Domestic",
@@ -1292,12 +1305,14 @@ this resource:</p>
<div class="content">
<pre class="CodeRay highlight"><code>[ {
"$$href" : "http://localhost:8080/restful/objects/TODO/45",
+ "$$instanceId" : "45",
"$$title" : "Buy bread due by 2015-12-04",
"description" : "Buy bread",
"category" : "Domestic",
...
}, {
"$$href" : "http://localhost:8080/restful/objects/TODO/46",
+ "$$instanceId" : "46",
"$$title" : "Buy milk due by 2015-12-04",
"description" : "Buy milk",
"category" : "Domestic",
http://git-wip-us.apache.org/repos/asf/isis-site/blob/524735aa/content/migration-notes.html
----------------------------------------------------------------------
diff --git a/content/migration-notes.html b/content/migration-notes.html
index 35fd272..99be469 100644
--- a/content/migration-notes.html
+++ b/content/migration-notes.html
@@ -543,30 +543,41 @@ issues here.</p>
<div class="sect2">
<h3 id="_jaxb_view_models">JAXB view models</h3>
<div class="paragraph">
-<p>This version recognizes classes annotated with <a href="rgant.html#_rgant-XmlRootElement"><code>@XmlRootElement</code></a>
+<p>Classes annotated with <a href="guides/rgant.html#_rgant-XmlRootElement"><code>@XmlRootElement</code></a> are now recognized
as view models. These are serialized out into XML and converted into URL.</p>
</div>
<div class="paragraph">
-<p>The <a href="rgsvc.html#_rgsvc-api_JaxbService"><code>JaxbService</code></a> is responsible for performing the XML conversion.
+<p>The <a href="guides/rgsvc.html#_rgsvc-api_JaxbService"><code>JaxbService</code></a> is responsible for performing the XML conversion.
The default implementation is located in the <code>org.apache.isis.core:isis-core-schema</code> module, specifically under the
<code>org.apache.isis.core.schema.services</code> package.</p>
</div>
<div class="paragraph">
-<p>If your application is bootstrapped using an <code>AppManifest</code> (recommended; ee
-<a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">here</a>) then the <code>JaxbService</code> will automatically be discovered and
+<p>If your application is bootstrapped using an <code>AppManifest</code> (recommended;
+<a href="guides/rgcms.html#_rgcms_classes_AppManifest-bootstrapping">here</a>) then the <code>JaxbService</code> will automatically be discovered and
registered. However, if you are still using the older <code>isis.properties</code> configuration file to explicitly register
services then you will need to add in this service.</p>
</div>
</div>
<div class="sect2">
-<h3 id="_swagger">Swagger</h3>
+<h3 id="_swagger_ui">Swagger UI</h3>
<div class="paragraph">
-<p>Update the <code>web.xml</code>:</p>
+<p>The new <a href="guides/rgsvc.html#_rgsvc_api_SwaggerService"><code>SwaggerService</code></a> allows <a href="http://swagger.io">Swagger</a> spec files
+to be generated from the Apache Isis metamodel. These can be downloaded directly through the <code>SwaggerResource</code>
+(mapped to <code>/restful/swagger/public</code> and <code>/restful/swagger/private</code>) as well as from the Wicket UI through the
+<code>SwaggerServiceMenu</code>.</p>
+</div>
+<div class="paragraph">
+<p>In addition, the <a href="guides/ugfun.html#_ugfun_getting-started_simpleapp-archetype">SimpleApp archetype</a> now bundles
+ <a href="https://github.com/swagger-api/swagger-ui">Swagger UI</a>, which documents the main features of the REST API and
+ allows it to be explored.</p>
+</div>
+<div class="paragraph">
+<p>To enable this in your application, first update the <code>web.xml</code>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="xml"><span class="tag"><servlet></span>
- <span class="tag"><servlet-name></span>WebjarsServlet<span class="tag"></servlet-name></span>
+ <span class="tag"><servlet-name></span>WebjarsServlet<span class="tag"></servlet-name></span> <i class="conum" data-value="1"></i><b>(1)</b>
<span class="tag"><servlet-class></span>org.webjars.servlet.WebjarsServlet<span class="tag"></servlet-class></span>
<span class="tag"><init-param></span>
<span class="tag"><param-name></span>disableCache<span class="tag"></param-name></span>
@@ -577,14 +588,43 @@ The default implementation is located in the <code>org.apache.isis.core:isis-cor
<span class="tag"><servlet-mapping></span>
<span class="tag"><servlet-name></span>WebjarsServlet<span class="tag"></servlet-name></span>
<span class="tag"><url-pattern></span>/webjars/*<span class="tag"></url-pattern></span>
-<span class="tag"></servlet-mapping></span></code></pre>
+<span class="tag"></servlet-mapping></span>
+...
+<span class="tag"><filter></span>
+ <span class="tag"><filter-name></span>IsisSessionFilterForRestfulObjects<span class="tag"></filter-name></span>
+ ...
+ <span class="tag"><init-param></span>
+ <span class="tag"><param-name></span>whenNoSession<span class="tag"></param-name></span>
+ <span class="tag"><param-value></span>auto<span class="tag"></param-value></span> <i class="conum" data-value="2"></i><b>(2)</b>
+ <span class="tag"></init-param></span>
+ <span class="tag"><init-param></span>
+ <span class="tag"><param-name></span>passThru<span class="tag"></param-name></span> <i class="conum" data-value="3"></i><b>(3)</b>
+ <span class="tag"><param-value></span>/restful/swagger<span class="tag"></param-value></span>
+ <span class="tag"></init-param></span>
+<span class="tag"></filter></span></code></pre>
+</div>
</div>
+<div class="colist arabic">
+<table>
+<tr>
+<td><i class="conum" data-value="1"></i><b>1</b></td>
+<td>provides access to the Swagger UI (packaged as a webjar)</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="2"></i><b>2</b></td>
+<td>issues a 401 status, but with the <code>WWW-Authenticate</code> challenge suppressed if requested from the Swagger UI</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="3"></i><b>3</b></td>
+<td>provides access to the RESTful resource that generates the Swagger spec.</td>
+</tr>
+</table>
</div>
<div class="paragraph">
-<p>There is also an page to load the Swagger UI; this resides in <code>src/main/webapp/swagger-ui/index.html</code>. Copy the index page from the app generated by the <a href="ugfun.html#_ugfun_getting-started_simpleapp-archetype">SimpleApp archetype</a>.</p>
+<p>There is also an HTML page to load the Swagger UI itself; this resides in <code>src/main/webapp/swagger-ui/index.html</code>. Copy the <a href="https://github.com/apache/isis/blob/master/example/application/simpleapp/webapp/src/main/webapp/swagger-ui/index.html">file from Apache Isis' repo</a>, or from the app generated by the <a href="guides/ugfun.html#_ugfun_getting-started_simpleapp-archetype">SimpleApp archetype</a>.</p>
</div>
<div class="paragraph">
-<p>The text of the simple app’s <code>about/index.html</code> has also changed (the <code><li</code>> for the <code>/restful</code> URL has been replaced with a <code>/swagger-ui</code> URL). If you use this file, then update it.</p>
+<p>The text of the simple app’s <code>about/index.html</code> has also changed (the <code><li</code>> for the <code>/restful</code> URL has been replaced with a <code>/swagger-ui</code> URL). If you use <a href="https://github.com/apache/isis/blob/master/example/application/simpleapp/webapp/src/main/webapp/about/index.html">this file</a>, then update it.</p>
</div>
</div>
</div>
@@ -1948,7 +1988,7 @@ into the new <code>org.isisaddons.module.settings:isis-module-settings-dom</code
<li><a href="#_migration-notes_1.10.0-to-1.11.0">From v1.10.0 to 1.11.0</a>
<ul class="sectlevel2">
<li><a href="#_jaxb_view_models">JAXB view models</a></li>
-<li><a href="#_swagger">Swagger</a></li>
+<li><a href="#_swagger_ui">Swagger UI</a></li>
</ul>
</li>
<li><a href="#_migration-notes_1.9.0-to-1.10.0">From v1.9.0 to 1.10.0</a>