Wiki source code of Placing Resources

Last modified by Normann P. Nielsen on 2013/01/27 10:30

Hide last authors
Normann P. Nielsen 1.1 1 {{toc/}}
2
3 Every Site typically needs a lot of resources for styling, that being Images, JavaScript files, CSS Files etc etc.
4
5 You have several options for placing these:
6
7 == In the filesystem below the Confluence Install ==
8 The is typically a bad idea (thumbs-down) as it required filesystem access to the Confluence server, and every upgrade removes the files backing them up to a zip file
9
10 == In the filesystem outside the Confluence install ==
11 This is a better idea, as the upgrade does not touch the files, but 2 steps are required (and has to be repeated after upgrades):
12
13 **Allow Tomcat to get files outsite the TOMCAT home**
14
15 The server.xml file has to be changed adding the allowedLinked parameter:
16
17
18 {{code}}
19  <Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true" allowLinking="true">
20  
21 {{/code}}
22
23 **Making one or more SymLinks to the resources**
24
25 This could be similar to:
26
27
28 {{code}}
29 cd CONFLUENCE_HOME/confluence/
30 ln -s /data/staticresources staticressouces
31 {{/code}}
32
33 Hence, the resouces can be reached at [[http://www.mysite.dk/staticresources/mycss.css]]
34
35 Still, filesystemaccess and post-upgrade tasks are required (thumbs-down)
36
37 {{error}}The symbolic link(s) should be removed before upgrading via the binary installer, as this see all files under the symlink as changed files in the installation. After upgrade, this symlink can be reestablished{{/error}}
38
39
40
41 == In a resource page or space  ==
42 Why not place all the needed resources in a page or as pace in many resources will be needed - this can be for each space where they are needed, or a dedicated resource space.
43
44 Create a space or page called "resources" and attach all needed files to the space's homepage
45
46 This has several advantages, as it is 100% GUI reachable and upgrades does not affect the attachments it anyway. (thumbs-up)
47
48 Also, Attachement are version controlled, making changes, testing and possible rollbacks much easier (thumbs-up)
49
50 Do notice, that the space and the resources attached to the space has to be reachable to all users (maybe including anonymous also) - but You can include a custom redirect on the page or space home- and pages for users, see [[Using the Customware Redirection Plugin>>Main.atlassian.atlassian-confluence.styling-confluence.using-the-customware-redirection-plugin]]
51
52 This is a sample of my Resource Page for Mos-Eisley:
53
54 [[image:SampleResourcePage.jpg||width="300"||height="295"||alt="SampleResourcePage.jpg"]]
55
56 == On a(nother) static Webserver ==
57 You could have the static files on another webserver, but this leaves out the niceness regarding versioning and 100% GUI styling.