Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Configure Tomcat to serve static files directly from filesystem
Configure Tomcat to serve static files directly from filesystem [message #803820] Tue, 21 February 2012 21:33 Go to next message
Jean-Pierre Bergamin is currently offline Jean-Pierre BergaminFriend
Messages: 51
Registered: March 2011
Location: Zürich, CH
Member
Hello Virgo users

This is a follow-up to this message on the tomcat users mailing list.

I'm trying to configure Tomcat to serve files directly from the filesystem.
I basically want to use this configuration:
<Context docBase="D:/Downloads/dojo-release-1.7.1-src" path="/dojo/1.7.1" />

This should make e.g. the file D:/Downloads/dojo-release-1.7.1-src/dojo/dojo.js available as http://localhost:8080/dojo/1.7.1/dojo/dojo.js

I tried several approaches which all did not work out:


  • Put the <Context ...> element in the <Host> entry for localhost in $VIRGO_SERVER$/config/tomcat-server.xml
  • Put the <Context ...> element in its on file in $VIRGO_SERVER$/config/Catalina/localhost/context.xml
  • Put the <Context ...> element in its on file in $VIRGO_SERVER$/config/Catalina/localhost/dojo.xml


Any idea how this can be achieved?


Best regards,
James
Re: Configure Tomcat to serve static files directly from filesystem [message #804333 is a reply to message #803820] Wed, 22 February 2012 13:50 Go to previous messageGo to next message
Violeta Georgieva is currently offline Violeta GeorgievaFriend
Messages: 278
Registered: October 2010
Senior Member
Hi,

You have two approaches that you can use depending on what exactly you need:

1. You can use Tomcat's aliases functionality (http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Standard_Implementation)

You need to deploy an "empty" web application that only describes in the Manifest which is the context-path (as this is the standard way for OSGi), and in the context.xml - aliases mapping (mapping to an external directory) - see attached example. Just copy the example in pickup folder.

In Virgo we do not support deployment via context.xml, also we recommend to provide context.xml via archive and not in <Virgo-Home>config/Catalina/localhost/<context-path>.xml because in OSGi it is allowed to have more than one web application bundles with one and the same context path installed on the system.

2. The second approach is with watched repository:
2.1. In <Virgo-Home>/config/org.eclipse.virgo.repository.properties specify:

my.type=watched
my.watchDirectory=C:/Downloads/watched_repo

chain=ext,usr,my


2.2. Under "C:/Downloads/watched_repo" extract the attached example.
2.3. Create folder "C:/Downloads/watched_repo/aliases/dojo" and put there your static files.
2.4. Create a plan and copy it in pickup folder.

<?xml version="1.0" encoding="UTF-8"?>
<plan name="my.plan" version="1.0.0" scoped="false" atomic="true"
        xmlns="http://www.eclipse.org/virgo/schema/plan"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
	        http://www.eclipse.org/virgo/schema/plan 
	        http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">

	<artifact type="bundle" name="dojo.1.7.1" version="1.0.0"/>
	
</plan>


In both cases you should be able to request http://localhost:8080/dojo/1.7.1/dojo/index.html (index.html for example)

Please let me know whether these approaches will work for your use case.

Regards
Violeta
  • Attachment: aliases.war
    (Size: 0.50KB, Downloaded 572 times)
Re: Configure Tomcat to serve static files directly from filesystem [message #807976 is a reply to message #804333] Mon, 27 February 2012 08:53 Go to previous messageGo to next message
Jean-Pierre Bergamin is currently offline Jean-Pierre BergaminFriend
Messages: 51
Registered: March 2011
Location: Zürich, CH
Member
Thanks for clarifying this, Violeta

Approach #1 just works perfectly and is exactly what we need.


Best regards,
James
Re: Configure Tomcat to serve static files directly from filesystem [message #808075 is a reply to message #807976] Mon, 27 February 2012 11:16 Go to previous messageGo to next message
Violeta Georgieva is currently offline Violeta GeorgievaFriend
Messages: 278
Registered: October 2010
Senior Member
Great
Re: Configure Tomcat to serve static files directly from filesystem [message #1424138 is a reply to message #808075] Mon, 15 September 2014 14:18 Go to previous message
Chris Werner is currently offline Chris WernerFriend
Messages: 2
Registered: September 2014
Junior Member
Why a watched folder?
Previous Topic:Bundles in usr and pickup behave differently
Next Topic:Virgo and Java 1.7 bundles
Goto Forum:
  


Current Time: Wed Apr 24 23:55:38 GMT 2024

Powered by FUDForum. Page generated in 0.02885 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top