Closed gioppoluca closed 8 years ago
Well, files are indeed saved in JackRabbit, the problem is retrieving them once you have the URL. There is a eu.cloudopting.store.StoreService.getDocumentAsStream(String) method that MIGHT do what you are asking and that was originally pushed by @ciprianpavel .
The default Repository.login() method starts a repository session using the default workspace and no user credentials. Jackrabbit tries to use the Java Authentication and Authorization Service (JAAS) configuration in such cases, but defaults to the anonymous user if a JAAS Subject is not found.
(Source: http://jackrabbit.apache.org/jcr/first-hops.html ) Someone with expertise in Spring/Spring Boot should tell us if it is possible to "propagate" JAAS credentials to JackRabbit.
I would go for an easier approach: UI call API -> API call HTTP JR -> outstream of second become request answer of first, very straightforward. Or get stream. In any case we agree we need an API to do proxy so let us create it so we can remove errors in UI. Guido create the API in the rest_component. Create a dedicated controller call it ImageController, than Xavi will call that API in the catalogue. Once you create the API that return a fixed image, you start working on proxying to JR while @xeviscc integrate it in UI
If you use the existing methods you should manage to get the file from JR without having problems or if you need the credentials you just get them from the properties either way you are good to go. Better not mess with that part now
Fixed in commit 07f0d94 Check JcrImageResource.java To get a JR image you will have to send a GET HTTP Request to "/jr/img" with the ABSOLUTE JackRabbit Path in the "jcrPath" Request Parameter.
OK we have a problem. JR has auth so images do not get loaded in the catalogue. Any idea is wellcome apart from removing auth to JR @guidospadotto-profesia also for you this one.
Shall we think about final deployment? Could we have a rest that does a proxy to JR? an API we call in the image source and in the java API we execute the get of the image to JR and return the image type? If agree open an issue or work on this one