ViewerJS needs index.html to be accessible

122 views
Skip to first unread message

j...@kassebaum.net

unread,
Jun 24, 2016, 3:37:13 PM6/24/16
to Hippo Community
I am trying to install and use ViewerJS as PDF and document viewer for documents stored with my CMS. I have placed the ViewerJS in the webapps folder and it is delivered/deployed to the platform root next to WEB-INF and META-INF, but the index.html inside the folder is not accessible (404 - File not found). I believe this is because all .html files get URL-rewritten to access the site's web files in the CMS. AFAIK, I am using very recent Hippo CMS 10. How can I tell it to not re-write for the ViewerJS or make the files in its folder accessible? 
-John

Minos Chatzidakis

unread,
Jun 27, 2016, 4:49:25 AM6/27/16
to Hippo Community
Hi Jak,

Can you be a bit more specific? From your email I cannot even tell whether you're trying this on the CMS or on the site. Since you mentioned 'webfiles' I assume you're talking about the site. How is that deployed? As root application? Have you tried /site/index.html? Are you trying this locally or on some server?

thanks,
Minos
--

On Fri, Jun 24, 2016 at 9:37 PM, <j...@kassebaum.net> wrote:
I am trying to install and use ViewerJS as PDF and document viewer for documents stored with my CMS. I have placed the ViewerJS in the webapps folder and it is delivered/deployed to the platform root next to WEB-INF and META-INF, but the index.html inside the folder is not accessible (404 - File not found). I believe this is because all .html files get URL-rewritten to access the site's web files in the CMS. AFAIK, I am using very recent Hippo CMS 10. How can I tell it to not re-write for the ViewerJS or make the files in its folder accessible? 
-John

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.



--

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - Inc. 71 Summer Street, 2nd Floor, MA 02110

Jasper Floor

unread,
Jun 27, 2016, 5:33:09 AM6/27/16
to Hippo Community
I'm not sure you are deploying correctly if I understand you. If you deploy it as a separate web app then it shouldn't be next to WEB-INF, it should be directly in the webapps folder.

mvg,
Jasper

j...@kassebaum.net

unread,
Jun 27, 2016, 3:28:02 PM6/27/16
to Hippo Community
HI Minos!

I am currently just working in the cargo build ... but the issue will be exactly the same during actually deployment. Here is some background:  The ViewerJS component wraps the PDF.js stuff but has an entry point which is an HTML file. It is designed to be deployed as a folder under the root of a website (e.g. http://localhost:8080/site/ViewerJS/). Then one addresses a locally stored PDF file using an anchor tag (e.g. <a href="http://localhost:8080/site/ViewerjsJS/#../docs/pdf-sample.pdf">). Inside of the ViewerJS folder there is an "index.html" file which is the entry point for the component. That html file uses the argument (e.g. "../docs/pdf-sample.pdf") to obtain the file to display. Here is a link to the basic info on it if that would help: "http://viewerjs.org/instructions/".

It is obvious that the site.war unpacks to include my ViewerJS folder in the root of 'site'. But I cannot access the index.html file. I can access the docs/pdf-sample.pdf file though.

My belief is that the index.html - which is the entry point - is inaccessible since it is not mapped in the sitemap, nor is there any prefix exclude type function that could prevent some kind of URL rewriting. If I could figure out how to allow the tomcat to access the ViewerJS folder without URL rewriting for the html files(s) then I think it would work.

Please ask more questions - maybe I will see where the issue really is or how to fix!

Thanks!!
-John

j...@kassebaum.net

unread,
Jun 27, 2016, 3:31:25 PM6/27/16
to Hippo Community
Hi Jasper,

I suppose I could reply it as a separate app - maybe that would get around the sitemap/url-rewrite issue. I've been trying to get it to unpack from the site.war. It clearly does get put there ... but I can't access the index.html file inside the ViewerJS folder. I assume this is because it is not in the sitemap nor is there any way to exclude the "/ViewerJS/" folder from being mapped into Hippo.  Doe that make it any clearer? I suspect there is either something I don't know how to turn on/off, or I misunderstand the CMS model in some critical way.

-John

Jasper Floor

unread,
Jun 28, 2016, 2:59:34 AM6/28/16
to Hippo Community

Minos Chatzidakis

unread,
Jun 28, 2016, 4:16:09 AM6/28/16
to Hippo Community
On Tue, Jun 28, 2016 at 8:59 AM, Jasper Floor <j.f...@onehippo.com> wrote:


Yes that would be my advice too. Add an entry for anything below /viewer/. Specifically, I think it would work if you just import the following under /hst:hst/hst:configurations/hst:default/hst:sitemap

<?xml version="1.0" encoding="UTF-8"?>
<sv:node sv:name="viewer" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>hst:sitemapitem</sv:value>
  </sv:property>
  <sv:property sv:name="hst:containerresource" sv:type="Boolean">
    <sv:value>true</sv:value>
  </sv:property>
  <sv:node sv:name="_any_">
    <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>hst:sitemapitem</sv:value>
    </sv:property>
    <sv:property sv:name="hst:containerresource" sv:type="Boolean">
      <sv:value>true</sv:value>
    </sv:property>
  </sv:node>
</sv:node>

Wanna give it a try?

hth
Minos
--

Dr. John A. Kassebaum PhD, PE

unread,
Jun 28, 2016, 12:20:48 PM6/28/16
to hippo-c...@googlegroups.com
Thanks Minos and Jasper!  

I imported the supplied XML into the '/hst:hst/hst:configurations/hst:default/hst:sitemap’ and changed the name to “ViewerJS” and it worked perfectly!!

Thanks again and best regards!
-John

You received this message because you are subscribed to a topic in the Google Groups "Hippo Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hippo-community/gusqOswy8jE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hippo-communi...@googlegroups.com.

--
John A. Kassebaum, PhD PE AC9JX





Minos Chatzidakis

unread,
Jun 28, 2016, 1:05:26 PM6/28/16
to Hippo Community
Great to hear that! Indeed I just tested with 'viewer' when I exported the xml..  saw your path later..

cheers,
Minos
Reply all
Reply to author
Forward
0 new messages