-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use injected HttpClient for loader #122
Conversation
The loader's interaction with a service with respect to OPTIONS now occurs through the registry HttpClient, which can be configured for authentication
@birkland I can test this out for you in Islandora later today. |
@@ -125,7 +125,7 @@ public void configure() throws Exception { | |||
.setHeader(Exchange.HTTP_URI, header(HEADER_SERVICE_URI)) | |||
.setHeader("Accept", constant("text/turtle")) | |||
.process(e -> LOG.info("Execution OPTIONS to service URI {}", e.getIn().getHeader(Exchange.HTTP_URI))) | |||
.to("jetty:http://localhost") | |||
.to("http://localhost?httpClient=#httpClient") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh man, that's smart. I didn't know you could throw bean refs at it using #
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the param name was the thing we weren't sure whether it was legit, but #
works all over.
It works. I just integrated our OCR service with Api-X using this changeset. ubuntu@claw:/var/www/html/Crayfish/Hypercube$ curl -I -H "Authorization: Bearer islandora" http://localhost:8081/fcrepo/rest/test.tiff
HTTP/1.1 200 OK
Content-Type: image/tiff
Accept: */*
Accept-Ranges: bytes
Allow: DELETE,HEAD,GET,PUT,OPTIONS
Apix-Modality: intercept; outgoing
Authorization: Bearer islandora
breadcrumbId: ID-claw-43528-1497022083888-5-159
Content-Disposition: attachment; filename=""; creation-date="Fri, 09 Jun 2017 18:14:06 GMT"; modification-date="Fri, 09 Jun 2017 18:14:06 GMT"; size=20648
ETag: "56156efacc6fc99274a19d102f95a2ed9e31d89e"
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Last-Modified: Fri, 09 Jun 2017 18:14:06 GMT
Link: <http://www.w3.org/ns/ldp#NonRDFSource>;rel="type"
Link: <http://localhost:8081/fcrepo/rest/test.tiff/fcr:metadata>; rel="describedby"
Link: <http://localhost:8081/discovery/test.tiff>; rel="service"
Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
Server: Apache-Coyote/1.1
Content-Length: 0
ubuntu@claw:/var/www/html/Crayfish/Hypercube$ curl -H "Authorization: Bearer islandora" http://localhost:8081/discovery/test.tiff
<> a <http://fedora.info/definitions/v4/service#ServiceDocument> ;
<http://fedora.info/definitions/v4/service#isServiceDocumentFor>
<http://localhost:8081/fcrepo/rest/test.tiff> ;
<http://www.openarchives.org/ore/terms/describes>
<#services> .
<#services> <http://www.openarchives.org/ore/terms/aggregates>
<#f920f7df-652a-4f27-b9ae-5ff9a33f9a02> .
<#f920f7df-652a-4f27-b9ae-5ff9a33f9a02>
a <http://fedora.info/definitions/v4/service#ServiceInstance> ;
<http://fedora.info/definitions/v4/service#hasEndpoint>
<http://localhost:8081/services/test.tiff/svc:ocr> ;
<http://fedora.info/definitions/v4/service#isFunctionOf>
<http://localhost:8081/fcrepo/rest/test.tiff> ;
<http://fedora.info/definitions/v4/service#isServiceInstanceOf>
<http://islandora.ca/CLAW#OcrService> ;
<http://fedora.info/definitions/v4/service#serviceInstanceExposedBy>
<http://localhost:8081/fcrepo/rest/test.tiff> .
ubuntu@claw:/var/www/html/Crayfish/Hypercube$ curl -H "Authorization: Bearer islandora" http://localhost:8081/services/test.tiff/svc:ocr
Test tiff
Test tiff
Test tiff
Test tiff |
@dannylamb That's fantastic! I wish I had celebratory animated gif skills, but maybe celebratory draught skills will do. |
🍺 🥃 |
The loader's interaction with a service with respect to OPTIONS now occurs
through the registry HttpClient, which can be configured for
authentication
Resolves #121