Can I put private servlet files in the WEB-INF directory?

Discussion in 'Java' started by William Krick, Aug 25, 2004.

  1. I am currently experimenting with a servlet that makes use of data
    files to store information. I'd prefer that these files be NOT
    publicly accessible but
    I don't know if it's ok to put my own files into the WEB-INF directory
    to "hide" them from users or if I should put them in a
    hidden/protected folder OUTSIDE the deployment directory.

    Is there a general consensus on this?

    ....
    Krick
     
    William Krick, Aug 25, 2004
    #1
    1. Advertising

  2. William Krick wrote:

    > I am currently experimenting with a servlet that makes use of data
    > files to store information. I'd prefer that these files be NOT
    > publicly accessible but
    > I don't know if it's ok to put my own files into the WEB-INF directory
    > to "hide" them from users or if I should put them in a
    > hidden/protected folder OUTSIDE the deployment directory.
    >
    > Is there a general consensus on this?


    You can put anything you want into WEB-INF/, as long as it doesn't
    conflict with the files that the Servlet container expects to find
    there. It sounds like your planned use is perfectly in line with its
    purpose. Indeed, I think that having your servlet rely on non-shared
    files outside its deployment directory is a much worse idea than using
    WEB-INF. Best might be to put the files specifically in
    WEB-INF/classes, from which location they can be located by your
    servlet's ClassLoader (e.g. w/ getResource() or getResourceAsStream()).


    John Bollinger
     
    John C. Bollinger, Aug 25, 2004
    #2
    1. Advertising

  3. "John C. Bollinger" <> wrote in message news:<cgigv1$d9g$>...
    > William Krick wrote:
    >
    > > I am currently experimenting with a servlet that makes use of data
    > > files to store information. I'd prefer that these files be NOT
    > > publicly accessible but
    > > I don't know if it's ok to put my own files into the WEB-INF directory
    > > to "hide" them from users or if I should put them in a
    > > hidden/protected folder OUTSIDE the deployment directory.
    > >
    > > Is there a general consensus on this?

    >
    > You can put anything you want into WEB-INF/, as long as it doesn't
    > conflict with the files that the Servlet container expects to find
    > there. It sounds like your planned use is perfectly in line with its
    > purpose. Indeed, I think that having your servlet rely on non-shared
    > files outside its deployment directory is a much worse idea than using
    > WEB-INF. Best might be to put the files specifically in
    > WEB-INF/classes, from which location they can be located by your
    > servlet's ClassLoader (e.g. w/ getResource() or getResourceAsStream()).


    Actually, the servlet is an instance of the HSQLDB database and it
    handles all the file activity itself. I just need to give it a path.
    Thanks again for your input.

    ....
    Krick
     
    William Krick, Aug 26, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. circuit_breaker
    Replies:
    2
    Views:
    2,081
    Jack Jia
    Apr 4, 2004
  2. Matthew Macchia
    Replies:
    3
    Views:
    1,099
    Roedy Green
    Apr 13, 2004
  3. Hans
    Replies:
    3
    Views:
    2,617
    Ryan Stewart
    May 16, 2004
  4. Andrew Thompson

    Servlet container not recognizing WEB-INF

    Andrew Thompson, Aug 5, 2004, in forum: Java
    Replies:
    11
    Views:
    923
    Andrew Thompson
    Sep 21, 2004
  5. FCoue
    Replies:
    1
    Views:
    357
    Raymond DeCampo
    Jan 23, 2006
Loading...

Share This Page