11-22-2016 06:00 AM
Hi,
This is simply question from a newbie :
- how can I display an image from the repository in a web page ? (without login...)
(for example on a webpage <img src="myimage.jpg">)
Actually,
I've got a webscript "MyWebScript" that I can't modidy (I don't have access to the server system), but I override it with Share (in "/Company Home/Data Dictionary/Web Scripts/MyWebScript")
It works fine with the page.get.html.ftl file (and others) but doesn't work to override a JS script
I've got an amp file and I found this :
In one hand i've got :
\alfresco\config\alfresco\extension\templates\webscripts\fr\MyWebScript\page.get.html.ftl (and other files)
and in the other hand i've got :
\alfresco\source\web\scripts\MyWebScript\myscript.js (and other files)
My second question is "How can override "myscript.js" from share ?"
I tryed many ways but all failed.
Thanks a lot to help me to find anwsers to this 2 questions (hope you understand me -_-')
____________
Wtih Alfresco Community 4.2.f
11-22-2016 10:57 AM
I'm sorry I'm not clear about what you mean.
I guess you can implement an proxy servlet in your application ,in your proxy servlet download the image from alfresco server using opencmis api or webscript api and then display it in a web page.
11-23-2016 03:59 AM
Thank you for trying to help me.
First of all, I'd just like to display an image (put in my repository "/Company Home/Data Dictionary/Web Scripts/MyWebScript" or in Guest space...), in a web page with <img src="myimage.jpg" />
but Alfresco asks credentials...
after, it displays :
"status" : { "code" : 401, "name" : "Unauthorized", "description" : "The request requires HTTP authentication." }, "message" : "10230046 Authentication failed for Web Script org\/alfresco\/api\/opencmis\/OpenCMIS.get",
Secondly, I'd like to override JS Script of my webscript (URL is "/alfresco/scripts/myscript/validate-fields-config.js")
11-24-2016 08:25 AM
Anybody knows ? (or understands what i meant ?)
Thx
11-24-2016 08:53 AM
Almost all of the URL request to alfresco requires authentication,you can't use it like <img src="myimage.jpg" /> directly.
Only after login and get a login ticket then you can visit url https://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom/content?id=f2b90ae5-b590....
What you need to do is to use a proxy servlet,in your proxy servlet:
you can login to alfresco and get the ticket or you can just download the image.
02-10-2017 09:44 AM
I found a solution that works with any file, but I don't know if it's a good way.
YOURSTRING is for ex TqGniKKbRMiFtwOtdkwZQghttps://localhost/share/proxy/alfresco-noauth/api/internal/shared/node/YOURSTRING/content/NAMEFILE
Then you can for example display an image from Alfresco repository like this :
<img src="https://localhost/share/proxy/alfresco-noauth/api/internal/shared/node/TqGniKKbRMiFtwOtdkwZQg/conten..." />
WARNING : When you share the file, it becomes a public file ! So becareful what you share
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.