SB
Sébastien Brossard
Wed, Sep 26, 2012 2:26 PM
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report (i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content ")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this same problemhttp://stackoverflow.com/questions/3011816/jasperreports-reports-access-image-via-authenticated-url has been on Stackoverflow's website for the past two years waiting for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, I'm still not able to show the picture in the report.
It seems like I've used all possible <imageExpression> type combinations.
I used also an image loader (i.e. "net.sf.jasperreports.engine.util.JRImageLoader.loadImage") but without any success.
(remark: using an URL pointing to a "jpeg" file works well).
Question is, what is exactly the format returned by this kind of request (i.e. http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report (i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content ")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this same problem<http://stackoverflow.com/questions/3011816/jasperreports-reports-access-image-via-authenticated-url> has been on Stackoverflow's website for the past two years waiting for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, I'm still not able to show the picture in the report.
It seems like I've used all possible <imageExpression> type combinations.
I used also an image loader (i.e. "net.sf.jasperreports.engine.util.JRImageLoader.loadImage") but without any success.
(remark: using an URL pointing to a "jpeg" file works well).
Question is, what is exactly the format returned by this kind of request (i.e. http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
SB
Sébastien Brossard
Wed, Sep 26, 2012 2:36 PM
... I forget a 3rd point!
An option may be to get the image blob directly from the database.
I thought I could load it from the data field in content table but...
what is the format of this data? (in the case of the current image, the data field is set to: "9d377b10ce778c4938b3c7e2c63a229a").
Again, I wasn't able to have iReport to interpret it properly.
Thank you again.
Best regards,
Sébastien
Fra: talk-bounces@lists.collectionspace.org [mailto:talk-bounces@lists.collectionspace.org] På vegne af Sébastien Brossard
Sendt: 26. september 2012 16:27
Til: CollectionSpace Talk List
Emne: [Talk] iReport - insert image blob
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report (i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content <http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content%20> ")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this same problemhttp://stackoverflow.com/questions/3011816/jasperreports-reports-access-image-via-authenticated-url has been on Stackoverflow's website for the past two years waiting for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, I'm still not able to show the picture in the report.
It seems like I've used all possible <imageExpression> type combinations.
I used also an image loader (i.e. "net.sf.jasperreports.engine.util.JRImageLoader.loadImage") but without any success.
(remark: using an URL pointing to a "jpeg" file works well).
Question is, what is exactly the format returned by this kind of request (i.e. http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
... I forget a 3rd point!
An option may be to get the image blob directly from the database.
I thought I could load it from the data field in content table but...
what is the format of this data? (in the case of the current image, the data field is set to: "9d377b10ce778c4938b3c7e2c63a229a").
Again, I wasn't able to have iReport to interpret it properly.
Thank you again.
Best regards,
Sébastien
Fra: talk-bounces@lists.collectionspace.org [mailto:talk-bounces@lists.collectionspace.org] På vegne af Sébastien Brossard
Sendt: 26. september 2012 16:27
Til: CollectionSpace Talk List
Emne: [Talk] iReport - insert image blob
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report (i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content <http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content%20> ")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this same problem<http://stackoverflow.com/questions/3011816/jasperreports-reports-access-image-via-authenticated-url> has been on Stackoverflow's website for the past two years waiting for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, I'm still not able to show the picture in the report.
It seems like I've used all possible <imageExpression> type combinations.
I used also an image loader (i.e. "net.sf.jasperreports.engine.util.JRImageLoader.loadImage") but without any success.
(remark: using an URL pointing to a "jpeg" file works well).
Question is, what is exactly the format returned by this kind of request (i.e. http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
PS
Patrick Schmitz
Wed, Sep 26, 2012 4:27 PM
Hi Sebastien -
Currently, this is a bit of a pain in CSpace. For another purpose here at
UCB, we've been working on a simple read-only proxy service to provide
access to certain resources. However, that's not ready yet.
In the mean time, we'll take a look at the details of the auth headers and
get back to you, but I suspect that this may not be easy to integrate into
iReport.
Hitting the repo (DB) directly is not a good solution.
Patrick
From: talk-bounces@lists.collectionspace.org
[mailto:talk-bounces@lists.collectionspace.org] On Behalf Of Sébastien
Brossard
Sent: Wednesday, September 26, 2012 7:36 AM
To: CollectionSpace Talk List
Subject: Re: [Talk] iReport - insert image blob
I forget a 3rd point!
An option may be to get the image blob directly from the database.
I thought I could load it from the data field in content table but
what is the format of this data? (in the case of the current image, the data
field is set to: 9d377b10ce778c4938b3c7e2c63a229a).
Again, I wasnt able to have iReport to interpret it properly.
Thank you again.
Best regards,
Sébastien
Fra: talk-bounces@lists.collectionspace.org
[mailto:talk-bounces@lists.collectionspace.org] På vegne af Sébastien
Brossard
Sendt: 26. september 2012 16:27
Til: CollectionSpace Talk List
Emne: [Talk] iReport - insert image blob
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report
(i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3e
f/blob/derivatives/Medium/content
<http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/de
rivatives/Medium/content%20> ")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in
iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request
but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this
<http://stackoverflow.com/questions/3011816/jasperreports-reports-access-ima
ge-via-authenticated-url> same problem has been on Stackoverflows website
for the past two years waiting for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I
must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd
-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, Im still not able to show the picture in the report.
It seems like Ive used all possible <imageExpression> type combinations.
I used also an image loader (i.e.
net.sf.jasperreports.engine.util.JRImageLoader.loadImage) but without any
success.
(remark: using an URL pointing to a jpeg file works well).
Question is, what is exactly the format returned by this kind of request
(i.e.
http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862
-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
Hi Sebastien -
Currently, this is a bit of a pain in CSpace. For another purpose here at
UCB, we've been working on a simple read-only proxy service to provide
access to certain resources. However, that's not ready yet.
In the mean time, we'll take a look at the details of the auth headers and
get back to you, but I suspect that this may not be easy to integrate into
iReport.
Hitting the repo (DB) directly is not a good solution.
Patrick
_____
From: talk-bounces@lists.collectionspace.org
[mailto:talk-bounces@lists.collectionspace.org] On Behalf Of Sébastien
Brossard
Sent: Wednesday, September 26, 2012 7:36 AM
To: CollectionSpace Talk List
Subject: Re: [Talk] iReport - insert image blob
I forget a 3rd point!
An option may be to get the image blob directly from the database.
I thought I could load it from the data field in content table but
what is the format of this data? (in the case of the current image, the data
field is set to: 9d377b10ce778c4938b3c7e2c63a229a).
Again, I wasnt able to have iReport to interpret it properly.
Thank you again.
Best regards,
Sébastien
Fra: talk-bounces@lists.collectionspace.org
[mailto:talk-bounces@lists.collectionspace.org] På vegne af Sébastien
Brossard
Sendt: 26. september 2012 16:27
Til: CollectionSpace Talk List
Emne: [Talk] iReport - insert image blob
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report
(i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3e
f/blob/derivatives/Medium/content
<http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/de
rivatives/Medium/content%20> ")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in
iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request
but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this
<http://stackoverflow.com/questions/3011816/jasperreports-reports-access-ima
ge-via-authenticated-url> same problem has been on Stackoverflows website
for the past two years waiting for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I
must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd
-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, Im still not able to show the picture in the report.
It seems like Ive used all possible <imageExpression> type combinations.
I used also an image loader (i.e.
net.sf.jasperreports.engine.util.JRImageLoader.loadImage) but without any
success.
(remark: using an URL pointing to a jpeg file works well).
Question is, what is exactly the format returned by this kind of request
(i.e.
http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862
-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
AR
Aron Roberts
Wed, Sep 26, 2012 4:40 PM
A response to one of your specific questions, Sébastien:
On Wed, Sep 26, 2012 at 7:26 AM, Sébastien Brossard
Sebastien.Brossard@smk.dk wrote:
A response to one of your specific questions, Sébastien:
On Wed, Sep 26, 2012 at 7:26 AM, Sébastien Brossard
<Sebastien.Brossard@smk.dk> wrote:
> Question is, what is exactly the format returned by this kind of request
> (i.e.
> http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
The 'Medium' image derivative is in JPEG format. More info on these
derivative formats:
http://wiki.collectionspace.org/display/UNRELEASED/Blob+Service+RESTful+API
Aron
RJ
Rick Jaffe
Fri, Sep 28, 2012 8:51 PM
Sébastien,
I've just had success downloading an image using cURL. It wouldn't open in Preview.app on the Mac, though, until I added the option that dumped the headers. Perhaps something similar is happening in your case #2 below?
Here's the cURL command I ran against demo.collectionspace.org (the -o option saves the bits as a file):
curl --dump-header -i -u admin@core.collectionspace.org:Administrator http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content -o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Rick
Rick Jaffe
University of California Berkeley
IST-Research & Content Technologies
250-32 Earl Warren Hall (2195 Hearst) #4876
Berkeley, CA 94720-4876
(510) 642-0590
On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report (i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content ")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this same problem has been on Stackoverflow’s website for the past two years waiting for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, I’m still not able to show the picture in the report.
It seems like I’ve used all possible <imageExpression> type combinations.
I used also an image loader (i.e. “net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any success.
(remark: using an URL pointing to a “jpeg” file works well).
Question is, what is exactly the format returned by this kind of request (i.e. http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Sébastien,
I've just had success downloading an image using cURL. It wouldn't open in Preview.app on the Mac, though, until I added the option that dumped the headers. Perhaps something similar is happening in your case #2 below?
Here's the cURL command I ran against demo.collectionspace.org (the -o option saves the bits as a file):
curl --dump-header -i -u admin@core.collectionspace.org:Administrator http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content -o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Rick
Rick Jaffe
University of California Berkeley
IST-Research & Content Technologies
250-32 Earl Warren Hall (2195 Hearst) #4876
Berkeley, CA 94720-4876
(510) 642-0590
On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
> Dear all,
>
> I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
> It worked pretty well until I had to insert dynamic images in the report (i.e. media related to the CollectionObject shown in the report).
>
> There are two mains points here:
>
> 1/
>
> Having created an Image field, I tried to access image through URL:
>
> <image scaleImage="RealSize">
> <reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
> <imageExpression class="java.awt.Image">
> <![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content ")]]>
> </imageExpression>
> </image>
>
> Unfortunately I got a blank "Authentication required" popup back in iReport's main windows.
> Chris told me that I had to set HTTP' Authentication header to my request but... how?! Where in iReport?!
> After crawling the Web, results are poor (not to say worrying, as this same problem has been on Stackoverflow’s website for the past two years waiting for an answer)
>
>
> 2/
>
> Anyway, I managed to get the media by another mean (which is not pretty, I must admit):
>
> <image scaleImage="RealSize">
> <reportElement positionType="Float" x="6" y="256" width="165" height="115" isPrintWhenDetailOverflows="true"/>
> <imageExpression class="java.awt.Image">
> <![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
> </imageExpression>
> </image>
>
>
> But here, I’m still not able to show the picture in the report.
> It seems like I’ve used all possible <imageExpression> type combinations.
> I used also an image loader (i.e. “net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any success.
> (remark: using an URL pointing to a “jpeg” file works well).
>
> Question is, what is exactly the format returned by this kind of request (i.e. http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
>
> Thank you by advance for your kindly help.
>
> Best regards,
>
> Sébastien
>
>
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
AR
Aron Roberts
Fri, Sep 28, 2012 9:42 PM
Thanks much, Rick!
A bit more on file corruption when downloading image files from
CollectionSpace (or any other source) via the command-line 'curl'
utility:
Curl's '-i" option (which spits out HTTP headers to the console, and
for that reason is ordinarily very useful) seems to be what's
corrupting the JPEG images. When using that option, saved image files
begin with bits of extraneous text - the HTTP headers - which corrupts
them. Apparently adding the '--dump-header' option (which dumps HTTP
headers to a file, if given an optional filename argument),
counteracts that by suppressing the output of '-i', and allows the
images to be saved without corruption.
By implication, by omitting both options, -i and --dump-header, you
can still successfully save JPEG images via curl; I was just now able
to do so under Mac OS X, with the saved image viewable in OS X's
Preview application.
curl -u admin@core.collectionspace.org:Administrator
http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
-o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Aron
On Fri, Sep 28, 2012 at 1:51 PM, Rick Jaffe rjaffe@berkeley.edu wrote:
Sébastien,
I've just had success downloading an image using cURL. It wouldn't open in
Preview.app on the Mac, though, until I added the option that dumped the
headers. Perhaps something similar is happening in your case #2 below?
Here's the cURL command I ran against demo.collectionspace.org (the -o
option saves the bits as a file):
curl --dump-header -i -u admin@core.collectionspace.org:Administrator
http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
-o
PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Rick
Rick Jaffe
University of California Berkeley
IST-Research & Content Technologies
250-32 Earl Warren Hall (2195 Hearst) #4876
Berkeley, CA 94720-4876
(510) 642-0590
On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report
(i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content
")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in
iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request
but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this same
problem has been on Stackoverflow’s website for the past two years waiting
for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I
must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, I’m still not able to show the picture in the report.
It seems like I’ve used all possible <imageExpression> type combinations.
I used also an image loader (i.e.
“net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any
success.
(remark: using an URL pointing to a “jpeg” file works well).
Question is, what is exactly the format returned by this kind of request
(i.e.
http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Thanks much, Rick!
A bit more on file corruption when downloading image files from
CollectionSpace (or any other source) via the command-line 'curl'
utility:
Curl's '-i" option (which spits out HTTP headers to the console, and
for that reason is ordinarily very useful) seems to be what's
corrupting the JPEG images. When using that option, saved image files
begin with bits of extraneous text - the HTTP headers - which corrupts
them. Apparently adding the '--dump-header' option (which dumps HTTP
headers to a file, if given an optional filename argument),
counteracts that by suppressing the output of '-i', and allows the
images to be saved without corruption.
By implication, by omitting *both* options, -i and --dump-header, you
can still successfully save JPEG images via curl; I was just now able
to do so under Mac OS X, with the saved image viewable in OS X's
Preview application.
curl -u admin@core.collectionspace.org:Administrator
http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
-o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Aron
On Fri, Sep 28, 2012 at 1:51 PM, Rick Jaffe <rjaffe@berkeley.edu> wrote:
> Sébastien,
>
> I've just had success downloading an image using cURL. It wouldn't open in
> Preview.app on the Mac, though, until I added the option that dumped the
> headers. Perhaps something similar is happening in your case #2 below?
>
> Here's the cURL command I ran against demo.collectionspace.org (the -o
> option saves the bits as a file):
>
> curl --dump-header -i -u admin@core.collectionspace.org:Administrator
> http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
> -o
> PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
>
> Rick
>
>
>
> Rick Jaffe
> University of California Berkeley
> IST-Research & Content Technologies
> 250-32 Earl Warren Hall (2195 Hearst) #4876
> Berkeley, CA 94720-4876
> (510) 642-0590
>
>
>
>
>
>
> On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
>
> Dear all,
>
> I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
> It worked pretty well until I had to insert dynamic images in the report
> (i.e. media related to the CollectionObject shown in the report).
>
> There are two mains points here:
>
> 1/
>
> Having created an Image field, I tried to access image through URL:
>
> <image scaleImage="RealSize">
> <reportElement positionType="Float" x="6" y="256"
> width="165" height="115" isPrintWhenDetailOverflows="true"/>
> <imageExpression class="java.awt.Image">
>
> <![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content
> ")]]>
> </imageExpression>
> </image>
>
> Unfortunately I got a blank "Authentication required" popup back in
> iReport's main windows.
> Chris told me that I had to set HTTP' Authentication header to my request
> but... how?! Where in iReport?!
> After crawling the Web, results are poor (not to say worrying, as this same
> problem has been on Stackoverflow’s website for the past two years waiting
> for an answer)
>
>
> 2/
>
> Anyway, I managed to get the media by another mean (which is not pretty, I
> must admit):
>
> <image scaleImage="RealSize">
> <reportElement positionType="Float" x="6" y="256"
> width="165" height="115" isPrintWhenDetailOverflows="true"/>
> <imageExpression class="java.awt.Image">
>
> <![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
> </imageExpression>
> </image>
>
>
> But here, I’m still not able to show the picture in the report.
> It seems like I’ve used all possible <imageExpression> type combinations.
> I used also an image loader (i.e.
> “net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any
> success.
> (remark: using an URL pointing to a “jpeg” file works well).
>
> Question is, what is exactly the format returned by this kind of request
> (i.e.
> http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
>
> Thank you by advance for your kindly help.
>
> Best regards,
>
> Sébastien
>
>
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
RJ
Rick Jaffe
Fri, Sep 28, 2012 10:25 PM
Sébastien,
A bit more "help" (I hope this is helpful!) -
I've been able to download an image using the services API similar to the one you tried in your iReport by including the authentication credentials in the body of the GET URL:
curl http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/derivatives/Medium/content -o /tmp/Southern_Right_Whale_101_Medium.jpg
Would this work within your iReport?
On Sep 28, 2012, at 2:42 PM, Aron Roberts wrote:
Thanks much, Rick!
A bit more on file corruption when downloading image files from
CollectionSpace (or any other source) via the command-line 'curl'
utility:
Curl's '-i" option (which spits out HTTP headers to the console, and
for that reason is ordinarily very useful) seems to be what's
corrupting the JPEG images. When using that option, saved image files
begin with bits of extraneous text - the HTTP headers - which corrupts
them. Apparently adding the '--dump-header' option (which dumps HTTP
headers to a file, if given an optional filename argument),
counteracts that by suppressing the output of '-i', and allows the
images to be saved without corruption.
By implication, by omitting both options, -i and --dump-header, you
can still successfully save JPEG images via curl; I was just now able
to do so under Mac OS X, with the saved image viewable in OS X's
Preview application.
curl -u admin@core.collectionspace.org:Administrator
http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
-o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Aron
On Fri, Sep 28, 2012 at 1:51 PM, Rick Jaffe rjaffe@berkeley.edu wrote:
Sébastien,
I've just had success downloading an image using cURL. It wouldn't open in
Preview.app on the Mac, though, until I added the option that dumped the
headers. Perhaps something similar is happening in your case #2 below?
Here's the cURL command I ran against demo.collectionspace.org (the -o
option saves the bits as a file):
curl --dump-header -i -u admin@core.collectionspace.org:Administrator
http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
-o
PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Rick
Rick Jaffe
University of California Berkeley
IST-Research & Content Technologies
250-32 Earl Warren Hall (2195 Hearst) #4876
Berkeley, CA 94720-4876
(510) 642-0590
On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report
(i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content
")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in
iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request
but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this same
problem has been on Stackoverflow’s website for the past two years waiting
for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I
must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, I’m still not able to show the picture in the report.
It seems like I’ve used all possible <imageExpression> type combinations.
I used also an image loader (i.e.
“net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any
success.
(remark: using an URL pointing to a “jpeg” file works well).
Question is, what is exactly the format returned by this kind of request
(i.e.
http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Sébastien,
A bit more "help" (I hope this is helpful!) -
I've been able to download an image using the services API similar to the one you tried in your iReport by including the authentication credentials in the body of the GET URL:
curl http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/derivatives/Medium/content -o /tmp/Southern_Right_Whale_101_Medium.jpg
Would this work within your iReport?
- Rick
On Sep 28, 2012, at 2:42 PM, Aron Roberts wrote:
> Thanks much, Rick!
>
> A bit more on file corruption when downloading image files from
> CollectionSpace (or any other source) via the command-line 'curl'
> utility:
>
> Curl's '-i" option (which spits out HTTP headers to the console, and
> for that reason is ordinarily very useful) seems to be what's
> corrupting the JPEG images. When using that option, saved image files
> begin with bits of extraneous text - the HTTP headers - which corrupts
> them. Apparently adding the '--dump-header' option (which dumps HTTP
> headers to a file, if given an optional filename argument),
> counteracts that by suppressing the output of '-i', and allows the
> images to be saved without corruption.
>
> By implication, by omitting *both* options, -i and --dump-header, you
> can still successfully save JPEG images via curl; I was just now able
> to do so under Mac OS X, with the saved image viewable in OS X's
> Preview application.
>
> curl -u admin@core.collectionspace.org:Administrator
> http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
> -o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
>
> Aron
>
> On Fri, Sep 28, 2012 at 1:51 PM, Rick Jaffe <rjaffe@berkeley.edu> wrote:
>> Sébastien,
>>
>> I've just had success downloading an image using cURL. It wouldn't open in
>> Preview.app on the Mac, though, until I added the option that dumped the
>> headers. Perhaps something similar is happening in your case #2 below?
>>
>> Here's the cURL command I ran against demo.collectionspace.org (the -o
>> option saves the bits as a file):
>>
>> curl --dump-header -i -u admin@core.collectionspace.org:Administrator
>> http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
>> -o
>> PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
>>
>> Rick
>>
>>
>>
>> Rick Jaffe
>> University of California Berkeley
>> IST-Research & Content Technologies
>> 250-32 Earl Warren Hall (2195 Hearst) #4876
>> Berkeley, CA 94720-4876
>> (510) 642-0590
>>
>>
>>
>>
>>
>>
>> On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
>>
>> Dear all,
>>
>> I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
>> It worked pretty well until I had to insert dynamic images in the report
>> (i.e. media related to the CollectionObject shown in the report).
>>
>> There are two mains points here:
>>
>> 1/
>>
>> Having created an Image field, I tried to access image through URL:
>>
>> <image scaleImage="RealSize">
>> <reportElement positionType="Float" x="6" y="256"
>> width="165" height="115" isPrintWhenDetailOverflows="true"/>
>> <imageExpression class="java.awt.Image">
>>
>> <![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content
>> ")]]>
>> </imageExpression>
>> </image>
>>
>> Unfortunately I got a blank "Authentication required" popup back in
>> iReport's main windows.
>> Chris told me that I had to set HTTP' Authentication header to my request
>> but... how?! Where in iReport?!
>> After crawling the Web, results are poor (not to say worrying, as this same
>> problem has been on Stackoverflow’s website for the past two years waiting
>> for an answer)
>>
>>
>> 2/
>>
>> Anyway, I managed to get the media by another mean (which is not pretty, I
>> must admit):
>>
>> <image scaleImage="RealSize">
>> <reportElement positionType="Float" x="6" y="256"
>> width="165" height="115" isPrintWhenDetailOverflows="true"/>
>> <imageExpression class="java.awt.Image">
>>
>> <![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
>> </imageExpression>
>> </image>
>>
>>
>> But here, I’m still not able to show the picture in the report.
>> It seems like I’ve used all possible <imageExpression> type combinations.
>> I used also an image loader (i.e.
>> “net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any
>> success.
>> (remark: using an URL pointing to a “jpeg” file works well).
>>
>> Question is, what is exactly the format returned by this kind of request
>> (i.e.
>> http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
>>
>> Thank you by advance for your kindly help.
>>
>> Best regards,
>>
>> Sébastien
>>
>>
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>
AR
Aron Roberts
Fri, Sep 28, 2012 10:50 PM
I've been able to download an image using the services API similar to the one you tried in your iReport by including the authentication credentials in the body of the GET URL:
curl http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/derivatives/Medium/content -o /tmp/Southern_Right_Whale_101_Medium.jpg
Would this work within your iReport?
Expanding just a bit on Rick's excellent suggestion here, if iReport
doesn't give you some way to independently specify the username and
password you need to supply in order to download an image file via
CollectionSpace's services layer, you can instead try embedding that
username and password directly into the URL, using this
Internet-standard syntax (from RFC 1738,
http://www.rfc-editor.org/rfc/rfc1738.txt):
http://<user>:<password>@<host>:<port>/<url-path>
Since a CollectionSpace username is an email address, which contains
an 'at sign' ('@'), you'll need to encode that character as '%40', as
Rick has shown in his example above. Hence if you were trying to
download an image file as the user 'admin@core.collectionspace.org",
with the password "Administrator", from the CollectionSpace server at
the host "demo.collectionspace.org" at port 8180, the URL would begin
like this:
http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/...
Aron
On Sep 28, 2012, at 2:42 PM, Aron Roberts wrote:
Thanks much, Rick!
A bit more on file corruption when downloading image files from
CollectionSpace (or any other source) via the command-line 'curl'
utility:
Curl's '-i" option (which spits out HTTP headers to the console, and
for that reason is ordinarily very useful) seems to be what's
corrupting the JPEG images. When using that option, saved image files
begin with bits of extraneous text - the HTTP headers - which corrupts
them. Apparently adding the '--dump-header' option (which dumps HTTP
headers to a file, if given an optional filename argument),
counteracts that by suppressing the output of '-i', and allows the
images to be saved without corruption.
By implication, by omitting both options, -i and --dump-header, you
can still successfully save JPEG images via curl; I was just now able
to do so under Mac OS X, with the saved image viewable in OS X's
Preview application.
curl -u admin@core.collectionspace.org:Administrator
http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
-o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Aron
On Fri, Sep 28, 2012 at 1:51 PM, Rick Jaffe rjaffe@berkeley.edu wrote:
Sébastien,
I've just had success downloading an image using cURL. It wouldn't open in
Preview.app on the Mac, though, until I added the option that dumped the
headers. Perhaps something similar is happening in your case #2 below?
Here's the cURL command I ran against demo.collectionspace.org (the -o
option saves the bits as a file):
curl --dump-header -i -u admin@core.collectionspace.org:Administrator
http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
-o
PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Rick
Rick Jaffe
University of California Berkeley
IST-Research & Content Technologies
250-32 Earl Warren Hall (2195 Hearst) #4876
Berkeley, CA 94720-4876
(510) 642-0590
On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report
(i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content
")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in
iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request
but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this same
problem has been on Stackoverflow’s website for the past two years waiting
for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I
must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, I’m still not able to show the picture in the report.
It seems like I’ve used all possible <imageExpression> type combinations.
I used also an image loader (i.e.
“net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any
success.
(remark: using an URL pointing to a “jpeg” file works well).
Question is, what is exactly the format returned by this kind of request
(i.e.
http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Hi Sébastien,
On Fri, Sep 28, 2012 at 3:25 PM, Rick Jaffe <rjaffe@berkeley.edu> wrote:
> I've been able to download an image using the services API similar to the one you tried in your iReport by including the authentication credentials in the body of the GET URL:
>
> curl http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/derivatives/Medium/content -o /tmp/Southern_Right_Whale_101_Medium.jpg
>
> Would this work within your iReport?
Expanding just a bit on Rick's excellent suggestion here, if iReport
doesn't give you some way to independently specify the username and
password you need to supply in order to download an image file via
CollectionSpace's services layer, you can instead try embedding that
username and password directly into the URL, using this
Internet-standard syntax (from RFC 1738,
http://www.rfc-editor.org/rfc/rfc1738.txt):
http://<user>:<password>@<host>:<port>/<url-path>
Since a CollectionSpace username is an email address, which contains
an 'at sign' ('@'), you'll need to encode that character as '%40', as
Rick has shown in his example above. Hence if you were trying to
download an image file as the user 'admin@core.collectionspace.org",
with the password "Administrator", from the CollectionSpace server at
the host "demo.collectionspace.org" at port 8180, the URL would begin
like this:
http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/...
Aron
> On Sep 28, 2012, at 2:42 PM, Aron Roberts wrote:
>
>> Thanks much, Rick!
>>
>> A bit more on file corruption when downloading image files from
>> CollectionSpace (or any other source) via the command-line 'curl'
>> utility:
>>
>> Curl's '-i" option (which spits out HTTP headers to the console, and
>> for that reason is ordinarily very useful) seems to be what's
>> corrupting the JPEG images. When using that option, saved image files
>> begin with bits of extraneous text - the HTTP headers - which corrupts
>> them. Apparently adding the '--dump-header' option (which dumps HTTP
>> headers to a file, if given an optional filename argument),
>> counteracts that by suppressing the output of '-i', and allows the
>> images to be saved without corruption.
>>
>> By implication, by omitting *both* options, -i and --dump-header, you
>> can still successfully save JPEG images via curl; I was just now able
>> to do so under Mac OS X, with the saved image viewable in OS X's
>> Preview application.
>>
>> curl -u admin@core.collectionspace.org:Administrator
>> http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
>> -o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
>>
>> Aron
>>
>> On Fri, Sep 28, 2012 at 1:51 PM, Rick Jaffe <rjaffe@berkeley.edu> wrote:
>>> Sébastien,
>>>
>>> I've just had success downloading an image using cURL. It wouldn't open in
>>> Preview.app on the Mac, though, until I added the option that dumped the
>>> headers. Perhaps something similar is happening in your case #2 below?
>>>
>>> Here's the cURL command I ran against demo.collectionspace.org (the -o
>>> option saves the bits as a file):
>>>
>>> curl --dump-header -i -u admin@core.collectionspace.org:Administrator
>>> http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
>>> -o
>>> PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
>>>
>>> Rick
>>>
>>>
>>>
>>> Rick Jaffe
>>> University of California Berkeley
>>> IST-Research & Content Technologies
>>> 250-32 Earl Warren Hall (2195 Hearst) #4876
>>> Berkeley, CA 94720-4876
>>> (510) 642-0590
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
>>>
>>> Dear all,
>>>
>>> I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
>>> It worked pretty well until I had to insert dynamic images in the report
>>> (i.e. media related to the CollectionObject shown in the report).
>>>
>>> There are two mains points here:
>>>
>>> 1/
>>>
>>> Having created an Image field, I tried to access image through URL:
>>>
>>> <image scaleImage="RealSize">
>>> <reportElement positionType="Float" x="6" y="256"
>>> width="165" height="115" isPrintWhenDetailOverflows="true"/>
>>> <imageExpression class="java.awt.Image">
>>>
>>> <![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content
>>> ")]]>
>>> </imageExpression>
>>> </image>
>>>
>>> Unfortunately I got a blank "Authentication required" popup back in
>>> iReport's main windows.
>>> Chris told me that I had to set HTTP' Authentication header to my request
>>> but... how?! Where in iReport?!
>>> After crawling the Web, results are poor (not to say worrying, as this same
>>> problem has been on Stackoverflow’s website for the past two years waiting
>>> for an answer)
>>>
>>>
>>> 2/
>>>
>>> Anyway, I managed to get the media by another mean (which is not pretty, I
>>> must admit):
>>>
>>> <image scaleImage="RealSize">
>>> <reportElement positionType="Float" x="6" y="256"
>>> width="165" height="115" isPrintWhenDetailOverflows="true"/>
>>> <imageExpression class="java.awt.Image">
>>>
>>> <![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
>>> </imageExpression>
>>> </image>
>>>
>>>
>>> But here, I’m still not able to show the picture in the report.
>>> It seems like I’ve used all possible <imageExpression> type combinations.
>>> I used also an image loader (i.e.
>>> “net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any
>>> success.
>>> (remark: using an URL pointing to a “jpeg” file works well).
>>>
>>> Question is, what is exactly the format returned by this kind of request
>>> (i.e.
>>> http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
>>>
>>> Thank you by advance for your kindly help.
>>>
>>> Best regards,
>>>
>>> Sébastien
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>
AR
Aron Roberts
Fri, Sep 28, 2012 11:43 PM
One more thing about which Rick reminded me:
Any credentials (such as a username and password) that might be stored
in any persistent way are sensitive data, and need to be protected
appropriately.
As well, if you haven't already done so, you might consider creating a
special CollectionSpace account to use when generating these reports
that is associated with a very limited role, one which has been
granted only the minimum privileges required, such as read-only
privileges only on some selected record types.
On Fri, Sep 28, 2012 at 3:50 PM, Aron Roberts
aron@socrates.berkeley.edu wrote:
I've been able to download an image using the services API similar to the one you tried in your iReport by including the authentication credentials in the body of the GET URL:
curl http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/derivatives/Medium/content -o /tmp/Southern_Right_Whale_101_Medium.jpg
Would this work within your iReport?
Expanding just a bit on Rick's excellent suggestion here, if iReport
doesn't give you some way to independently specify the username and
password you need to supply in order to download an image file via
CollectionSpace's services layer, you can instead try embedding that
username and password directly into the URL, using this
Internet-standard syntax (from RFC 1738,
http://www.rfc-editor.org/rfc/rfc1738.txt):
http://<user>:<password>@<host>:<port>/<url-path>
Since a CollectionSpace username is an email address, which contains
an 'at sign' ('@'), you'll need to encode that character as '%40', as
Rick has shown in his example above. Hence if you were trying to
download an image file as the user 'admin@core.collectionspace.org",
with the password "Administrator", from the CollectionSpace server at
the host "demo.collectionspace.org" at port 8180, the URL would begin
like this:
http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/...
Aron
On Sep 28, 2012, at 2:42 PM, Aron Roberts wrote:
Thanks much, Rick!
A bit more on file corruption when downloading image files from
CollectionSpace (or any other source) via the command-line 'curl'
utility:
Curl's '-i" option (which spits out HTTP headers to the console, and
for that reason is ordinarily very useful) seems to be what's
corrupting the JPEG images. When using that option, saved image files
begin with bits of extraneous text - the HTTP headers - which corrupts
them. Apparently adding the '--dump-header' option (which dumps HTTP
headers to a file, if given an optional filename argument),
counteracts that by suppressing the output of '-i', and allows the
images to be saved without corruption.
By implication, by omitting both options, -i and --dump-header, you
can still successfully save JPEG images via curl; I was just now able
to do so under Mac OS X, with the saved image viewable in OS X's
Preview application.
curl -u admin@core.collectionspace.org:Administrator
http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
-o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Aron
On Fri, Sep 28, 2012 at 1:51 PM, Rick Jaffe rjaffe@berkeley.edu wrote:
Sébastien,
I've just had success downloading an image using cURL. It wouldn't open in
Preview.app on the Mac, though, until I added the option that dumped the
headers. Perhaps something similar is happening in your case #2 below?
Here's the cURL command I ran against demo.collectionspace.org (the -o
option saves the bits as a file):
curl --dump-header -i -u admin@core.collectionspace.org:Administrator
http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
-o
PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
Rick
Rick Jaffe
University of California Berkeley
IST-Research & Content Technologies
250-32 Earl Warren Hall (2195 Hearst) #4876
Berkeley, CA 94720-4876
(510) 642-0590
On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
Dear all,
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the report
(i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
1/
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content
")]]>
</imageExpression>
</image>
Unfortunately I got a blank "Authentication required" popup back in
iReport's main windows.
Chris told me that I had to set HTTP' Authentication header to my request
but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as this same
problem has been on Stackoverflow’s website for the past two years waiting
for an answer)
2/
Anyway, I managed to get the media by another mean (which is not pretty, I
must admit):
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression>
</image>
But here, I’m still not able to show the picture in the report.
It seems like I’ve used all possible <imageExpression> type combinations.
I used also an image loader (i.e.
“net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any
success.
(remark: using an URL pointing to a “jpeg” file works well).
Question is, what is exactly the format returned by this kind of request
(i.e.
http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
Thank you by advance for your kindly help.
Best regards,
Sébastien
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
One more thing about which Rick reminded me:
Any credentials (such as a username and password) that might be stored
in any persistent way are sensitive data, and need to be protected
appropriately.
As well, if you haven't already done so, you might consider creating a
special CollectionSpace account to use when generating these reports
that is associated with a very limited role, one which has been
granted only the minimum privileges required, such as read-only
privileges only on some selected record types.
On Fri, Sep 28, 2012 at 3:50 PM, Aron Roberts
<aron@socrates.berkeley.edu> wrote:
> Hi Sébastien,
>
> On Fri, Sep 28, 2012 at 3:25 PM, Rick Jaffe <rjaffe@berkeley.edu> wrote:
>> I've been able to download an image using the services API similar to the one you tried in your iReport by including the authentication credentials in the body of the GET URL:
>>
>> curl http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/derivatives/Medium/content -o /tmp/Southern_Right_Whale_101_Medium.jpg
>>
>> Would this work within your iReport?
>
> Expanding just a bit on Rick's excellent suggestion here, if iReport
> doesn't give you some way to independently specify the username and
> password you need to supply in order to download an image file via
> CollectionSpace's services layer, you can instead try embedding that
> username and password directly into the URL, using this
> Internet-standard syntax (from RFC 1738,
> http://www.rfc-editor.org/rfc/rfc1738.txt):
>
> http://<user>:<password>@<host>:<port>/<url-path>
>
> Since a CollectionSpace username is an email address, which contains
> an 'at sign' ('@'), you'll need to encode that character as '%40', as
> Rick has shown in his example above. Hence if you were trying to
> download an image file as the user 'admin@core.collectionspace.org",
> with the password "Administrator", from the CollectionSpace server at
> the host "demo.collectionspace.org" at port 8180, the URL would begin
> like this:
>
> http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/...
>
> Aron
>
>> On Sep 28, 2012, at 2:42 PM, Aron Roberts wrote:
>>
>>> Thanks much, Rick!
>>>
>>> A bit more on file corruption when downloading image files from
>>> CollectionSpace (or any other source) via the command-line 'curl'
>>> utility:
>>>
>>> Curl's '-i" option (which spits out HTTP headers to the console, and
>>> for that reason is ordinarily very useful) seems to be what's
>>> corrupting the JPEG images. When using that option, saved image files
>>> begin with bits of extraneous text - the HTTP headers - which corrupts
>>> them. Apparently adding the '--dump-header' option (which dumps HTTP
>>> headers to a file, if given an optional filename argument),
>>> counteracts that by suppressing the output of '-i', and allows the
>>> images to be saved without corruption.
>>>
>>> By implication, by omitting *both* options, -i and --dump-header, you
>>> can still successfully save JPEG images via curl; I was just now able
>>> to do so under Mac OS X, with the saved image viewable in OS X's
>>> Preview application.
>>>
>>> curl -u admin@core.collectionspace.org:Administrator
>>> http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
>>> -o PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
>>>
>>> Aron
>>>
>>> On Fri, Sep 28, 2012 at 1:51 PM, Rick Jaffe <rjaffe@berkeley.edu> wrote:
>>>> Sébastien,
>>>>
>>>> I've just had success downloading an image using cURL. It wouldn't open in
>>>> Preview.app on the Mac, though, until I added the option that dumped the
>>>> headers. Perhaps something similar is happening in your case #2 below?
>>>>
>>>> Here's the cURL command I ran against demo.collectionspace.org (the -o
>>>> option saves the bits as a file):
>>>>
>>>> curl --dump-header -i -u admin@core.collectionspace.org:Administrator
>>>> http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/content
>>>> -o
>>>> PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Right_Whale_8.jpg
>>>>
>>>> Rick
>>>>
>>>>
>>>>
>>>> Rick Jaffe
>>>> University of California Berkeley
>>>> IST-Research & Content Technologies
>>>> 250-32 Earl Warren Hall (2195 Hearst) #4876
>>>> Berkeley, CA 94720-4876
>>>> (510) 642-0590
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
>>>>
>>>> Dear all,
>>>>
>>>> I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
>>>> It worked pretty well until I had to insert dynamic images in the report
>>>> (i.e. media related to the CollectionObject shown in the report).
>>>>
>>>> There are two mains points here:
>>>>
>>>> 1/
>>>>
>>>> Having created an Image field, I tried to access image through URL:
>>>>
>>>> <image scaleImage="RealSize">
>>>> <reportElement positionType="Float" x="6" y="256"
>>>> width="165" height="115" isPrintWhenDetailOverflows="true"/>
>>>> <imageExpression class="java.awt.Image">
>>>>
>>>> <![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973-4aae-b3ef/blob/derivatives/Medium/content
>>>> ")]]>
>>>> </imageExpression>
>>>> </image>
>>>>
>>>> Unfortunately I got a blank "Authentication required" popup back in
>>>> iReport's main windows.
>>>> Chris told me that I had to set HTTP' Authentication header to my request
>>>> but... how?! Where in iReport?!
>>>> After crawling the Web, results are poor (not to say worrying, as this same
>>>> problem has been on Stackoverflow’s website for the past two years waiting
>>>> for an answer)
>>>>
>>>>
>>>> 2/
>>>>
>>>> Anyway, I managed to get the media by another mean (which is not pretty, I
>>>> must admit):
>>>>
>>>> <image scaleImage="RealSize">
>>>> <reportElement positionType="Float" x="6" y="256"
>>>> width="165" height="115" isPrintWhenDetailOverflows="true"/>
>>>> <imageExpression class="java.awt.Image">
>>>>
>>>> <![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
>>>> </imageExpression>
>>>> </image>
>>>>
>>>>
>>>> But here, I’m still not able to show the picture in the report.
>>>> It seems like I’ve used all possible <imageExpression> type combinations.
>>>> I used also an image loader (i.e.
>>>> “net.sf.jasperreports.engine.util.JRImageLoader.loadImage”) but without any
>>>> success.
>>>> (remark: using an URL pointing to a “jpeg” file works well).
>>>>
>>>> Question is, what is exactly the format returned by this kind of request
>>>> (i.e.
>>>> http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
>>>>
>>>> Thank you by advance for your kindly help.
>>>>
>>>> Best regards,
>>>>
>>>> Sébastien
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>>
>>
SB
Sébastien Brossard
Mon, Oct 1, 2012 2:38 PM
Hi all,
Thank you very much for your help.
Rick and Aron, your curl command worked:
curl http://admin%40smk.dk:Administrator@csdev-seb:8180/cspace-services/media/1923b43b-0e5f-4b7c-ab96/blob/derivatives/Medium/content -o /tmp/billede.jpg
... and I was able to download the picture (or at least to download something, since the file couldn't be properly read - but at least the CS's log seemed to show that the blob was read.)
After that, I used the link in the following image expression in iReport:
String.format("http://admin%%40smk.dk:Administrator@csdev-seb:8180/cspace-services/media/%s/blob/derivatives/Medium/content", $F{mediacsid})
... and it worked well in iReport's preview windows - although I had to insert manually the id/pwd in a logging window that popped-up on my first try.
Thus, it was not a total surprise that, once the .jasper file was generated and placed in /usr/local/share/apache-tomcat-6.0.33/cspace/reports, I still got a 401 access error in CollectionSpace when trying to visualize the report - here's an excerpt from the log:
java.io.IOException::Server returned HTTP response code: 401 for URL: http://admin%40smk.dk:Administrator@csdev-seb:8180/cspace-services/media/1923b43b-0e5f-4b7c-ab96/blob/derivatives/Medium/content
I don't know nothing about the working protocol and interactions between the JasperReport server and CollectionSpace, and I can't really understand why CollectionSpace reacts differently when I make a call through curl than when I do it through Japser.
Looking on the web, I found out this security file in JasperReport (applicationContext-security.xml) could be the answer... but it seems quite complex (linkhttp://blog.springsource.com/2010/03/06/behind-the-spring-security-namespace/ found in the comments of CollectionSpace's applicationContext-security.xml) and I hasn't made a breakthrough yet - still has to figure out what is this file really about, and if it's helpful at all.
Anyway, any idea would be of great help! Thank you by advance -again- for your kind help.
Best regards,
Sébastien
-----Oprindelig meddelelse-----
Fra: aronroberts@gmail.com [mailto:aronroberts@gmail.com] På vegne af Aron Roberts
Sendt: 29. september 2012 01:44
Til: Sébastien Brossard
Cc: Rick Jaffe; CollectionSpace Talk List
Emne: Re: [Talk] iReport - insert image blob
One more thing about which Rick reminded me:
Any credentials (such as a username and password) that might be stored in any persistent way are sensitive data, and need to be protected appropriately.
As well, if you haven't already done so, you might consider creating a special CollectionSpace account to use when generating these reports that is associated with a very limited role, one which has been granted only the minimum privileges required, such as read-only privileges only on some selected record types.
On Fri, Sep 28, 2012 at 3:50 PM, Aron Roberts <aron@socrates.berkeley.edumailto:aron@socrates.berkeley.edu> wrote:
I've been able to download an image using the services API similar to the one you tried in your iReport by including the authentication credentials in the body of the GET URL:
space.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/der
ivatives/Medium/content -o /tmp/Southern_Right_Whale_101_Medium.jpg
Would this work within your iReport?
Expanding just a bit on Rick's excellent suggestion here, if iReport
doesn't give you some way to independently specify the username and
password you need to supply in order to download an image file via
CollectionSpace's services layer, you can instead try embedding that
username and password directly into the URL, using this
Internet-standard syntax (from RFC 1738,
Since a CollectionSpace username is an email address, which contains
an 'at sign' ('@'), you'll need to encode that character as '%40', as
Rick has shown in his example above. Hence if you were trying to
with the password "Administrator", from the CollectionSpace server at
the host "demo.collectionspace.org" at port 8180, the URL would begin
On Sep 28, 2012, at 2:42 PM, Aron Roberts wrote:
A bit more on file corruption when downloading image files from
CollectionSpace (or any other source) via the command-line 'curl'
Curl's '-i" option (which spits out HTTP headers to the console, and
for that reason is ordinarily very useful) seems to be what's
corrupting the JPEG images. When using that option, saved image
files begin with bits of extraneous text - the HTTP headers - which
corrupts them. Apparently adding the '--dump-header' option (which
dumps HTTP headers to a file, if given an optional filename
argument), counteracts that by suppressing the output of '-i', and
allows the images to be saved without corruption.
By implication, by omitting both options, -i and --dump-header,
you can still successfully save JPEG images via curl; I was just now
able to do so under Mac OS X, with the saved image viewable in OS
5a6b-47f4-ace1/blob/content -o
PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Rig
I've just had success downloading an image using cURL. It wouldn't
open in Preview.app on the Mac, though, until I added the option
that dumped the headers. Perhaps something similar is happening in your case #2 below?
Here's the cURL command I ran against demo.collectionspace.org (the
-o option saves the bits as a file):
-5a6b-47f4-ace1/blob/content
PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Ri
University of California Berkeley
IST-Research & Content Technologies
250-32 Earl Warren Hall (2195 Hearst) #4876 Berkeley, CA
On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
It worked pretty well until I had to insert dynamic images in the
report (i.e. media related to the CollectionObject shown in the report).
There are two mains points here:
Having created an Image field, I tried to access image through URL:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973
-4aae-b3ef/blob/derivatives/Medium/content
</imageExpression> </image>
Unfortunately I got a blank "Authentication required" popup back in
Chris told me that I had to set HTTP' Authentication header to my
request but... how?! Where in iReport?!
After crawling the Web, results are poor (not to say worrying, as
this same problem has been on Stackoverflow's website for the past
two years waiting for an answer)
Anyway, I managed to get the media by another mean (which is not
<image scaleImage="RealSize">
<reportElement positionType="Float" x="6" y="256"
width="165" height="115" isPrintWhenDetailOverflows="true"/>
<imageExpression class="java.awt.Image">
<![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
</imageExpression> </image>
But here, I'm still not able to show the picture in the report.
It seems like I've used all possible <imageExpression> type combinations.
I used also an image loader (i.e.
"net.sf.jasperreports.engine.util.JRImageLoader.loadImage") but without any
(remark: using an URL pointing to a "jpeg" file works well).
Question is, what is exactly the format returned by this kind of request
Thank you by advance for your kindly help.
Hi all,
Thank you very much for your help.
Rick and Aron, your curl command worked:
curl http://admin%40smk.dk:Administrator@csdev-seb:8180/cspace-services/media/1923b43b-0e5f-4b7c-ab96/blob/derivatives/Medium/content -o /tmp/billede.jpg
... and I was able to download the picture (or at least to download something, since the file couldn't be properly read - but at least the CS's log seemed to show that the blob was read.)
After that, I used the link in the following image expression in iReport:
String.format("http://admin%%40smk.dk:Administrator@csdev-seb:8180/cspace-services/media/%s/blob/derivatives/Medium/content", $F{mediacsid})
... and it worked well in iReport's preview windows - although I had to insert manually the id/pwd in a logging window that popped-up on my first try.
Thus, it was not a total surprise that, once the .jasper file was generated and placed in /usr/local/share/apache-tomcat-6.0.33/cspace/reports, I still got a 401 access error in CollectionSpace when trying to visualize the report - here's an excerpt from the log:
java.io.IOException::Server returned HTTP response code: 401 for URL: http://admin%40smk.dk:Administrator@csdev-seb:8180/cspace-services/media/1923b43b-0e5f-4b7c-ab96/blob/derivatives/Medium/content
I don't know nothing about the working protocol and interactions between the JasperReport server and CollectionSpace, and I can't really understand why CollectionSpace reacts differently when I make a call through curl than when I do it through Japser.
Looking on the web, I found out this security file in JasperReport (applicationContext-security.xml) could be the answer... but it seems quite complex (link<http://blog.springsource.com/2010/03/06/behind-the-spring-security-namespace/> found in the comments of CollectionSpace's applicationContext-security.xml) and I hasn't made a breakthrough yet - still has to figure out what is this file really about, and if it's helpful at all.
Anyway, any idea would be of great help! Thank you by advance -again- for your kind help.
Best regards,
Sébastien
-----Oprindelig meddelelse-----
Fra: aronroberts@gmail.com [mailto:aronroberts@gmail.com] På vegne af Aron Roberts
Sendt: 29. september 2012 01:44
Til: Sébastien Brossard
Cc: Rick Jaffe; CollectionSpace Talk List
Emne: Re: [Talk] iReport - insert image blob
One more thing about which Rick reminded me:
Any credentials (such as a username and password) that might be stored in any persistent way are sensitive data, and need to be protected appropriately.
As well, if you haven't already done so, you might consider creating a special CollectionSpace account to use when generating these reports that is associated with a very limited role, one which has been granted only the minimum privileges required, such as read-only privileges only on some selected record types.
On Fri, Sep 28, 2012 at 3:50 PM, Aron Roberts <aron@socrates.berkeley.edu<mailto:aron@socrates.berkeley.edu>> wrote:
> Hi Sébastien,
>
> On Fri, Sep 28, 2012 at 3:25 PM, Rick Jaffe <rjaffe@berkeley.edu<mailto:rjaffe@berkeley.edu>> wrote:
>> I've been able to download an image using the services API similar to the one you tried in your iReport by including the authentication credentials in the body of the GET URL:
>>
>> curl
>> http://admin%40core.collectionspace.org:Administrator@demo.collection
>> space.org:8180/cspace-services/media/9b5c1b2e-5a6b-47f4-ace1/blob/der
>> ivatives/Medium/content -o /tmp/Southern_Right_Whale_101_Medium.jpg
>>
>> Would this work within your iReport?
>
> Expanding just a bit on Rick's excellent suggestion here, if iReport
> doesn't give you some way to independently specify the username and
> password you need to supply in order to download an image file via
> CollectionSpace's services layer, you can instead try embedding that
> username and password directly into the URL, using this
> Internet-standard syntax (from RFC 1738,
> http://www.rfc-editor.org/rfc/rfc1738.txt):
>
> http://<user>:<password>@<host>:<port>/<url-path<http://%3cuser%3e:%3cpassword%3e@%3chost%3e:%3cport%3e/%3curl-path>>
>
> Since a CollectionSpace username is an email address, which contains
> an 'at sign' ('@'), you'll need to encode that character as '%40', as
> Rick has shown in his example above. Hence if you were trying to
> download an image file as the user 'admin@core.collectionspace.org",
> with the password "Administrator", from the CollectionSpace server at
> the host "demo.collectionspace.org" at port 8180, the URL would begin
> like this:
>
> http://admin%40core.collectionspace.org:Administrator@demo.collectionspace.org:8180/...
>
> Aron
>
>> On Sep 28, 2012, at 2:42 PM, Aron Roberts wrote:
>>
>>> Thanks much, Rick!
>>>
>>> A bit more on file corruption when downloading image files from
>>> CollectionSpace (or any other source) via the command-line 'curl'
>>> utility:
>>>
>>> Curl's '-i" option (which spits out HTTP headers to the console, and
>>> for that reason is ordinarily very useful) seems to be what's
>>> corrupting the JPEG images. When using that option, saved image
>>> files begin with bits of extraneous text - the HTTP headers - which
>>> corrupts them. Apparently adding the '--dump-header' option (which
>>> dumps HTTP headers to a file, if given an optional filename
>>> argument), counteracts that by suppressing the output of '-i', and
>>> allows the images to be saved without corruption.
>>>
>>> By implication, by omitting *both* options, -i and --dump-header,
>>> you can still successfully save JPEG images via curl; I was just now
>>> able to do so under Mac OS X, with the saved image viewable in OS
>>> X's Preview application.
>>>
>>> curl -u admin@core.collectionspace.org:Administrator<mailto:admin@core.collectionspace.org:Administrator>
>>> http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e-
>>> 5a6b-47f4-ace1/blob/content -o
>>> PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Rig
>>> ht_Whale_8.jpg
>>>
>>> Aron
>>>
>>> On Fri, Sep 28, 2012 at 1:51 PM, Rick Jaffe <rjaffe@berkeley.edu<mailto:rjaffe@berkeley.edu>> wrote:
>>>> Sébastien,
>>>>
>>>> I've just had success downloading an image using cURL. It wouldn't
>>>> open in Preview.app on the Mac, though, until I added the option
>>>> that dumped the headers. Perhaps something similar is happening in your case #2 below?
>>>>
>>>> Here's the cURL command I ran against demo.collectionspace.org (the
>>>> -o option saves the bits as a file):
>>>>
>>>> curl --dump-header -i -u
>>>> admin@core.collectionspace.org:Administrator<mailto:admin@core.collectionspace.org:Administrator>
>>>> http://demo.collectionspace.org:8180/cspace-services/media/9b5c1b2e
>>>> -5a6b-47f4-ace1/blob/content
>>>> -o
>>>> PATH/TO/WHERE/ON/YOUR/MACHINE/YOU/WANT/TO/SAVE/THE/FILE/Southern_Ri
>>>> ght_Whale_8.jpg
>>>>
>>>> Rick
>>>>
>>>>
>>>>
>>>> Rick Jaffe
>>>> University of California Berkeley
>>>> IST-Research & Content Technologies
>>>> 250-32 Earl Warren Hall (2195 Hearst) #4876 Berkeley, CA
>>>> 94720-4876
>>>> (510) 642-0590
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Sep 26, 2012, at 7:26 AM, Sébastien Brossard wrote:
>>>>
>>>> Dear all,
>>>>
>>>> I'm currently working with reports on CS v2.6 (and iReport v4.0.2)
>>>> It worked pretty well until I had to insert dynamic images in the
>>>> report (i.e. media related to the CollectionObject shown in the report).
>>>>
>>>> There are two mains points here:
>>>>
>>>> 1/
>>>>
>>>> Having created an Image field, I tried to access image through URL:
>>>>
>>>> <image scaleImage="RealSize">
>>>> <reportElement positionType="Float" x="6" y="256"
>>>> width="165" height="115" isPrintWhenDetailOverflows="true"/>
>>>> <imageExpression class="java.awt.Image">
>>>>
>>>> <![CDATA["http://csdev-seb:8180/cspace-services/media/741093bc-3973
>>>> -4aae-b3ef/blob/derivatives/Medium/content
>>>> ")]]>
>>>> </imageExpression> </image>
>>>>
>>>> Unfortunately I got a blank "Authentication required" popup back in
>>>> iReport's main windows.
>>>> Chris told me that I had to set HTTP' Authentication header to my
>>>> request but... how?! Where in iReport?!
>>>> After crawling the Web, results are poor (not to say worrying, as
>>>> this same problem has been on Stackoverflow's website for the past
>>>> two years waiting for an answer)
>>>>
>>>>
>>>> 2/
>>>>
>>>> Anyway, I managed to get the media by another mean (which is not
>>>> pretty, I must admit):
>>>>
>>>> <image scaleImage="RealSize">
>>>> <reportElement positionType="Float" x="6" y="256"
>>>> width="165" height="115" isPrintWhenDetailOverflows="true"/>
>>>> <imageExpression class="java.awt.Image">
>>>>
>>>> <![CDATA["http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium")]]>
>>>> </imageExpression> </image>
>>>>
>>>>
>>>> But here, I'm still not able to show the picture in the report.
>>>> It seems like I've used all possible <imageExpression> type combinations.
>>>> I used also an image loader (i.e.
>>>> "net.sf.jasperreports.engine.util.JRImageLoader.loadImage") but without any
>>>> success.
>>>> (remark: using an URL pointing to a "jpeg" file works well).
>>>>
>>>> Question is, what is exactly the format returned by this kind of request
>>>> (i.e.
>>>> http://csdev-seb:8180/collectionspace/tenant/smk/download/f42214dd-0599-4862-8cf2/Medium?)
>>>>
>>>> Thank you by advance for your kindly help.
>>>>
>>>> Best regards,
>>>>
>>>> Sébastien
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org>
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org>
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>>
>>