tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <>
Subject Re: Static files outside container
Date Mon, 26 May 2008 21:49:36 GMT

----- Original Message ----- 
From: "Mathias P.W Nilsson" <>
To: <>
Sent: Monday, May 26, 2008 3:21 PM
Subject: Static files outside container

> Hi!
> I'm using tomcat as a container for my wicket application. To keep my 
> files
> when deploying I have my files outside the container.
> Wicket does not have support for static files out side the container so I
> have a servlet that handles the request. Problem is that There is multiple
> selects from the database with this solution.
> I would like a way of checking the path /Files/ and if this occures fetch
> the file from a different path. I know this is possible but just not how. 
> I
> have looked at the DefaultServlet for tomcat. Is this the way of doing 
> this?

If you asking how to read a file, for that check out Suns Java tutorial ;)
Too many options to cover here, they teach it better
    File f = new File("/da/folder");
    if (f.exists())  blah blah

If you trying to find yourself... try this and you'll get the idea
        ServletContext context = getServletContext();
        String sWebBase = context.getRealPath("/");

If you looking for a good place to stick your files, check out
    String user_home = System.getProperty("user.home");
and theres more useful java properties

Have fun

The most powerful application server on earth.
The only real POJO Application Server.
See it in Action :

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message