Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d248c5

Browse files
authored
Promise cleanup (#241)
* `bs2:ExternalBar` templates* External navbar templates* External nav bar promise* Getting rid of `ldh:DocumentLoaded` named template* `bs2:MediaTypeList` link fixes* Removed `bs2:ExternalBar`Removed `Link rel=ldt:base` support from `ResponseHeadersFilter`* `bs2:MediaTypeList` URI fix* Restored Save As button* Removed external navbar's client-side* Document subject slug fixes* Removed `ldh:DocumentLoaded` named templateTunneling `$action` params
1 parentfdb08b5 commit6d248c5

File tree

15 files changed

+287
-233
lines changed

15 files changed

+287
-233
lines changed

‎src/main/java/com/atomgraph/linkeddatahub/server/filter/response/ResponseHeadersFilter.java‎

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
importcom.atomgraph.linkeddatahub.apps.model.Application;
2424
importcom.atomgraph.linkeddatahub.apps.model.Dataset;
2525
importcom.atomgraph.linkeddatahub.model.auth.Agent;
26+
importcom.atomgraph.linkeddatahub.server.model.impl.Dispatcher;
2627
importcom.atomgraph.linkeddatahub.server.security.AuthorizationContext;
2728
importcom.atomgraph.linkeddatahub.vocabulary.ACL;
2829
importjava.io.IOException;
@@ -77,27 +78,17 @@ public void filter(ContainerRequestContext request, ContainerResponseContext res
7778
List<Object>linkValues =response.getHeaders().get(HttpHeaders.LINK);
7879
List<Link>links =parseLinkHeaderValues(linkValues);
7980

80-
// check whether Link rel=ldt:base is not already set. Link headers might be forwarded by ProxyResourceBase
81-
if (getLinksByRel(links,LDT.base.getURI()).isEmpty())
82-
{
83-
// add Link rel=ldt:base
84-
response.getHeaders().add(HttpHeaders.LINK,newLink(getApplication().getBaseURI(),LDT.base.getURI(),null));
81+
if (getLinksByRel(links,SD.endpoint.getURI()).isEmpty())
8582
// add Link rel=sd:endpoint.
8683
// TO-DO: The external SPARQL endpoint URL is different from the internal one currently specified as sd:endpoint in the context dataset
87-
response.getHeaders().add(HttpHeaders.LINK,newLink(request.getUriInfo().getBaseUriBuilder().path("sparql").build(),SD.endpoint.getURI(),null));
88-
// add Link rel=ldt:ontology, if the ontology URI is specified
89-
if (getApplication().getOntology() !=null)
90-
response.getHeaders().add(HttpHeaders.LINK,newLink(URI.create(getApplication().getOntology().getURI()),LDT.ontology.getURI(),null));
91-
// add Link rel=ac:stylesheet, if the stylesheet URI is specified
92-
if (getApplication().getStylesheet() !=null)
93-
response.getHeaders().add(HttpHeaders.LINK,newLink(URI.create(getApplication().getStylesheet().getURI()),AC.stylesheet.getURI(),null));
94-
}
95-
else
96-
{
97-
// add Link rel=sd:endpoint.
98-
if (getLinksByRel(links,SD.endpoint.getURI()).isEmpty() &&getDataset().isPresent() &&getDataset().get().getService() !=null)
99-
response.getHeaders().add(HttpHeaders.LINK,newLink(URI.create(getDataset().get().getService().getSPARQLEndpoint().getURI()),SD.endpoint.getURI(),null));
100-
}
84+
response.getHeaders().add(HttpHeaders.LINK,newLink(request.getUriInfo().getBaseUriBuilder().path(Dispatcher.class,"getSPARQLEndpoint").build(),SD.endpoint.getURI(),null));
85+
86+
// add Link rel=ldt:ontology, if the ontology URI is specified
87+
if (getApplication().getOntology() !=null)
88+
response.getHeaders().add(HttpHeaders.LINK,newLink(URI.create(getApplication().getOntology().getURI()),LDT.ontology.getURI(),null));
89+
// add Link rel=ac:stylesheet, if the stylesheet URI is specified
90+
if (getApplication().getStylesheet() !=null)
91+
response.getHeaders().add(HttpHeaders.LINK,newLink(URI.create(getApplication().getStylesheet().getURI()),AC.stylesheet.getURI(),null));
10192

10293
if (response.getHeaders().get(HttpHeaders.LINK) !=null)
10394
{

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/admin/acl/imports/acl.xsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ exclude-result-prefixes="#all">
6464

6565
<xsl:templatematch="*[rdf:type/@rdf:resource = '&lacl;AuthorizationRequest']"priority="1">
6666
<xsl:paramname="method"select="'post'"as="xs:string"/>
67-
<xsl:paramname="action"select="ldh:href(resolve-uri(ac:uuid() || '/', resolve-uri('acl/authorizations/', $ldt:base)), map{ '_method': 'PUT' })"as="xs:anyURI"/><!-- create new authorization document-->
67+
<xsl:paramname="action"select="ldh:href(resolve-uri(ac:uuid() || '/', resolve-uri('acl/authorizations/', $ldt:base)), map{ '_method': 'PUT' })"as="xs:anyURI"tunnel="yes"/><!-- create new authorization document-->
6868
<xsl:paramname="id"select="concat('form-', generate-id())"as="xs:string?"/>
6969
<xsl:paramname="class"select="'form-horizontal'"as="xs:string?"/>
7070
<xsl:paramname="accept-charset"select="'UTF-8'"as="xs:string?"/>

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/admin/layout.xsl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ exclude-result-prefixes="#all">
103103
<xsl:paramname="id"select="concat('form-', generate-id())"as="xs:string?"/>
104104
<xsl:paramname="class"select="'row-fluid'"as="xs:string?"/>
105105
<xsl:paramname="method"select="'patch'"as="xs:string"/>
106-
<xsl:paramname="action"select="ldh:href(ac:build-uri(ac:absolute-path(ldh:base-uri(.)), map{ '_method': 'PUT' }))"as="xs:anyURI"/>
106+
<xsl:paramname="action"select="ldh:href(ac:build-uri(ac:absolute-path(ldh:base-uri(.)), map{ '_method': 'PUT' }))"as="xs:anyURI"tunnel="yes"/>
107107
<xsl:paramname="enctype"select="'multipart/form-data'"as="xs:string?"/>
108108
<xsl:paramname="create-resource"select="true()"as="xs:boolean"/>
109109
<!-- TO-DO: generate ontology classes from the OWL vocabulary-->
@@ -114,7 +114,7 @@ exclude-result-prefixes="#all">
114114
<xsl:with-paramname="id"select="$id"/>
115115
<xsl:with-paramname="class"select="$class"/>
116116
<xsl:with-paramname="method"select="$method"/>
117-
<xsl:with-paramname="action"select="$action"/>
117+
<xsl:with-paramname="action"select="$action"tunnel="yes"/>
118118
<xsl:with-paramname="enctype"select="$enctype"/>
119119
<xsl:with-paramname="create-resource"select="$create-resource"/>
120120
<xsl:with-paramname="classes"select="$classes"/>

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/admin/signup.xsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ exclude-result-prefixes="#all">
7171
<xsl:apply-templatesselect="ldh:construct(map{ xs:anyURI('&foaf;Person'): $constructors//srx:result[srx:binding[@name = 'Type'] = '&foaf;Person']/srx:binding[@name = 'construct']/srx:literal/string() })"mode="bs2:RowForm">
7272
<xsl:with-paramname="id"select="'form-signup'"/>
7373
<xsl:with-paramname="method"select="'post'"/><!-- don't use PATCH which is the default-->
74-
<xsl:with-paramname="action"select="ac:absolute-path(base-uri($main-doc))"/>
74+
<xsl:with-paramname="action"select="ac:absolute-path(base-uri($main-doc))"tunnel="yes"/>
7575
<xsl:with-paramname="enctype"select="()"/><!-- don't use 'multipart/form-data' which is the default-->
7676
<xsl:with-paramname="create-resource"select="false()"/>
7777
<xsl:with-paramname="base-uri"select="ac:absolute-path(base-uri($main-doc))"tunnel="yes"/><!-- base-uri() is empty on constructed documents-->

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/block/chart.xsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ exclude-result-prefixes="#all"
658658
<xsl:apply-templatesselect="$constructed-doc"mode="bs2:RowForm">
659659
<xsl:with-paramname="about"select="()"/><!-- don't set @about on the container until after the resource is saved-->
660660
<xsl:with-paramname="method"select="$method"/>
661-
<xsl:with-paramname="action"select="ldh:href($doc-uri, map{})"as="xs:anyURI"/>
661+
<xsl:with-paramname="action"select="ldh:href($doc-uri, map{})"as="xs:anyURI"tunnel="yes"/>
662662
<xsl:with-paramname="type-metadata"select="$type-metadata"tunnel="yes"/>
663663
<xsl:with-paramname="property-metadata"select="$property-metadata"tunnel="yes"/>
664664
<xsl:with-paramname="constructor"select="$constructed-doc"tunnel="yes"/>

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/block/query.xsl‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ exclude-result-prefixes="#all"
107107

108108
<xsl:templatematch="*[@typeof = ('&sp;Ask', '&sp;Select', '&sp;Describe', '&sp;Construct')][descendant::*[@property = '&sp;text'][pre/text()]]"mode="ldh:RenderRow"as="function(item()?) as map(*)"priority="2"><!-- prioritize above block.xsl-->
109109
<xsl:paramname="block"select="ancestor-or-self::div[contains-token(@class, 'block')][1]"as="element()"/>
110-
<xsl:paramname="about"select="$block/@about"as="xs:anyURI"/>
111-
<xsl:paramname="block-uri"select="$about"as="xs:anyURI"/>
112110
<xsl:paramname="container"select="."as="element()"/>
113111
<xsl:paramname="graph"select="descendant::*[@property = '&ldh;graph']/@resource"as="xs:anyURI?"/>
114112
<xsl:paramname="mode"select="descendant::*[@property = '&ac;mode']/@resource"as="xs:anyURI?"/>
@@ -513,7 +511,7 @@ exclude-result-prefixes="#all"
513511

514512
<ixsl:set-stylename="cursor"select="'progress'"object="ixsl:page()//body"/>
515513

516-
<!-- abort the previous request, if any-->
514+
<!-- abort the previous request, if any
517515
<xsl:if test="ixsl:contains(ixsl:get(ixsl:window(), 'LinkedDataHub'), 'request')">
518516
<xsl:message>Aborting HTTP request that has already been sent</xsl:message>
519517
<xsl:sequence select="ixsl:call(ixsl:get(ixsl:window(), 'LinkedDataHub.request'), 'abort', [])"/>
@@ -527,8 +525,22 @@ exclude-result-prefixes="#all"
527525
</ixsl:schedule-action>
528526
</xsl:variable>
529527
530-
<!-- store the new request object-->
531-
<ixsl:set-propertyname="request"select="$request"object="ixsl:get(ixsl:window(), 'LinkedDataHub')"/>
528+
store the new request object
529+
<ixsl:set-property name="request" select="$request" object="ixsl:get(ixsl:window(), 'LinkedDataHub')"/>-->
530+
531+
<xsl:variablename="request"select="map{ 'method': 'GET', 'href': $href, 'headers': map{ 'Accept': 'application/xhtml+xml' } }"as="map(*)"/>
532+
<xsl:variablename="context"select="
533+
map{
534+
'request': $request,
535+
'href': $href,
536+
'push-state': true()
537+
}"as="map(*)"/>
538+
<ixsl:promiseselect="
539+
ixsl:http-request($context('request'))
540+
=> ixsl:then(ldh:rethread-response($context, ?))
541+
=> ixsl:then(ldh:handle-response#1)
542+
=> ixsl:then(ldh:xhtml-document-loaded#1)
543+
"on-failure="ldh:promise-failure#1"/>
532544
</xsl:otherwise>
533545
</xsl:choose>
534546
</xsl:template>

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/form.xsl‎

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ WHERE
262262
<xsl:templatematch="div[@about]//button[contains-token(@class, 'btn-edit')][not(contains-token(@class, 'disabled'))]"mode="ixsl:onclick">
263263
<xsl:paramname="block"select="ancestor::div[contains-token(@class, 'block')][1]"as="element()"/>
264264
<xsl:paramname="about"select="$block/@about"as="xs:anyURI"/>
265-
<!-- <xsl:param name="graph" as="xs:anyURI?"/>-->
266265

267266
<xsl:sequenceselect="ixsl:call(ixsl:event(), 'preventDefault', [])"/>
268267
<ixsl:set-stylename="cursor"select="'progress'"object="ixsl:page()//body"/>
@@ -328,7 +327,7 @@ WHERE
328327
<xsl:variablename="block"select="id($block-id, ixsl:page())"as="element()"/>
329328

330329
<!-- if the URI is external, dereference it through the proxy-->
331-
<xsl:variablename="request-uri"select="ldh:href(ac:absolute-path(ldh:base-uri(.)), map{})"as="xs:anyURI"/>
330+
<xsl:variablename="request-uri"select="ldh:href($about)"as="xs:anyURI"/>
332331
<xsl:variablename="request"select="map{ 'method': 'GET', 'href': $request-uri, 'headers': map{ 'Accept': 'application/rdf+xml' } }"as="map(*)"/>
333332
<xsl:variablename="context"as="map(*)"select="
334333
map{
@@ -519,7 +518,7 @@ WHERE
519518
<xsl:apply-templatesselect="$document"mode="bs2:Form"><!-- document level template-->
520519
<xsl:with-paramname="about"select="()"/><!-- don't set @about on the container until after the resource is saved-->
521520
<xsl:with-paramname="method"select="$method"/>
522-
<xsl:with-paramname="action"select="$action"/>
521+
<xsl:with-paramname="action"select="$action"tunnel="yes"/>
523522
<xsl:with-paramname="form-actions-class"select="'form-actions modal-footer'"/>
524523
<xsl:with-paramname="classes"select="()"/>
525524
<xsl:with-paramname="type-metadata"select="$type-metadata"tunnel="yes"/>
@@ -980,31 +979,6 @@ WHERE
980979
<ixsl:set-stylename="cursor"select="'default'"object="ixsl:page()//body"/>
981980
</xsl:for-each>
982981
</xsl:function>
983-
984-
<xsl:functionname="ldh:modal-form-submit-success"ixsl:updating="yes">
985-
<xsl:paramname="context"as="map(*)"/>
986-
<xsl:variablename="response"select="$context('response')"as="map(*)"/>
987-
988-
<xsl:message>ldh:modal-form-submit-success</xsl:message>
989-
990-
<xsl:for-eachselect="$response">
991-
<xsl:variablename="href"select="ac:absolute-path(xs:anyURI(ixsl:location()))"as="xs:anyURI"/><!-- TO-DO: pass $context?base-uri-->
992-
<xsl:variablename="request"select="map{ 'method': 'GET', 'href': $href, 'headers': map{ 'Accept': 'application/xhtml+xml' } }"as="map(*)"/>
993-
<xsl:variablename="context"select="map:merge((
994-
$context,
995-
map{
996-
'request': $request,
997-
'href': $href
998-
}
999-
), map{ 'duplicates': 'use-last' })"as="map(*)"/>
1000-
<ixsl:promiseselect="
1001-
ixsl:http-request($context('request'))
1002-
=> ixsl:then(ldh:rethread-response($context, ?))
1003-
=> ixsl:then(ldh:handle-response#1)
1004-
=> ixsl:then(ldh:xhtml-document-loaded#1)
1005-
"on-failure="ldh:promise-failure#1"/>
1006-
</xsl:for-each>
1007-
</xsl:function>
1008982

1009983
<xsl:functionname="ldh:form-submit-created"ixsl:updating="yes">
1010984
<xsl:paramname="context"as="map(*)"/>
@@ -1018,7 +992,8 @@ WHERE
1018992
<xsl:variablename="context"as="map(*)"select="
1019993
map{
1020994
'request': $request,
1021-
'href': $href
995+
'href': $href,
996+
'push-state': true()
1022997
}"/>
1023998
<ixsl:promiseselect="
1024999
ixsl:http-request($context('request'))
@@ -1074,7 +1049,7 @@ WHERE
10741049
<xsl:apply-templatesselect="."mode="bs2:Form"><!-- document level template-->
10751050
<xsl:with-paramname="about"select="()"/><!-- don't set @about on the container until after the resource is saved-->
10761051
<xsl:with-paramname="method"select="$form/@method"/>
1077-
<xsl:with-paramname="action"select="$form/@action"as="xs:anyURI"/>
1052+
<xsl:with-paramname="action"select="$form/@action"as="xs:anyURI"tunnel="yes"/>
10781053
<xsl:with-paramname="form-actions-class"select="'form-actions modal-footer'"as="xs:string?"/>
10791054
<xsl:with-paramname="classes"select="()"/>
10801055
<xsl:with-paramname="type-metadata"select="$type-metadata"tunnel="yes"/>
@@ -1223,15 +1198,6 @@ WHERE
12231198
<xsl:variablename="constructed-doc"select="ldh:construct-forClass($forClass)"as="document-node()"/>
12241199
<xsl:variablename="doc-uri"select="resolve-uri(ac:uuid() || '/', ac:absolute-path(ldh:base-uri(.)))"as="xs:anyURI"/><!-- build a relative URI for the child document-->
12251200
<xsl:variablename="this"select="$doc-uri"as="xs:anyURI"/>
1226-
<!-- set document URI instead of blank node-->
1227-
<xsl:variablename="constructed-doc"as="document-node()">
1228-
<xsl:document>
1229-
<xsl:apply-templatesselect="$constructed-doc"mode="ldh:SetResourceID">
1230-
<xsl:with-paramname="forClass"select="$forClass"tunnel="yes"/>
1231-
<xsl:with-paramname="about"select="$this"tunnel="yes"/>
1232-
</xsl:apply-templates>
1233-
</xsl:document>
1234-
</xsl:variable>
12351201
<xsl:variablename="classes"select="()"as="element()*"/>
12361202

12371203
<xsl:for-eachselect="$content-body">
@@ -1255,7 +1221,7 @@ WHERE
12551221
<xsl:apply-templatesselect="$constructed-doc"mode="bs2:Form"><!-- document level template-->
12561222
<xsl:with-paramname="about"select="()"/><!-- don't set @about on the container until after the resource is saved-->
12571223
<xsl:with-paramname="method"select="'put'"/>
1258-
<xsl:with-paramname="action"select="ldh:href($doc-uri, map{})"as="xs:anyURI"/>
1224+
<xsl:with-paramname="action"select="ldh:href($doc-uri)"as="xs:anyURI"tunnel="yes"/>
12591225
<xsl:with-paramname="form-actions-class"select="'form-actions modal-footer'"as="xs:string?"/>
12601226
<xsl:with-paramname="classes"select="$classes"/>
12611227
<xsl:with-paramname="type-metadata"select="$type-metadata"tunnel="yes"/>
@@ -1351,7 +1317,7 @@ WHERE
13511317
<xsl:apply-templatesselect="$constructed-doc"mode="bs2:RowForm">
13521318
<xsl:with-paramname="about"select="()"/><!-- don't set @about on the container until after the resource is saved-->
13531319
<xsl:with-paramname="method"select="$method"/>
1354-
<xsl:with-paramname="action"select="ldh:href($doc-uri, map{})"as="xs:anyURI"/>
1320+
<xsl:with-paramname="action"select="ldh:href($doc-uri)"as="xs:anyURI"tunnel="yes"/>
13551321
<xsl:with-paramname="type-metadata"select="$type-metadata"tunnel="yes"/>
13561322
<xsl:with-paramname="property-metadata"select="$property-metadata"tunnel="yes"/>
13571323
<xsl:with-paramname="constructor"select="$constructed-doc"tunnel="yes"/>
@@ -1612,7 +1578,7 @@ WHERE
16121578

16131579
<xsl:apply-templatesselect="$resource"mode="bs2:Form">
16141580
<xsl:with-paramname="method"select="'post'"/>
1615-
<xsl:with-paramname="action"select="ldh:href($doc-uri, map{})"as="xs:anyURI"/>
1581+
<xsl:with-paramname="action"select="ldh:href($doc-uri)"as="xs:anyURI"tunnel="yes"/>
16161582
<xsl:with-paramname="classes"select="$classes"/>
16171583
<xsl:with-paramname="type-metadata"select="$type-metadata"tunnel="yes"/>
16181584
<xsl:with-paramname="property-metadata"select="$property-metadata"tunnel="yes"/>

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/functions.xsl‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,15 @@ exclude-result-prefixes="#all"
5353
</xsl:choose>
5454
</xsl:function>
5555

56+
<xsl:functionname="ldh:origin"as="xs:anyURI">
57+
<xsl:paramname="uri"as="xs:anyURI"/>
58+
59+
<!-- no trailing slash-->
60+
<xsl:sequenceselect="xs:anyURI(replace($uri, '^(https?://[^/]+).*$', '$1'))"/>
61+
</xsl:function>
62+
5663
<xsl:functionname="ldt:base"as="xs:anyURI">
57-
<xsl:sequenceselect="xs:anyURI(ixsl:get(ixsl:window(), 'LinkedDataHub.base'))"/>
64+
<xsl:sequenceselect="xs:anyURI(ldh:origin(xs:anyURI(ixsl:location())) || '/')"/>
5865
</xsl:function>
5966

6067
<xsl:functionname="acl:mode"as="xs:anyURI*">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp