cancel
Showing results for 
Search instead for 
Did you mean: 

html file downloaded by browser instead of opened in webdav

ltendi
Champ on-the-rise
Champ on-the-rise

I'm migrating the contents from alfresco 3.3 to alfresco 5.2.

I'm moving contents using webdav from alfresco repository 3.3 to alfresco repository 5.2.

During the time, users created html documentation using tools like "mind manager": This creates  static web site.  This site was uploaded on alfresco repository and users were able to navigate it accessing it via webdav.  This feature is not working anymore.  I'm not sure if this is a bug or not. I'm sure that alfresco should be able to satisfy my simple requirement but I did not find how.   I also read and install "quick web start" but seems to me that it is not addressing my needs: is  there somebody that can give me an example of the easier way to address my needs and suggest the relevant documentation to read?

Follows the description and analysys of the different behaviour experienced between the old and new versions of the alfresco product.

Into the 3.3 alfresco contents there are some websites that I uploaded using "import from zip" feature that was available on 3.3 version. Uploading the contents in this way I was able to access the web site hosted on alfresco via webdav: the browser was able to open the index.html and navigate  following the links absolute and relative.

this is the example of url:

http://10.9.133.203:8080/alfresco/webdav/Progetti/Architetture%20%26%20Soluzioni/Progetto%20CCE%20Po...

After migration I noted that the same websites migrated on alfresco 5.2 was not anymore accessible because clicking on the same index.html, the file is downloaded instead of opened into the browser. Looking at a sniffer trace I realized that when connected to the alfresco 5.2 the server adds into the header the Content-Disposition: attachment property that instructs the browser to download the file instead of open it.

Header 1
..-NHCt&..G...E.../.@.<.g............P}s.g....P...F...HTTP/1.1 200 OK..Server: Apache-Coyote/1.1..ETag: "cabce3d7-6822-44d3-b78b-7c15fb2d0ba4_1504713452943"..Last-Modified: Wed, 06 Sep 2017 15:57:32 GMT..Content-Disposition: attachment; filename="index.html"; filename*=UTF-8''index.html..Content-Type: text/html..Content-Length: 13590..Date: Fri, 15 Sep 2017 09:05:25 GMT....<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"..."http://www.w3.org/TR/html4/loose.dtd">..<html>..<head>..   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">..   <title>BackupXML</title>..</head>

The same on the alfresco 3.3 returns as follows:

Header 1
..-NHCt&..G...E...>5@.<.YW...........k...=...]P..lt...HTTP/1.1 200 OK..Server: Apache-Coyote/1.1..ETag: "f82abd25-c5ba-4b7b-9e9b-79396ffc471f_1494414244572"..Last-Modified: Wed, 10 May 2017 11:04:04 GMT..Content-Type: text/html..Content-Length: 13590..Date: Fri, 15 Sep 2017 09:25:11 GMT....<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"..."http://www.w3.org/TR/html4/loose.dtd">..<html>..<head>..   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">..   <title>BackupXML</title>

Is there somebody that can give me suggestions, configuration hints or workaround?

Regards Luciano

1 REPLY 1

mehe
Elite Collaborator
Elite Collaborator

As a workaround, you can use a "webserverish" web script - let's call it website:

website.get.desc.xml

<webscript kind="org.alfresco.repository.content.stream">
        <shortname>stream content</shortname>
        <description>Stream selected file (by path)</description>
        <url>/website/{filepath}</url>
        <format default="">argument</format>
        <authentication>user</authentication>
        <transaction>required</transaction>
</webscript>

website.get.js

function main() {
     var filepath=url.extension;
     var n=companyhome.childByNamePath(filepath);
     if (n!==null) {
          model.contentNode=n;
     } else {
          status.code = 405;
          status.message = filepath+" not found";
          status.redirect = true;
     }
}
main();
     

you would have to put a little more effort in this, it's just to show the basic stuff. 

For example, check if the node identified by filepath is a container/directory and serve <filepath>/index.html in this case...

Usage would be:

.../alfresco/service/website/<path to your website>/index.html

or

.../alfresco/wcservice/website/<path to your website>/index.html