tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <crackwil...@gmail.com>
Subject Re: Accessing resource in WEB-INF outside servlet
Date Mon, 08 Nov 2004 22:58:40 GMT
I am not sure where this discussion is coming from or going, but I
have no difficulty with reading resources inside WEB-INF.  First, I
use a Classpath class and the given classloaders something like the
following:

    package com.whatever.classpath;

    public final class Classpath {
      public static final String HERE = Classpath.
                                                        class.
                                                        getClassLoader().
                                                       
getResource("com" + File.separator +
                                                                      
    "whatever" + File.separator +
                                                                      
    "classpath" + File.separator +
                                                                      
    "Classpath.class").getFile();
    }


Other classes can then use this class and HERE as well as other paths
such as CLASSES, MESSAGES, or whatever, inside WEB-INF.

Is this helpful?

Jack


On Sun, 07 Nov 2004 16:50:37 +0100, Morkeleb <aslan@gmx.at> wrote:
> Hi.
> 
> I have a file in WEB-INF which I want to access.
> However, this is done in a static class which is not a servlet,
> so I do not have the servlet context.
> 
> Is there a way to access the servlet context non the less?
> Is there a way to make getResource find the file anyway?
> 
> I know a resource is found when it's in /WEB-INF/classes,
> but it is only in /WEB-INF/ and it is not an option to move
> it to the classes directory.
> 
> Can you help me?
> Thanx in Advance,
> Lukas Österreicher
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


-- 
"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message