Quantcast

Serving static files directly from filesystem

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Serving static files directly from filesystem

Jean-Pierre Bergamin
Hello tomcat users

I'm trying to configure tomcat 7 on Windows to serve static files. During
development I want to have uncompresses javascript files delivered directly
from the file system.
I followed this blog post
http://th1rty7.blogspot.com/2009/05/tomcat-is-often-considered-to-be-too.html
and
configured a context in the server.xml file like:

<Host name="localhost"  appBase="webapps"  unpackWARs="false"
autoDeploy="false"  deployOnStartup="false" createDirs="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="serviceability/logs/access"
    prefix="localhost_access_log." suffix=".txt" pattern="common"
resolveHosts="false"/>
<Valve
className="org.eclipse.virgo.web.tomcat.support.ApplicationNameTrackingValve"/>

<Context docBase="D:/Downloads/dojo-release-1.7.1-src" path="/dojo/1.7.1" />
</Host>

When I try to load a file i.e. with
http://localhost:8080/dojo/1.7.1/dojo/dojo.js I get a 404.
Any ideas what I am missing?
What could be a way to debug this?


Best regards,
James
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serving static files directly from filesystem

Christopher Schultz-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jean-Pierre,

On 2/21/12 11:04 AM, Jean-Pierre Bergamin wrote:
> I'm trying to configure tomcat 7 on Windows to serve static files.
> During development I want to have uncompresses javascript files
> delivered directly from the file system.

Serve uncompressed javascript files? That should be easy. (Why bother
to say "uncompressed". Presumably they are also unencrypted, and
un-obfuscated and a whole bunch of other things that they are not.)

> I followed this blog post
> http://th1rty7.blogspot.com/2009/05/tomcat-is-often-considered-to-be-too.html
>
>
and
> configured a context in the server.xml file like:

Bad premise (Tomcat is just fine when serving static content), bad
advice (configuring a <Context> in server.xml) and bad writing
(<Context> is an element, not a parameter).

> <Host name="localhost"  appBase="webapps"  unpackWARs="false"
> autoDeploy="false"  deployOnStartup="false" createDirs="false">
> <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="serviceability/logs/access"
> prefix="localhost_access_log." suffix=".txt" pattern="common"
> resolveHosts="false"/>

Why do you have deployOnStartup="false"?

> <Valve
> className="org.eclipse.virgo.web.tomcat.support.ApplicationNameTrackingValve"/>
>
>  <Context docBase="D:/Downloads/dojo-release-1.7.1-src"
> path="/dojo/1.7.1" />

Take the <Context> out of your server.xml and put it here:

CATALINA_BASE/conf/Catalina/localhost/dojo.xml:

<Context docBase="D:/Downloads/dojo-release-1.7.1-src" />

> When I try to load a file i.e. with
> http://localhost:8080/dojo/1.7.1/dojo/dojo.js I get a 404.

Okay. Where is the dojo.js file on the filesystem?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9D0r4ACgkQ9CaO5/Lv0PAHvQCdFVi4691RugJo7DhOyoyYuYLH
dYUAniOngqy/JLOoqTb1U6XKhfYrG6gA
=+U4I
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serving static files directly from filesystem

Jean-Pierre Bergamin
In reply to this post by Jean-Pierre Bergamin
Hello everyone

2012/2/21 Jean-Pierre Bergamin <[hidden email]>
>
> I'm trying to configure tomcat 7 on Windows to serve static files. During
> development I want to have uncompresses javascript files delivered directly
> from the file system.
> I followed this blog post
> http://th1rty7.blogspot.com/2009/05/tomcat-is-often-considered-to-be-too.html and
> configured a context in the server.xml file like:
>

I just found out why it does not work in my case. Tomcat is running inside
the Virgo OSGi container where the documentation [1] states:
"The following Tomcat features are not supported: <Context> elements."

So this explains why it is not working as expected.

But thanks for the help anyway.


Best regards,
James

[1]
http://www.eclipse.org/virgo/documentation/virgo-documentation-3.0.0.x/docs/virgo-programmer-guide/html/ch09s05.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serving static files directly from filesystem

Violeta Georgieva-2
Hi Jean,

It appears that we (Eclipse Virgo) have a bug in the documentation :(
Please report it in our bugzilla [1]

We do support <Context> element with several limitations - see user
documentation [2]

If you want let's continue the discussion in Virgo forum [3]?


[1] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Virgo
[2]
http://www.eclipse.org/virgo/documentation/virgo-documentation-3.0.2.RELEASE/docs/virgo-user-guide/html/ch11s07.html
-
Context Configuration chapter
[3] http://www.eclipse.org/forums/index.php?t=thread&frm_id=159

Best Regards
Violeta Georgieva

2012/2/21 Jean-Pierre Bergamin <[hidden email]>

> Hello everyone
>
> 2012/2/21 Jean-Pierre Bergamin <[hidden email]>
> >
> > I'm trying to configure tomcat 7 on Windows to serve static files. During
> > development I want to have uncompresses javascript files delivered
> directly
> > from the file system.
> > I followed this blog post
> >
> http://th1rty7.blogspot.com/2009/05/tomcat-is-often-considered-to-be-too.htmland
> > configured a context in the server.xml file like:
> >
>
> I just found out why it does not work in my case. Tomcat is running inside
> the Virgo OSGi container where the documentation [1] states:
> "The following Tomcat features are not supported: <Context> elements."
>
> So this explains why it is not working as expected.
>
> But thanks for the help anyway.
>
>
> Best regards,
> James
>
> [1]
>
> http://www.eclipse.org/virgo/documentation/virgo-documentation-3.0.0.x/docs/virgo-programmer-guide/html/ch09s05.html
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Serving static files directly from filesystem

Jean-Pierre Bergamin
Hi Violeta

2012/2/21 Violeta Georgieva <[hidden email]>
>
> It appears that we (Eclipse Virgo) have a bug in the documentation :(
> Please report it in our bugzilla [1]
>
 Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=372168


> We do support <Context> element with several limitations - see user
> documentation [2]
>
> If you want let's continue the discussion in Virgo forum [3]?
>
I created a new thread in the virgo forum:
http://www.eclipse.org/forums/index.php/m/803820/#msg_803820

Thanks so far,
James


> [1] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Virgo
> [2]
>
> http://www.eclipse.org/virgo/documentation/virgo-documentation-3.0.2.RELEASE/docs/virgo-user-guide/html/ch11s07.html
> -
> Context Configuration chapter
> [3] http://www.eclipse.org/forums/index.php?t=thread&frm_id=159
>
> Best Regards
> Violeta Georgieva
>
> 2012/2/21 Jean-Pierre Bergamin <[hidden email]>
>
> > Hello everyone
> >
> > 2012/2/21 Jean-Pierre Bergamin <[hidden email]>
> > >
> > > I'm trying to configure tomcat 7 on Windows to serve static files.
> During
> > > development I want to have uncompresses javascript files delivered
> > directly
> > > from the file system.
> > > I followed this blog post
> > >
> >
> http://th1rty7.blogspot.com/2009/05/tomcat-is-often-considered-to-be-too.htmland
> > > configured a context in the server.xml file like:
> > >
> >
> > I just found out why it does not work in my case. Tomcat is running
> inside
> > the Virgo OSGi container where the documentation [1] states:
> > "The following Tomcat features are not supported: <Context> elements."
> >
> > So this explains why it is not working as expected.
> >
> > But thanks for the help anyway.
> >
> >
> > Best regards,
> > James
> >
> > [1]
> >
> >
> http://www.eclipse.org/virgo/documentation/virgo-documentation-3.0.0.x/docs/virgo-programmer-guide/html/ch09s05.html
> >
>
Loading...